qubes-core-admin-linux/system-config/kernel-grub2.install
Marek Marczykowski-Górecki d1f3be0eed
kernel-install: avoid creating initramfs multiple times
There are multiple places where initramfs can be created:
 - /boot/iniramfs-*.img
 - /boot/$MACHINE_ID/.../initrd (unused on Qubes, but created by Fedora
   scripts)
 - /boot/efi/EFI/.../initramfs-*.img

Do not generate all of those from scratch, but try to reuse existing
image (if exists). Since one dracut call may last even 5 minutes, this
change should greatly reduce installation time.

Fixes QubesOS/qubes-issues#3637
2018-02-27 23:19:50 +01:00

24 lines
534 B
Bash
Executable File

#!/bin/sh
COMMAND="$1"
KVER="$2"
BOOT_DIR_ABS="$3"
case "$COMMAND" in
add)
if [ ! -e "/boot/initramfs-${KVER}.img" ]; then
if [ -e "$BOOT_DIR_ABS"/initrd ]; then
cp "$BOOT_DIR_ABS"/initrd "/boot/initramfs-${KVER}.img"
else
dracut "/boot/initramfs-${KVER}.img" "$KVER"
fi
fi
;;
remove)
rm -f "/boot/initramfs-${KVER}.img"
;;
esac
if [ -x /usr/sbin/grub2-mkconfig ]; then
grub2-mkconfig -o /boot/grub2/grub.cfg
fi