load EFI commands inside test expressions

Resolves: #2305291
Signed-off-by: Leo Sandoval <lsandova@redhat.com>
This commit is contained in:
Leo Sandoval 2024-09-05 12:37:59 -06:00
parent e3f47a4834
commit 3a9809b30e
3 changed files with 51 additions and 2 deletions

View file

@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Leo Sandoval <lsandova@redhat.com>
Date: Wed, 4 Sep 2024 13:25:23 -0600
Subject: [PATCH] load EFI commands inside test expressions
These two commands may fail interrumping the normal boot process,
so placing these inside test expressions is a safer approach.
Resolves: #2305291
Suggested-by: Kan-Ru Chen: <kanru@kanru.info>
Signed-off-by: Leo Sandoval <lsandova@redhat.com>
---
util/grub.d/25_bli.in | 4 +++-
util/grub.d/30_uefi-firmware.in | 3 +--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/util/grub.d/25_bli.in b/util/grub.d/25_bli.in
index 26e27a019..00a8d7159 100644
--- a/util/grub.d/25_bli.in
+++ b/util/grub.d/25_bli.in
@@ -19,6 +19,8 @@ set -e
cat << EOF
if [ "\$grub_platform" = "efi" ]; then
- insmod bli
+ if [ ! insmod bli ]; then
+ echo "bli module not available"
+ fi
fi
EOF
diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in
index 1c2365ddb..1ef31e08f 100644
--- a/util/grub.d/30_uefi-firmware.in
+++ b/util/grub.d/30_uefi-firmware.in
@@ -32,8 +32,7 @@ gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2
cat << EOF
if [ "\$grub_platform" = "efi" ]; then
- fwsetup --is-supported
- if [ "\$?" = 0 ]; then
+ if [ fwsetup --is-supported ]; then
menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
fwsetup
}

View file

@ -271,4 +271,5 @@ Patch0270: 0270-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch
Patch0271: 0271-grub2-mkconfig-Simplify-os_name-detection.patch
Patch0272: 0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch
Patch0273: 0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch
Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch
Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch
Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch

View file

@ -17,7 +17,7 @@
Name: grub2
Epoch: 1
Version: 2.12
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
License: GPL-3.0-or-later
URL: http://www.gnu.org/software/grub/
@ -560,6 +560,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
%endif
%changelog
* Thu Sep 5 2024 Leo Sandoval <lsandova@redhat.com> - 2.12-6
- load EFI commands inside test expressions
- Resolves: #2305291
* Thu Aug 29 2024 Leo Sandoval <lsandova@redhat.com> - 2.12-5
- Fix netbooting regressions introduced at 2.12-1
- Resolves: #2303727