grub2/0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch
Javier Martinez Canillas 7509e59c4a
Drop 10_linux_bls and avoid corner case of blsdir set with ostree
The logic to parse the BLS configs to generate a set of menuentry commands
that's needed on ppc64le machines with bootloaders that don't have support
to parse BLS config directly, was implemented in a 10_linux_bls script.

But there's no need to have a separate script just for this and this logic
can be merged into the 10_linux script to avoid code duplication.

Also since the blscfg module will also now be used by ostree-based distros
there is a possible corner case in which a user set the blsdir variable to
a BLS directory path that is different than the default used by ostree.

So to avoid possible issues, only drop the marker file to specify that the
bootloader has support to parse BLS files if this variable hasn't been set.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2020-04-02 14:44:30 +02:00

37 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.