Skip to content

Commit 3d8e1ad

Browse files
johannbgConan-Kudo
authored andcommitted
fix(dracut-initramfs-restore.sh): add missing default paths
Adding missing default paths. Fixes #1628
1 parent d3b5bc1 commit 3d8e1ad

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

dracut-initramfs-restore.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,33 @@ KERNEL_VERSION="$(uname -r)"
1717
SKIP="$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

2228
mount -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"
3439
elif [[ -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"
3647
else
3748
echo "No initramfs image found to restore!"
3849
exit 1

0 commit comments

Comments
 (0)