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