kernel-install: Remove existing initramfs if it's older than the kernel

Currently we fail to install a new kernel with "make install" on the second
try, because dracut won't over-write the initramfs without --force.  In this
patch, 20-grub.install will remove an existing initramfs if it's newer than the
kernel we're installing.

Resolves: rhbz#1638405
Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-10-11 16:13:17 -04:00 committed by Javier Martinez Canillas
parent 66078fcba2
commit 67aea4f8a5
No known key found for this signature in database
GPG key ID: C751E590D63F3D69

View file

@ -114,6 +114,12 @@ case "$COMMAND" in
fi
grub2-editenv - set "saved_entry=${NEWDEFAULT}"
# 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 \
-x /usr/lib/kernel/install.d/50-dracut.install ]; then
rm -f "${BOOTPREFIX}${INITRD}"
fi
exit 0
fi