]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(lsinitrd.sh): add missing default paths
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Fri, 22 Apr 2022 16:22:25 +0000 (18:22 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Mon, 25 Apr 2022 21:29:30 +0000 (21:29 +0000)
lsinitrd.sh

index e13929eabfdd7147db7eb39b081c82e67857a218..4175e4d8cf153ec7d9a477ca197f5d9912a70b0a 100755 (executable)
@@ -109,7 +109,13 @@ if [[ $1 ]]; then
         exit 1
     fi
 else
-    [[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
+    if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
+        MACHINE_ID="Default"
+    elif [[ -f /etc/machine-id ]]; then
+        read -r MACHINE_ID < /etc/machine-id
+    else
+        MACHINE_ID="Default"
+    fi
 
     if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
         && [[ $MACHINE_ID ]] \
@@ -119,8 +125,20 @@ else
         && [[ $MACHINE_ID ]] \
         && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
         image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
-    else
+    elif [[ -d /boot/efi/loader/entries || -L /boot/efi/loader/entries ]] \
+        && [[ $MACHINE_ID ]] \
+        && [[ -d /boot/efi/${MACHINE_ID} || -L /boot/efi/${MACHINE_ID} ]]; then
+        image="/boot/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
+        image="/lib/modules/${KERNEL_VERSION}/initrd"
+    elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
         image="/boot/initramfs-${KERNEL_VERSION}.img"
+    elif mountpoint -q /efi; then
+        image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    elif mountpoint -q /boot/efi; then
+        image="/boot/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    else
+        image=""
     fi
 fi