From: Antonio Alvarez Feijoo Date: Fri, 22 Apr 2022 16:22:25 +0000 (+0200) Subject: fix(lsinitrd.sh): add missing default paths X-Git-Tag: 057~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49ea6c42db7180eec5ba57e082a38d116f2d17a5;p=thirdparty%2Fdracut.git fix(lsinitrd.sh): add missing default paths --- diff --git a/lsinitrd.sh b/lsinitrd.sh index e13929eab..4175e4d8c 100755 --- a/lsinitrd.sh +++ b/lsinitrd.sh @@ -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