9abf8c
From 0e43b934b98e40efeed0781e8bdf9f805d8d7217 Mon Sep 17 00:00:00 2001
9abf8c
From: Javier Martinez Canillas <javierm@redhat.com>
9abf8c
Date: Tue, 5 May 2020 19:11:18 +0200
9abf8c
Subject: [PATCH] 51-dracut-rescue.install: Don't use BLS fragment shipped by
9abf8c
 kernel package
9abf8c
9abf8c
For the GRUB and zipl bootloaders the BLS fragment that is shipped by the
9abf8c
kernel package is used, so the same fragment is used for the rescue entry.
9abf8c
9abf8c
But there are cases where this BLS fragment is not suitable. For example,
9abf8c
if the boot directory is on a btrfs subvolume the path in the linux and
9abf8c
initrd fiels need to be adjusted with the real path. Otherwise GRUB won't
9abf8c
be able to read them.
9abf8c
9abf8c
The GRUB and zipl kernel-install plugins already take care of this before
9abf8c
installing the BLS fragments, so just copy the installed fragment that has
9abf8c
the updated paths instead of using the BLS shipped by the kernel package.
9abf8c
9abf8c
Resolves: rhbz#1827882
9abf8c
9abf8c
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
9abf8c
(cherry picked from commit ff366790a6e30175f243d54c2922a8c781030ede)
9abf8c
9abf8c
Resolves: #1894026
9abf8c
---
9abf8c
 51-dracut-rescue.install | 6 +++++-
9abf8c
 1 file changed, 5 insertions(+), 1 deletion(-)
9abf8c
9abf8c
diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install
9abf8c
index 5ac34ef3..47eb8e7d 100755
9abf8c
--- a/51-dracut-rescue.install
9abf8c
+++ b/51-dracut-rescue.install
9abf8c
@@ -104,7 +104,11 @@ case "$COMMAND" in
9abf8c
                 echo "initrd     $BOOT_DIR/initrd"
9abf8c
             } > $LOADER_ENTRY
9abf8c
         else
9abf8c
-            cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY
9abf8c
+            if [[ -e "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" ]]; then
9abf8c
+                cp -aT "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" $LOADER_ENTRY
9abf8c
+            else
9abf8c
+                cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY
9abf8c
+            fi
9abf8c
             sed -i 's/'$KERNEL_VERSION'/0-rescue-'${MACHINE_ID}'/' $LOADER_ENTRY
9abf8c
         fi
9abf8c
 
9322d7