From 67aea4f8a57cdfa09a638751a37bbf62a318a306 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Oct 23 2018 10:23:25 +0000 Subject: 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 --- diff --git a/20-grub.install b/20-grub.install index de1182f..4e67c03 100755 --- a/20-grub.install +++ b/20-grub.install @@ -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