From 89bc295877ee4e91e1c566c7aacefc89f833ec76 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 13 Jan 2020 19:48:23 +0100 Subject: [PATCH] Make blscfg to support the GRUB_SAVEDEFAULT option This option was not supported on a BLS configuration. Resolves: rhbz#1704926 Signed-off-by: Javier Martinez Canillas --- 0191-Fix-savedefault-with-blscfg.patch | 50 ++++++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 0191-Fix-savedefault-with-blscfg.patch diff --git a/0191-Fix-savedefault-with-blscfg.patch b/0191-Fix-savedefault-with-blscfg.patch new file mode 100644 index 0000000..51d5b82 --- /dev/null +++ b/0191-Fix-savedefault-with-blscfg.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fritz Elfert +Date: Mon, 13 Jan 2020 19:29:58 +0100 +Subject: [PATCH] Fix savedefault with blscfg + +The GRUB_SAVEDEFAULT option was ignored on a BLS configuration. Fix it by +making the menu entries populated from the BLS files to call savedefault +if a save_default environment variable has been set to "true". + +This variable is set by grub2-mkconfig to the value in GRUB_SAVEDEFAULT. +--- + grub-core/commands/blscfg.c | 5 ++++- + util/grub.d/10_linux.in | 4 ++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 83b33c1cd93..069db721bec 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -889,11 +889,14 @@ static void create_entry (struct bls_entry *entry) + + grub_dprintf ("blscfg2", "devicetree %s for id:\"%s\"\n", dt, id); + +- src = grub_xasprintf ("load_video\n" ++ const char *sdval = grub_env_get("save_default"); ++ bool savedefault = ((NULL != sdval) && (grub_strcmp(sdval, "true") == 0)); ++ src = grub_xasprintf ("%sload_video\n" + "set gfxpayload=keep\n" + "insmod gzio\n" + "linux %s%s%s%s\n" + "%s%s", ++ savedefault ? "savedefault\n" : "", + GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", + initrd ? initrd : "", dt ? dt : ""); + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 21a6915dca3..b70dca27567 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -152,6 +152,10 @@ EOF + if [ -n "${GRUB_DEFAULT_DTB}" ]; then + ${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}" + fi ++ ++ if [ -n "${GRUB_SAVEDEFAULT}" ]; then ++ ${grub_editenv} - set save_default="${GRUB_SAVEDEFAULT}" ++ fi + fi + + exit 0 diff --git a/grub.patches b/grub.patches index 26cd85e..3b3c6a2 100644 --- a/grub.patches +++ b/grub.patches @@ -188,3 +188,4 @@ Patch0187: 0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch Patch0188: 0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch Patch0189: 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch Patch0190: 0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch +Patch0191: 0191-Fix-savedefault-with-blscfg.patch diff --git a/grub2.spec b/grub2.spec index 4a2d5fc..f370365 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -512,6 +512,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Jan 13 2020 Javier Martinez Canillas - 2.04-8 +- Make the blscfg module honour the GRUB_SAVEDEFAULT option (fritz) + Resolves: rhbz#1704926 + * Mon Jan 06 2020 Peter Jones - 2.04-7 - Add zstd to the EFI module list. Related: rhbz#1418336