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