@@ -17,22 +17,33 @@ KERNEL_VERSION="$(uname -r)"
1717SKIP=" $dracutbasedir /skipcpio"
1818[[ -x $SKIP ]] || SKIP=" cat"
1919
20- [[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
20+ if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
21+ MACHINE_ID=" Default"
22+ elif [[ -f /etc/machine-id ]]; then
23+ read -r MACHINE_ID < /etc/machine-id
24+ else
25+ MACHINE_ID=" Default"
26+ fi
2127
2228mount -o ro /boot & > /dev/null || true
2329
24- if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
25- && [[ $MACHINE_ID ]] \
26- && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
30+ if [[ -d /efi/loader/entries ]] || [[ -L /efi/loader/entries ]] \
31+ || [[ -d /efi/$MACHINE_ID ]] || [[ -L /efi/$MACHINE_ID ]]; then
2732 IMG=" /efi/${MACHINE_ID} /${KERNEL_VERSION} /initrd"
28- elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
29- && [[ $MACHINE_ID ]] \
30- && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
33+ elif [[ -d /boot/loader/entries ]] || [[ -L /boot/loader/entries ]] \
34+ || [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]]; then
3135 IMG=" /boot/${MACHINE_ID} /${KERNEL_VERSION} /initrd"
32- elif [[ -f /boot/initramfs-${KERNEL_VERSION} .img ]]; then
33- IMG=" /boot/initramfs-${KERNEL_VERSION} .img"
36+ elif [[ -d /boot/efi/loader/entries ]] || [[ -L /boot/efi/loader/entries ]] \
37+ || [[ -d /boot/efi/$MACHINE_ID ]] || [[ -L /boot/efi/$MACHINE_ID ]]; then
38+ IMG=" /boot/efi/$MACHINE_ID /$KERNEL_VERSION /initrd"
3439elif [[ -f /lib/modules/${KERNEL_VERSION} /initrd ]]; then
3540 IMG=" /lib/modules/${KERNEL_VERSION} /initrd"
41+ elif [[ -f /boot/initramfs-${KERNEL_VERSION} .img ]]; then
42+ IMG=" /boot/initramfs-${KERNEL_VERSION} .img"
43+ elif mountpoint -q /efi; then
44+ IMG=" /efi/$MACHINE_ID /$KERNEL_VERSION /initrd"
45+ elif mountpoint -q /boot/efi; then
46+ IMG=" /boot/efi/$MACHINE_ID /$KERNEL_VERSION /initrd"
3647else
3748 echo " No initramfs image found to restore!"
3849 exit 1
0 commit comments