grub2/0200-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch
Peter Jones 3b94406a9e "Minor" bug fixes
CVE-2020-10713
  CVE-2020-14308
  CVE-2020-14309
  CVE-2020-14310
  CVE-2020-14311
  CVE-2020-15705
  CVE-2020-15706
  CVE-2020-15707

Signed-off-by: Peter Jones <pjones@redhat.com>
2020-07-29 13:39:24 -04:00

40 lines
1.8 KiB
Diff

From 5c365350a3b1558114a385dc6c85fe2094247fcc 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 200/237] 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.
--
2.26.2