From: Harald Hoyer Date: Tue, 4 May 2021 08:36:44 +0000 (+0200) Subject: feat: also restore the initramfs from /lib/modules X-Git-Tag: 054~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33e27fab59db60b1ca05a0c5b8a51fccb98578e5;p=thirdparty%2Fdracut.git feat: also restore the initramfs from /lib/modules Fallback to /lib/modules/$(uname -r)/initrd, if present and all other files don't exist. --- diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh index 8fe23df0d..abe6b1e20 100644 --- a/dracut-initramfs-restore.sh +++ b/dracut-initramfs-restore.sh @@ -24,14 +24,17 @@ elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \ && [[ $MACHINE_ID ]] \ && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" -else +elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then IMG="/boot/initramfs-${KERNEL_VERSION}.img" +elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then + IMG="/lib/modules/${KERNEL_VERSION}/initrd" +else + echo "No initramfs image found to restore!" + exit 1 fi cd /run/initramfs -[ -f .need_shutdown -a -f "$IMG" ] || exit 1 - if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then rm -f -- .need_shutdown elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then