let cp remove the destination files

clone of https://src.fedoraproject.org/rpms/grub2/c/e1206cf45b3bdde97e166d5c0d55842c864a1c9e?branch=rawhide
This commit is contained in:
Dan Horák 2023-11-10 11:59:34 +01:00
commit ca71fe340e

View file

@ -55,8 +55,7 @@ case "$COMMAND" in
add)
if [[ "${KERNEL_DIR}" != "/boot" ]]; then
# rename to match the name used in the pseudo-BLS snippet above
rm -f "/boot/vmlinuz-${KERNEL_VERSION}"
cp --preserve=timestamps -T "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}"
cp --remove-destination --preserve=timestamps -T "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}"
command -v restorecon &>/dev/null && \
restorecon -R "/boot/vmlinuz-${KERNEL_VERSION}"