Skip to content

Commit

Permalink
fix(lsinitrd.sh): add missing default paths
Browse files Browse the repository at this point in the history
  • Loading branch information
aafeijoo-suse authored and johannbg committed Apr 25, 2022
1 parent 28ef3bc commit 49ea6c4
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lsinitrd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]] \
Expand All @@ -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

Expand Down

0 comments on commit 49ea6c4

Please sign in to comment.