grub2/0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch
Petr Šabata 100e37f2e6 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/grub2#f7e054f3d693af43a903faf33b70673f7aca4508
2020-10-15 09:48:35 +02:00

38 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Thu, 2 Apr 2020 11:07:24 +0200
Subject: [PATCH] grub-switch-to-blscfg: Only mark GRUB as BLS supported if
blsdir isn't set
If the user set the blsdir environemnt variable to a path that is not the
default where ostree writes the BLS snippets, the blscfg module won't be
able to parse them and can lead to not having any menu entries on boot.
So to minimize the risk of things going wrong when dropping the 15_ostree
script used by ostree to create the menu entries, only mark the bootloader
as BLS supported if the blsdir variable has not been set.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub-switch-to-blscfg.in | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
index a05a8d98554..4bbed8e4fe9 100644
--- a/util/grub-switch-to-blscfg.in
+++ b/util/grub-switch-to-blscfg.in
@@ -267,8 +267,11 @@ copy_bls() {
}
# The grub2 EFI binary is not copied to the ESP as a part of an ostree
-# transaction. Make sure a grub2 version with BLS support is installed.
-if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars/; then
+# transaction. Make sure a grub2 version with BLS support is installed
+# but only do this if the blsdir is not set, to make sure that the BLS
+# parsing module will search for the BLS snippets in the default path.
+if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \
+ ! ${grub_editenv} - list | grep -q blsdir; then
grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)"
cp ${grub_binary} ${grubdir} || exit 1
# Create a hidden file to indicate that grub2 now has BLS support.