Skip to content

Commit 49ea6c4

Browse files
aafeijoo-susejohannbg
authored andcommitted
fix(lsinitrd.sh): add missing default paths
1 parent 28ef3bc commit 49ea6c4

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

lsinitrd.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ if [[ $1 ]]; then
109109
exit 1
110110
fi
111111
else
112-
[[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
112+
if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
113+
MACHINE_ID="Default"
114+
elif [[ -f /etc/machine-id ]]; then
115+
read -r MACHINE_ID < /etc/machine-id
116+
else
117+
MACHINE_ID="Default"
118+
fi
113119

114120
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
115121
&& [[ $MACHINE_ID ]] \
@@ -119,8 +125,20 @@ else
119125
&& [[ $MACHINE_ID ]] \
120126
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
121127
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
122-
else
128+
elif [[ -d /boot/efi/loader/entries || -L /boot/efi/loader/entries ]] \
129+
&& [[ $MACHINE_ID ]] \
130+
&& [[ -d /boot/efi/${MACHINE_ID} || -L /boot/efi/${MACHINE_ID} ]]; then
131+
image="/boot/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
132+
elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
133+
image="/lib/modules/${KERNEL_VERSION}/initrd"
134+
elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
123135
image="/boot/initramfs-${KERNEL_VERSION}.img"
136+
elif mountpoint -q /efi; then
137+
image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
138+
elif mountpoint -q /boot/efi; then
139+
image="/boot/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
140+
else
141+
image=""
124142
fi
125143
fi
126144

0 commit comments

Comments
 (0)