diff --git a/20-grub.install b/20-grub.install index 3f6e33f6..3238e430 100755 --- a/20-grub.install +++ b/20-grub.install @@ -62,6 +62,7 @@ case "$COMMAND" in "$KERNEL_DIR"/dtb do [[ -e "$i" ]] || continue + rm -f "/boot/${i##*/}-${KERNEL_VERSION}" cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}" command -v restorecon &>/dev/null && \ restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}" @@ -69,6 +70,7 @@ case "$COMMAND" in # hmac is .vmlinuz-.hmac so needs a special treatment i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" if [[ -e "$i" ]]; then + rm -f "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" cp -a "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" command -v restorecon &>/dev/null && \ restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" @@ -92,6 +94,7 @@ case "$COMMAND" in INITRD="$(grep '^initrd[ \t]' "${BLS_TARGET}" | sed -e 's,^initrd[ \t]*,,')" LINUX_RELPATH="$(grub2-mkrelpath /boot${LINUX})" BOOTPREFIX="$(dirname ${LINUX_RELPATH})" + ROOTPREFIX="$(dirname "/boot${LINUX}")" if [[ $LINUX != $LINUX_RELPATH ]]; then sed -i -e "s,^linux.*,linux ${BOOTPREFIX}${LINUX},g" "${BLS_TARGET}" @@ -124,10 +127,10 @@ case "$COMMAND" in fi # this probably isn't the best place to do this, but it will do for now. - if [ -e "${BOOTPREFIX}${INITRD}" -a -e "${BOOTPREFIX}${LINUX}" -a \ - "${BOOTPREFIX}${INITRD}" -ot "${BOOTPREFIX}${LINUX}" -a \ + if [ -e "${ROOTPREFIX}${INITRD}" -a -e "${ROOTPREFIX}${LINUX}" -a \ + "${ROOTPREFIX}${INITRD}" -ot "${ROOTPREFIX}${LINUX}" -a \ -x /usr/lib/kernel/install.d/50-dracut.install ]; then - rm -f "${BOOTPREFIX}${INITRD}" + rm -f "${ROOTPREFIX}${INITRD}" fi exit 0 fi