[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 5/5] Don't display a uefi-firmware entry if it's not supported
From: |
Robbie Harwood |
Subject: |
[PATCH v4 5/5] Don't display a uefi-firmware entry if it's not supported |
Date: |
Fri, 19 Aug 2022 16:54:44 -0400 |
Add a new --is-supported option to commands/efi/efifwsetup and
conditionalize display on it.
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
grub-core/commands/efi/efifwsetup.c | 3 +++
util/grub.d/30_uefi-firmware.in | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/grub-core/commands/efi/efifwsetup.c
b/grub-core/commands/efi/efifwsetup.c
index cb4b6ff18c..53d23deea7 100644
--- a/grub-core/commands/efi/efifwsetup.c
+++ b/grub-core/commands/efi/efifwsetup.c
@@ -40,6 +40,9 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)),
grub_size_t oi_size;
static grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
+ if (argc >= 1 && grub_strcmp(args[0], "--is-supported") == 0)
+ return !efifwsetup_is_supported ();
+
if (!efifwsetup_is_supported ())
return grub_error (GRUB_ERR_INVALID_COMMAND,
N_("reboot to firmware setup is not supported by
the current firmware"));
diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in
index b6041b55e2..78aef67d78 100644
--- a/util/grub.d/30_uefi-firmware.in
+++ b/util/grub.d/30_uefi-firmware.in
@@ -31,7 +31,7 @@ LABEL="UEFI Firmware Settings"
gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2
cat << EOF
-if [ "\$grub_platform" = "efi" ]; then
+if [ "\$grub_platform" = "efi" ] && fwsetup --is-supported; then
menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
fwsetup
}
--
2.35.1
- [PATCH 0/2] grub.texi: Document fwsetup and fix typo, Robbie Harwood, 2022/08/19
- [PATCH v4 3/5] templates: Check for EFI at runtime instead of config generation time, Robbie Harwood, 2022/08/19
- [PATCH v4 0/5] Improve logic to check for fwsetup support, Robbie Harwood, 2022/08/19
- [PATCH v4 5/5] Don't display a uefi-firmware entry if it's not supported,
Robbie Harwood <=
- [PATCH 2/2] grub.texi: Fix mismatched brackets in halt command, Robbie Harwood, 2022/08/19
- [PATCH 1/1] grub.texi: Fix mismatched brackets in halt command, Robbie Harwood, 2022/08/19
- [PATCH 1/2] grub.text: Document fwsetup command, Robbie Harwood, 2022/08/19
- [PATCH v4 1/5] commands/efi/efifwsetup: Add missing grub_free()s, Robbie Harwood, 2022/08/19
- [PATCH v4 4/5] efi: Print an error if boot to firmware setup is not supported, Robbie Harwood, 2022/08/19
- [PATCH v4 2/5] Make all grub_efi_guid_t variables static, Robbie Harwood, 2022/08/19