mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 15:46:53 +00:00
grub-switch-to-blscfg: Update grub2 binary in ESP for OSTree systems
Related: rhbz#1751272 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
749be472a6
commit
0f180aa21f
4 changed files with 81 additions and 1 deletions
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Thu, 26 Mar 2020 15:08:30 +0100
|
||||
Subject: [PATCH] grub-switch-to-blscfg: Update grub2 binary in ESP for OSTree
|
||||
systems
|
||||
|
||||
The grub2 EFI binary in the ESP isn't updated as a part of an OSTree update
|
||||
transaction. So let's make the script to update this and also create a file
|
||||
to indicate that the installed version has support for the blscfg module.
|
||||
|
||||
Related: rhbz#1751272
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
util/grub-switch-to-blscfg.in | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
|
||||
index 49b3985fadb..a05a8d98554 100644
|
||||
--- a/util/grub-switch-to-blscfg.in
|
||||
+++ b/util/grub-switch-to-blscfg.in
|
||||
@@ -266,6 +266,15 @@ copy_bls() {
|
||||
fi
|
||||
}
|
||||
|
||||
+# 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
|
||||
+ 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.
|
||||
+ touch /boot/grub2/.grub2-blscfg-supported
|
||||
+fi
|
||||
+
|
||||
GENERATE=0
|
||||
if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \
|
||||
| grep -vq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' ; then
|
|
@ -0,0 +1,37 @@
|
|||
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.
|
|
@ -196,3 +196,5 @@ Patch0195: 0195-blscfg-add-a-space-char-when-appending-fields-for-va.patch
|
|||
Patch0196: 0196-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch
|
||||
Patch0197: 0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch
|
||||
Patch0198: 0198-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch
|
||||
Patch0199: 0199-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch
|
||||
Patch0200: 0200-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.02
|
||||
Release: 106%{?dist}
|
||||
Release: 107%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
|
@ -518,6 +518,10 @@ rm -r /boot/grub2.tmp/ || :
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Apr 02 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.02-107
|
||||
- grub-switch-to-blscfg: Update grub2 binary in ESP for OSTree systems
|
||||
Related: rhbz#1751272
|
||||
|
||||
* Tue Mar 17 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.02-106
|
||||
- Fix menu entries having an unneeded initrd command and other BLS fixes
|
||||
Resolves: rhbz#1806022
|
||||
|
|
Loading…
Reference in a new issue