46e28b
From f5ef6694eae2696b10b4f6e5a0d72a29223651ce Mon Sep 17 00:00:00 2001
46e28b
From: Kairui Song <kasong@tencent.com>
46e28b
Date: Tue, 20 Sep 2022 02:13:01 +0800
46e28b
Subject: [PATCH] fix(dracut-initramfs-restore.sh): initramfs detection not
46e28b
 working
46e28b
46e28b
The path detection is not working on latest Fedora and some other
46e28b
distros, and it fails to extract the initramfs. It seems the if
46e28b
statement is broken by a previous commit, so let's fix it.
46e28b
46e28b
Fixes: 3d8e1ad ('fix(dracut-initramfs-restore.sh): add missing default paths')
46e28b
Signed-off-by: Kairui Song <kasong@tencent.com>
46e28b
(cherry picked from commit 481b87fa7a82be54663071ad9ad76c34e378ddc7)
46e28b
46e28b
Resolves: #2149232
46e28b
---
46e28b
 dracut-initramfs-restore.sh | 12 ++++++------
46e28b
 1 file changed, 6 insertions(+), 6 deletions(-)
46e28b
46e28b
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
46e28b
index 68ea3873..df6cb9a8 100644
46e28b
--- a/dracut-initramfs-restore.sh
46e28b
+++ b/dracut-initramfs-restore.sh
46e28b
@@ -27,14 +27,14 @@ fi
46e28b
 
46e28b
 mount -o ro /boot &> /dev/null || true
46e28b
 
46e28b
-if [[ -d /efi/loader/entries ]] || [[ -L /efi/loader/entries ]] \
46e28b
-    || [[ -d /efi/$MACHINE_ID ]] || [[ -L /efi/$MACHINE_ID ]]; then
46e28b
+if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
46e28b
+    && [[ -d /efi/$MACHINE_ID || -L /efi/$MACHINE_ID ]]; then
46e28b
     IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
46e28b
-elif [[ -d /boot/loader/entries ]] || [[ -L /boot/loader/entries ]] \
46e28b
-    || [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]]; then
46e28b
+elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
46e28b
+    && [[ -d /boot/$MACHINE_ID || -L /boot/$MACHINE_ID ]]; then
46e28b
     IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
46e28b
-elif [[ -d /boot/efi/loader/entries ]] || [[ -L /boot/efi/loader/entries ]] \
46e28b
-    || [[ -d /boot/efi/$MACHINE_ID ]] || [[ -L /boot/efi/$MACHINE_ID ]]; then
46e28b
+elif [[ -d /boot/efi/loader/entries || -L /boot/efi/loader/entries ]] \
46e28b
+    && [[ -d /boot/efi/$MACHINE_ID || -L /boot/efi/$MACHINE_ID ]]; then
46e28b
     IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
46e28b
 elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
46e28b
     IMG="/lib/modules/${KERNEL_VERSION}/initrd"
46e28b