aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJóhann B. Guðmundsson <johannbg@gmail.com>2021-11-07 14:19:15 +0000
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>2021-12-11 10:58:18 -0500
commit3d8e1ad2ae1e34244ddf700beea6358c1452e05c (patch)
tree412a7d5c50ba8adabdc29fbd5a17be76167aabbe
parentd3b5bc17ebadfe8922d1144b3dfd5435d0ecc71a (diff)
downloaddracut-3d8e1ad2ae1e34244ddf700beea6358c1452e05c.tar.gz
fix(dracut-initramfs-restore.sh): add missing default paths
Adding missing default paths. Fixes #1628
-rw-r--r--dracut-initramfs-restore.sh29
1 files changed, 20 insertions, 9 deletions
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
index d97030a3..aa9aec92 100644
--- a/dracut-initramfs-restore.sh
+++ b/dracut-initramfs-restore.sh
@@ -17,22 +17,33 @@ KERNEL_VERSION="$(uname -r)"
SKIP="$dracutbasedir/skipcpio"
[[ -x $SKIP ]] || SKIP="cat"
-[[ -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
mount -o ro /boot &> /dev/null || true
-if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
- && [[ $MACHINE_ID ]] \
- && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
+if [[ -d /efi/loader/entries ]] || [[ -L /efi/loader/entries ]] \
+ || [[ -d /efi/$MACHINE_ID ]] || [[ -L /efi/$MACHINE_ID ]]; then
IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
-elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
- && [[ $MACHINE_ID ]] \
- && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
+elif [[ -d /boot/loader/entries ]] || [[ -L /boot/loader/entries ]] \
+ || [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]]; then
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
-elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
- IMG="/boot/initramfs-${KERNEL_VERSION}.img"
+elif [[ -d /boot/efi/loader/entries ]] || [[ -L /boot/efi/loader/entries ]] \
+ || [[ -d /boot/efi/$MACHINE_ID ]] || [[ -L /boot/efi/$MACHINE_ID ]]; then
+ IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
IMG="/lib/modules/${KERNEL_VERSION}/initrd"
+elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
+ IMG="/boot/initramfs-${KERNEL_VERSION}.img"
+elif mountpoint -q /efi; then
+ IMG="/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
+elif mountpoint -q /boot/efi; then
+ IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
else
echo "No initramfs image found to restore!"
exit 1