From 77a8c0bcac0ed4d34b1410a41a99530252d7ed65 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 22 Nov 2019 14:59:58 +0100 Subject: [PATCH 01/18] grubby-bls: don't print rpm-sort error messages If there are no BLS snippets, an empty array of strings is passed to the rpm-sort tool and it will print an error that just confuses grubby users. Resolves: rhbz#1731924 Signed-off-by: Javier Martinez Canillas --- grubby-bls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grubby-bls b/grubby-bls index 90db0a5..8c423dd 100755 --- a/grubby-bls +++ b/grubby-bls @@ -92,7 +92,7 @@ get_bls_values() { bls="${bls%.conf}" bls="${bls##*/}" echo "${bls}" - done | /usr/libexec/grubby/rpm-sort -c rpmnvrcmp | tac)) || : + done | /usr/libexec/grubby/rpm-sort -c rpmnvrcmp 2>/dev/null | tac)) || : for bls in "${files[@]}" ; do blspath="${blsdir}/${bls}.conf" From 5dafc374ee5bd4283ed18e905c6e95dacbe0e9fb Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 22 Nov 2019 15:52:17 +0100 Subject: [PATCH 02/18] grubby-bls: remove -o option and support -c for ppc64le grub config Resolves: rhbz#1758598 Signed-off-by: Javier Martinez Canillas --- grubby-bls | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/grubby-bls b/grubby-bls index 8c423dd..24790a8 100755 --- a/grubby-bls +++ b/grubby-bls @@ -572,7 +572,7 @@ remove_var_prefix() { update_grubcfg() { if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then - grub2-mkconfig -o /boot/grub2/grub.cfg >& /dev/null + grub2-mkconfig -o "${grub_config}" >& /dev/null fi } @@ -595,7 +595,6 @@ Usage: grubby [OPTION...] --initrd=initrd-path initrd image for the new kernel -i, --extra-initrd=initrd-path auxiliary initrd image for things other than the new kernel --make-default make the newly added entry the default boot entry - -o, --output-file=path path to output updated config file ("-" for stdout) --remove-args=STRING remove kernel arguments --remove-kernel=kernel-path remove all entries for the specified kernel --set-default=kernel-path make the first entry referencing the specified kernel the default @@ -611,9 +610,9 @@ Help options: EOF } -OPTS="$(getopt -o c:i:o:b:? --long help,add-kernel:,args:,bad-image-okay,\ +OPTS="$(getopt -o c:i:b:? --long help,add-kernel:,args:,bad-image-okay,\ config-file:,copy-default,default-kernel,default-index,default-title,env:,\ -grub2,info:,initrd:,extra-initrd:,make-default,output-file:,remove-args:,\ +grub2,info:,initrd:,extra-initrd:,make-default,remove-args:,\ remove-kernel:,set-default:,set-default-index:,title:,update-kernel:,zipl,\ bls-directory:,add-kernel:,add-multiboot:,mbargs:,mounts:,boot-filesystem:,\ bootloader-probe,debug,devtree,devtreedir:,elilo,efi,extlinux,grub,lilo,\ @@ -641,6 +640,7 @@ while [ ${#} -gt 0 ]; do bad_image=true ;; --config-file|-c) + grub_config="${2}" zipl_config="${2}" shift ;; @@ -678,10 +678,6 @@ while [ ${#} -gt 0 ]; do --make-default) make_default=true ;; - --output-file|-o) - output_file="${2}" - shift - ;; --remove-args) remove_args="${2}" shift @@ -754,6 +750,10 @@ if [[ -z $zipl_config ]]; then zipl_config="/etc/zipl.conf" fi +if [[ -z $grub_config ]]; then + grub_config="/boot/grub2/grub.cfg" +fi + get_bls_values default_index="$(get_default_index)" From 08153fc1d69f8766bfccd46134969b4f2fecc541 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 27 Nov 2019 17:08:03 +0100 Subject: [PATCH 03/18] grubby-bls: fix logic to check if the kernelopts var is defined in a BLS The logic to check if a kernelopts variable is defined in a BLS entry was wrong and caused grubby to expand the variables even when it was defined. Resolves: rhbz#1726514 Signed-off-by: Javier Martinez Canillas --- grubby-bls | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grubby-bls b/grubby-bls index 24790a8..06a021b 100755 --- a/grubby-bls +++ b/grubby-bls @@ -224,10 +224,10 @@ has_kernelopts() local opts=(${args}) for opt in ${opts[*]}; do - [[ $opt = "\$kernelopts" ]] && return 0 + [[ $opt = "\$kernelopts" ]] && echo "true" done - return 1 + echo "false" } get_bls_args() { @@ -504,11 +504,11 @@ update_bls_fragment() { local old_args="$(get_bls_args "$i")" local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")" - if [[ $param != "ALL" || ! "$(has_kernelopts "$i")" ]]; then + if [[ $param != "ALL" || "$(has_kernelopts "$i")" = "false" ]]; then set_bls_value "${bls_file[$i]}" "options" "${new_args}" fi - if [[ $bootloader = grub2 && ! "$(has_kernelopts "$i")" && $opts = $new_args ]]; then + if [[ $bootloader = grub2 && "$(has_kernelopts "$i")" = "false" && $opts = $new_args ]]; then set_bls_value "${bls_file[$i]}" "options" "\$kernelopts" fi fi From 3ffa2d2706d76cf64c584cc3eabe89201f0ac8bc Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 28 Nov 2019 12:11:39 +0100 Subject: [PATCH 04/18] Fix logic that checks for kernelopts in BLS files and some cleanups grubby-bls: don't print rpm-sort error messages Resolves: rhbz#1731924 grubby-bls: remove -o option and support -c for ppc64le grub config Resolves: rhbz#1758598 grubby-bls: fix logic to check if the kernelopts var is defined in a BLS Resolves: rhbz#1726514 Signed-off-by: Javier Martinez Canillas --- grubby.spec | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grubby.spec b/grubby.spec index 152cc26..b87c1bc 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 36%{?dist} +Release: 37%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -131,6 +131,14 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Thu Nov 28 2019 Javier Martinez Canillas - 8.40-37 +- grubby-bls: don't print rpm-sort error messages + Resolves: rhbz#1731924 +- grubby-bls: remove -o option and support -c for ppc64le grub config + Resolves: rhbz#1758598 +- grubby-bls: fix logic to check if the kernelopts var is defined in a BLS + Resolves: rhbz#1726514 + * Tue Aug 06 2019 Yuval Turgeman - 8.40-36 - grubby-bls: strip only /boot from paths From b5070e227834b2cfeb531a111972770c703ead23 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 29 Nov 2019 23:56:07 +0100 Subject: [PATCH 05/18] grubby-bls: don't update grubenv when generating grub.cfg for ppc64le Since PowerNV machines can have a Petitboot versions that still don't have BLS support, grubby re-generates the grub.cfg file on all ppc64le machines. But this has the side effect that the grubenv file is updated, which will overwrite any value that was set by grubby itself. To prevent that run the grub2-mkconfig with the --no-grubenv-update option. Related: rhbz#1726514 Signed-off-by: Javier Martinez Canillas --- grubby-bls | 2 +- grubby.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/grubby-bls b/grubby-bls index 06a021b..2c6cb3d 100755 --- a/grubby-bls +++ b/grubby-bls @@ -572,7 +572,7 @@ remove_var_prefix() { update_grubcfg() { if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then - grub2-mkconfig -o "${grub_config}" >& /dev/null + grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null fi } diff --git a/grubby.spec b/grubby.spec index b87c1bc..acb69a0 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 37%{?dist} +Release: 38%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -131,6 +131,10 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Fri Nov 29 2019 Javier Martinez Canillas - 8.40-38 +- grubby-bls: don't update grubenv when generating grub.cfg for ppc64le + Related: rhbz#1726514 + * Thu Nov 28 2019 Javier Martinez Canillas - 8.40-37 - grubby-bls: don't print rpm-sort error messages Resolves: rhbz#1731924 From 03b13cef758e336aedc910beac1e8d95433c2197 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jan 2020 03:36:54 +0000 Subject: [PATCH 06/18] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- grubby.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grubby.spec b/grubby.spec index acb69a0..698f578 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 38%{?dist} +Release: 39%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -131,6 +131,9 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Wed Jan 29 2020 Fedora Release Engineering - 8.40-39 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Fri Nov 29 2019 Javier Martinez Canillas - 8.40-38 - grubby-bls: don't update grubenv when generating grub.cfg for ppc64le Related: rhbz#1726514 From 5f9558c222c0dfc8389f51892a3720791e55ed36 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 10 Feb 2020 19:30:45 +0100 Subject: [PATCH 07/18] Fix FTBFS and a couple of cleanups Fix FTBFS Resolves: rhbz#1799496 Fix wrong S-o-B tag in patch Fix warning about using unversioned Obsoletes Signed-off-by: Javier Martinez Canillas --- ...-about-possible-string-truncations-a.patch | 4 +- 0011-Fix-stringop-overflow-warning.patch | 72 +++++++++++++++++++ 0012-Fix-maybe-uninitialized-warning.patch | 35 +++++++++ grubby.spec | 12 +++- 4 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 0011-Fix-stringop-overflow-warning.patch create mode 100644 0012-Fix-maybe-uninitialized-warning.patch diff --git a/0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch b/0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch index 24d3d30..c4de866 100644 --- a/0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch +++ b/0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch @@ -1,5 +1,5 @@ From 00241c65a5c0b4bb32a847a6abb5a86d0c704a8f Mon Sep 17 00:00:00 2001 -From: no one +From: Javier Martinez Canillas Date: Tue, 5 Feb 2019 20:08:43 +0100 Subject: [PATCH] Fix GCC warnings about possible string truncations and buffer overflows @@ -10,7 +10,7 @@ leads to GCC complaining about possible string truncation and overflows. Fix this by using memcpy(), explicitly calculating the buffers lenghts and set a NUL byte terminator after copying the buffers. -Signed-off-by: no one +Signed-off-by: Javier Martinez Canillas --- grubby.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/0011-Fix-stringop-overflow-warning.patch b/0011-Fix-stringop-overflow-warning.patch new file mode 100644 index 0000000..0fc4734 --- /dev/null +++ b/0011-Fix-stringop-overflow-warning.patch @@ -0,0 +1,72 @@ +From ed5e255c023c9b78120d9ff2246d6516f652d4b7 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 10 Feb 2020 19:32:39 +0100 +Subject: [PATCH] Fix stringop-overflow warning + +GCC gives the following compile warning: + +grubby.c: In function 'main': +grubby.c:4508:27: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] + 4508 | saved_command_line[0] = '\0'; + | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~ +grubby.c:4503:26: note: at offset 0 to an object with size 0 allocated by 'malloc' here + 4503 | saved_command_line = malloc(i); + | ^~~~~~~~~ +cc1: all warnings being treated as errors +make: *** [Makefile:38: grubby.o] Error 1 + +Signed-off-by: Javier Martinez Canillas +--- + grubby.c | 35 +++++++++++++++++++---------------- + 1 file changed, 19 insertions(+), 16 deletions(-) + +diff --git a/grubby.c b/grubby.c +index 5ca689539cf..0c0f67a0ae5 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -4500,23 +4500,26 @@ int main(int argc, const char ** argv) { + int i = 0; + for (int j = 1; j < argc; j++) + i += strlen(argv[j]) + 1; +- saved_command_line = malloc(i); +- if (!saved_command_line) { +- fprintf(stderr, "grubby: %m\n"); +- exit(1); +- } +- saved_command_line[0] = '\0'; +- int cmdline_len = 0, arg_len; +- for (int j = 1; j < argc; j++) { +- arg_len = strlen(argv[j]); +- memcpy(saved_command_line + cmdline_len, argv[j], arg_len); +- cmdline_len += arg_len; +- if (j != argc - 1) { +- memcpy(saved_command_line + cmdline_len, " ", 1); +- cmdline_len++; +- } ++ ++ if (i > 0) { ++ saved_command_line = malloc(i); ++ if (!saved_command_line) { ++ fprintf(stderr, "grubby: %m\n"); ++ exit(1); ++ } ++ saved_command_line[0] = '\0'; ++ int cmdline_len = 0, arg_len; ++ for (int j = 1; j < argc; j++) { ++ arg_len = strlen(argv[j]); ++ memcpy(saved_command_line + cmdline_len, argv[j], arg_len); ++ cmdline_len += arg_len; ++ if (j != argc - 1) { ++ memcpy(saved_command_line + cmdline_len, " ", 1); ++ cmdline_len++; ++ } ++ } ++ saved_command_line[cmdline_len] = '\0'; + } +- saved_command_line[cmdline_len] = '\0'; + + optCon = poptGetContext("grubby", argc, argv, options, 0); + poptReadDefaultConfig(optCon, 1); +-- +2.24.1 + diff --git a/0012-Fix-maybe-uninitialized-warning.patch b/0012-Fix-maybe-uninitialized-warning.patch new file mode 100644 index 0000000..bcaa145 --- /dev/null +++ b/0012-Fix-maybe-uninitialized-warning.patch @@ -0,0 +1,35 @@ +From ee9f80190d4c458a09309fbd9a88d2756dc2d3fa Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 10 Feb 2020 20:13:13 +0100 +Subject: [PATCH] Fix maybe-uninitialized warning + +GCC gives the following compile warning: + +grubby.c: In function 'suseGrubConfGetBoot': +grubby.c:2770:5: error: 'grubDevice' may be used uninitialized in this function [-Werror=maybe-uninitialized] + 2770 | free(grubDevice); + | ^~~~~~~~~~~~~~~~ +cc1: all warnings being treated as errors +make: *** [Makefile:38: grubby.o] Error 1 + +Signed-off-by: Javier Martinez Canillas +--- + grubby.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grubby.c b/grubby.c +index 0c0f67a0ae5..779c25a2bf9 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -2755,7 +2755,7 @@ int grubGetBootFromDeviceMap(const char * device, + } + + int suseGrubConfGetBoot(const char * path, char ** bootPtr) { +- char * grubDevice; ++ char * grubDevice = NULL; + + if (suseGrubConfGetInstallDevice(path, &grubDevice)) + dbgPrintf("error looking for grub installation device\n"); +-- +2.24.1 + diff --git a/grubby.spec b/grubby.spec index 698f578..5011e98 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 39%{?dist} +Release: 40%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -24,6 +24,8 @@ Patch0007: 0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch Patch0008: 0008-Add-usr-libexec-rpm-sort.patch Patch0009: 0009-Improve-man-page-for-info-option.patch Patch0010: 0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch +Patch0011: 0011-Fix-stringop-overflow-warning.patch +Patch0012: 0012-Fix-maybe-uninitialized-warning.patch BuildRequires: gcc BuildRequires: pkgconfig glib2-devel popt-devel @@ -42,7 +44,7 @@ Requires: s390utils-base Requires: findutils Requires: util-linux -Obsoletes: %{name}-bls +Obsoletes: %{name}-bls < %{version}-%{release} %description This package provides a grubby compatibility script that manages @@ -131,6 +133,12 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Mon Feb 10 2020 Javier Martinez Canillas - 8.40-40 +- Fix FTBFS + Resolves: rhbz#1799496 +- Fix wrong S-o-B tag in patch +- Fix warning about using unversioned Obsoletes + * Wed Jan 29 2020 Fedora Release Engineering - 8.40-39 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From 8c7d86690790292be16d5eb0079a4564c828bd04 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 30 Mar 2020 10:54:20 +0200 Subject: [PATCH 08/18] Make grubby to also update GRUB_CMDLINE_LINUX in /etc/default/grub The grubby --update-kernel=ALL option is used to update the kernel command line parameters for all the boot entries. But the updated cmdline is lost if the grub2-mkconfig command is executed, since in that case the cmdline is changed with the value set by GRUB_CMDLINE_LINUX in /etc/default/grub. To prevent the cmdline set by users to be overridden by mistake, keep the value of GRUB_CMDLINE_LINUX in sync with the current cmdline. Related: rhbz#1287854 Signed-off-by: Javier Martinez Canillas --- grubby-bls | 11 ++++++++++- grubby.spec | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/grubby-bls b/grubby-bls index 2c6cb3d..01ba96b 100755 --- a/grubby-bls +++ b/grubby-bls @@ -492,7 +492,12 @@ update_bls_fragment() { fi if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then - local old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")" + local old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})" + opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" + opts=$(echo $opts | sed -e 's/\//\\\//g') + sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" + + old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")" opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" grub2-editenv "${env}" set kernelopts="${opts}" elif [[ $bootloader = grub2 ]]; then @@ -754,6 +759,10 @@ if [[ -z $grub_config ]]; then grub_config="/boot/grub2/grub.cfg" fi +if [[ -z $grub_etc_default ]]; then + grub_etc_default="/etc/default/grub" +fi + get_bls_values default_index="$(get_default_index)" diff --git a/grubby.spec b/grubby.spec index 5011e98..1141389 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 40%{?dist} +Release: 41%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -133,6 +133,10 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Mon Mar 30 2020 Javier Martinez Canillas - 8.40-41 +- Make grubby to also update GRUB_CMDLINE_LINUX in /etc/default/grub + Related: rhbz#1287854 + * Mon Feb 10 2020 Javier Martinez Canillas - 8.40-40 - Fix FTBFS Resolves: rhbz#1799496 From f57406f3ab1185ccb3fc16321ae2205ff7725f8c Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 29 Apr 2020 12:05:04 +0200 Subject: [PATCH 09/18] grubby-bls: fix corner case when a kernel param value contains a '=' If a kernel command line parameter has a '=' character, grubby fails to update the options field in the BLS snippet, for example: $ grubby --update-kernel=foo --args="bar=https://test?token=" sed: -e expression #1, char 30: unknown option to `s' Signed-off-by: Javier Martinez Canillas --- grubby-bls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grubby-bls b/grubby-bls index 01ba96b..01b99bf 100755 --- a/grubby-bls +++ b/grubby-bls @@ -460,7 +460,7 @@ update_args() { for arg in ${remove_args[*]}; do if [[ $arg = *"="* ]]; then - arg=$(echo $arg | sed -e 's/\//\\\//g') + arg="$(echo $arg | sed -e 's/\//\\\//g')" args="$(echo $args | sed -E "s/(^|[[:space:]])$arg([[:space:]]|$)/ /")" else args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")" @@ -468,7 +468,7 @@ update_args() { done for arg in ${add_args[*]}; do - arg=${arg%=*} + arg="${arg%%=*}" args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")" done From 303821d0140dc0728b5b7c44d20d6878aee82ea2 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 29 Apr 2020 14:41:47 +0200 Subject: [PATCH 10/18] grubby-bls: update man page to match options in current wrapper script The man page of the old grubby tool is still shipped in the grubby package but instead there should be a man page that only documents the options for the wrapper grubby script that is used to manage the BLS config snippets. Current man page is confusing for users so let's add one that contains the options that are supported by the wrapper script but no unsupported ones. Signed-off-by: Javier Martinez Canillas --- grubby.8 | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++ grubby.spec | 7 ++- 2 files changed, 175 insertions(+), 2 deletions(-) create mode 100644 grubby.8 diff --git a/grubby.8 b/grubby.8 new file mode 100644 index 0000000..143decd --- /dev/null +++ b/grubby.8 @@ -0,0 +1,170 @@ +.TH GRUBBY 8 "Wed Apr 29 2020" +.SH NAME +grubby \- command line tool for configuring grub and zipl + +.SH SYNOPSIS +\fBgrubby\fR [--add-kernel=\fIkernel-path\fR] [--args=\fIargs\fR] + [--bad-image-okay] [--config-file=\fIpath\fR] [--copy-default] + [--default-kernel] [--default-index] [--default-title] + [--env=\fIpath\fR] [--grub2] [--info=\fIkernel-path\fR] + [--initrd=\fIinitrd-path\fR] [--extra-initrd=\fIinitrd-path\fR] + [--make-default] [--remove-args=\fIargs\fR] + [--remove-kernel=\fIkernel-path\fR] [--set-default=\fIkernel-path\fR] + [--set-default-index=\fientry-index\fR] [--title=\fentry-title\fR] + [--update-kernel=\fIkernel-path\fR] [--zipl] [--bls-directory=\fIpath\fR] + +.SH DESCRIPTION +\fBgrubby\fR is a command line tool for updating and displaying information +about the configuration files for the \fBgrub2\fR and \fBzipl\fR boot loaders. +It is primarily designed to be used from scripts which install new kernels and +need to find information about the current boot environment. + +On BIOS-based Intel x86 platforms, \fBgrub2\fR is the default bootloader and +the configuration file is in \fB/boot/grub2/grub.cfg\fR. On UEFI-based Intel +x86 platforms, \fBgrub2\fR is the default bootloader, and the configuration +file is in \fB/boot/efi/EFI/redhat/grub.cfg\fR. On PowerPC platforms, systems +based on Power8 and Power9 support \fBgrub2\fR as a bootloader and use a +configuration stored in \fB/boot/grub2/grub.cfg\fR. On s390x platforms the +\fBzipl\fR bootloader use a default configuration in \fB/etc/zipl.conf\fR. + +All bootloaders define the boot entries as individual configuration fragments +that are stored by default in \fB/boot/loader/entries\fR. The format for the +config files is specified at \fBhttps://systemd.io/BOOT_LOADER_SPECIFICATION\fR. +The \fBgrubby\fR tool is used to update and display the configuration defined +in the BootLoaderSpec fragment files. + +There are a number of ways to specify the kernel used for \fB-\-info\fR, +\fB-\-remove-kernel\fR, and \fB-\-update-kernel\fR. Specificying \fBDEFAULT\fR +or \fBALL\fR selects the default entry and all of the entries, respectively. +Also, the title of a boot entry may be specified by using \fBTITLE=\fItitle\fR +as the argument; all entries with that title are used. + +.SH OPTIONS +.TP +\fB-\-add-kernel\fR=\fIkernel-path\fR +Add a new boot entry for the kernel located at \fIkernel-path\fR. + +.TP +\fB-\-args\fR=\fIkernel-args\fR +When a new kernel is added, this specifies the command line arguments +which should be passed to the kernel by default (note they are merged +with the arguments of the default entry if \fB-\-copy-default\fR is used). +When \fB-\-update-kernel\fR is used, this specifies new arguments to add +to the argument list. Multiple, space separated arguments may be used. If +an argument already exists the new value replaces the old values. The +\fBroot=\fR kernel argument gets special handling if the configuration +file has special handling for specifying the root filesystem. + +.TP +\fB-\-bad-image-okay\fR +When \fBgrubby\fR is looking for an entry to use for something (such +as a default boot entry) it uses sanity checks, such as ensuring that +the kernel exists in the filesystem, to make sure entries that obviously +won't work aren't selected. This option overrides that behavior, and is +designed primarily for testing. + +.TP +\fB-\-config-file\fR=\fIpath\fR +Use \fIpath\fR as the configuration file rather then the default. + +.TP +\fB-\-copy-default\fR +\fBgrubby\fR will copy as much information (such as kernel arguments and +root device) as possible from the current default kernel. The kernel path +and initrd path will never be copied. + +.TP +\fB-\-default-kernel\fR +Display the full path to the current default kernel and exit. + +.TP +\fB-\-default-index\fR +Display the numeric index of the current default boot entry and exit. + +.TP +\fB-\-default-title\fR +Display the title of the current default boot entry and exit. + +.TP +\fB-\-env\fR=\fIpath\fR +Use \fIpath\fR as the grub2 environment block file rather then the default path. + +.TP +\fB-\-grub2\fR +Configure \fBgrub2\fR bootloader. + +.TP +\fB-\-info\fR=\fIkernel-path\fR +Display information on all boot entries which match \fIkernel-path\fR. If +\fIkernel-path\fR is \fBDEFAULT\fR, then information on the default kernel +is displayed. If \fIkernel-path\fR is \fBALL\fR, then information on all boot +entries are displayed. + +.TP +\fB-\-initrd\fR=\fIinitrd-path\fR +Use \fIinitrd-path\fR as the path to an initial ram disk for a new kernel +being added. + +.TP +\fB-\-extrainitrd\fR=\fIinitrd-path\fR +Use \fIinitrd-path\fR as the path to an auxiliary init ram disk image to be +added to the boot entry. + +.TP +\fB-\-make-default\fR +Make the new kernel entry being added the default entry. + +.TP +\fB-\-remove-args\fR=\fIkernel-args\fR +The arguments specified by \fIkernel-args\fR are removed from the kernels +specified by \fB-\-update-kernel\fR. The \fBroot\fR argument gets special +handling for configuration files that support separate root filesystem +configuration. + +.TP +\fB-\-remove-kernel\fR=\fIkernel-path\fR +Removes all boot entries which match \fIkernel-path\fR. This may be used +along with -\-add-kernel, in which case the new kernel being added will +never be removed. + +.TP +\fB-\-set-default\fR=\fIkernel-path\fR +The first entry which boots the specified kernel is made the default +boot entry. + +.TP +\fB-\-set-default-index\fR=\fIentry-index\fR +Makes the given entry number the default boot entry. + +.TP +\fB-\-title\fR=\fIentry-title\fR +When a new kernel entry is added \fIentry-title\fR is used as the title +for the entry. + +.TP +\fB-\-update-kernel\fR=\fIkernel-path\fR +The entries for kernels matching \fRkernel-path\fR are updated. Currently +the only items that can be updated is the kernel argument list, which is +modified via the \fB-\-args\fR and \fB-\-remove-args\fR options. + +.TP +\fB-\-zipl\fR +Configure \fBzipl\fR bootloader. + +.TP +\fB-\-bls-directory\fR=\fIpath\fR +Use \fIpath\fR as the directory for the BootLoaderSpec config files rather +than the default \fB/boot/loader/entries\fR. + +.SH "SEE ALSO" +.BR zipl (8), +.BR mkinitrd (8), +.BR kernel-install (8) + +.SH AUTHORS +.nf +Erik Troan +Jeremy Katz +Peter Jones +Javier Martinez +.fi diff --git a/grubby.spec b/grubby.spec index 1141389..f4bfaed 100644 --- a/grubby.spec +++ b/grubby.spec @@ -14,6 +14,7 @@ Source2: grubby.in Source3: installkernel.in Source4: installkernel-bls Source5: 95-kernel-hooks.install +Source6: grubby.8 Patch0001: 0001-remove-the-old-crufty-u-boot-support.patch Patch0002: 0002-Change-return-type-in-getRootSpecifier.patch Patch0003: 0003-Add-btrfs-subvolume-support-for-grub2.patch @@ -78,13 +79,15 @@ make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} sbindir=%{_sbindir} libex mkdir -p %{buildroot}%{_libexecdir}/{grubby,installkernel}/ %{buildroot}%{_sbindir}/ mv -v %{buildroot}%{_sbindir}/grubby %{buildroot}%{_libexecdir}/grubby/grubby mv -v %{buildroot}%{_sbindir}/installkernel %{buildroot}%{_libexecdir}/installkernel/installkernel -cp -v %{SOURCE1} %{buildroot}%{_libexecdir}/grubby/ -cp -v %{SOURCE4} %{buildroot}%{_libexecdir}/installkernel/ +install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/grubby/ +install -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/installkernel/ sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \ > %{buildroot}%{_sbindir}/grubby sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \ > %{buildroot}%{_sbindir}/installkernel install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE5} +rm %{buildroot}%{_mandir}/man8/grubby.8* +install -m 0755 %{SOURCE6} %{buildroot}%{_mandir}/man8/ %post if [ "$1" = 2 ]; then From 670185c68251537e17c4976cd6a7f1baee025761 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 29 Apr 2020 18:33:46 +0200 Subject: [PATCH 11/18] Update man page to match current grubby script options and fix a bug Signed-off-by: Javier Martinez Canillas --- grubby.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grubby.spec b/grubby.spec index f4bfaed..a070b1a 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 41%{?dist} +Release: 42%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -136,6 +136,10 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Wed Apr 29 2020 Javier Martinez Canillas - 8.40-42 +- grubby-bls: fix corner case when a kernel param value contains a '=' +- grubby-bls: update man page to match options in current wrapper script + * Mon Mar 30 2020 Javier Martinez Canillas - 8.40-41 - Make grubby to also update GRUB_CMDLINE_LINUX in /etc/default/grub Related: rhbz#1287854 From 1621d288b6ddfc46533375e2254a4b0f3e2de7da Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 30 Apr 2020 23:07:06 +0200 Subject: [PATCH 12/18] grubby-bls: minor style cleanup Signed-off-by: Javier Martinez Canillas --- grubby-bls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grubby-bls b/grubby-bls index 01b99bf..de75da6 100755 --- a/grubby-bls +++ b/grubby-bls @@ -492,7 +492,7 @@ update_bls_fragment() { fi if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then - local old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})" + local old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})" opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" opts=$(echo $opts | sed -e 's/\//\\\//g') sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" From b1eee22db83cc6d9847c03ac07e5cf5da81c2071 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 4 May 2020 14:57:52 +0200 Subject: [PATCH 13/18] grubby-bls: always escape the delimiter character used in sed commands The forward slash character is used as the delimiter for sed substitutions so this is escaped before calling sed. But this was only done before removing parameters from the kernel command and not when adding it. Use it for all the cases when the parameters are replaced in the update_args() function. Signed-off-by: Javier Martinez Canillas --- grubby-bls | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grubby-bls b/grubby-bls index de75da6..68cea40 100755 --- a/grubby-bls +++ b/grubby-bls @@ -459,8 +459,8 @@ update_args() { local add_args=($1) && shift for arg in ${remove_args[*]}; do + arg="$(echo $arg | sed -e 's/\//\\\//g')" if [[ $arg = *"="* ]]; then - arg="$(echo $arg | sed -e 's/\//\\\//g')" args="$(echo $args | sed -E "s/(^|[[:space:]])$arg([[:space:]]|$)/ /")" else args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")" @@ -469,6 +469,7 @@ update_args() { for arg in ${add_args[*]}; do arg="${arg%%=*}" + arg="$(echo $arg | sed -e 's/\//\\\//g')" args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")" done From f24781c87b8226be5ec522f02a1833bda9504fe1 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 5 May 2020 11:40:57 +0200 Subject: [PATCH 14/18] grubby-bls: add a --no-etc-grub-update option The option makes grubby to not update the GRUB_CMDLINE_LINUX variable in the /etc/default/grub file when the --update-kernel=ALL option is used. Signed-off-by: Javier Martinez Canillas --- grubby-bls | 21 +++++++++++++++------ grubby.8 | 11 ++++++++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/grubby-bls b/grubby-bls index 68cea40..0306490 100755 --- a/grubby-bls +++ b/grubby-bls @@ -493,10 +493,14 @@ update_bls_fragment() { fi if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then - local old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})" - opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" - opts=$(echo $opts | sed -e 's/\//\\\//g') - sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" + local old_args="" + + if [[ -z $no_etc_update ]]; then + old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})" + opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" + opts=$(echo $opts | sed -e 's/\//\\\//g') + sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" + fi old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")" opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" @@ -609,6 +613,7 @@ Usage: grubby [OPTION...] --update-kernel=kernel-path updated information for the specified kernel --zipl configure zipl bootloader -b, --bls-directory path to directory containing the BootLoaderSpec fragment files + --no-etc-grub-update don't update the GRUB_CMDLINE_LINUX variable in /etc/default/grub Help options: -?, --help Show this help message @@ -620,7 +625,7 @@ OPTS="$(getopt -o c:i:b:? --long help,add-kernel:,args:,bad-image-okay,\ config-file:,copy-default,default-kernel,default-index,default-title,env:,\ grub2,info:,initrd:,extra-initrd:,make-default,remove-args:,\ remove-kernel:,set-default:,set-default-index:,title:,update-kernel:,zipl,\ -bls-directory:,add-kernel:,add-multiboot:,mbargs:,mounts:,boot-filesystem:,\ +bls-directory:,no-etc-grub-update,add-multiboot:,mbargs:,mounts:,boot-filesystem:,\ bootloader-probe,debug,devtree,devtreedir:,elilo,efi,extlinux,grub,lilo,\ output-file:,remove-mbargs:,remove-multiboot:,silo,yaboot -n ${SCRIPTNAME} -- "$@")" @@ -715,7 +720,11 @@ while [ ${#} -gt 0 ]; do blsdir="${2}" shift ;; - --add-kernel|--add-multiboot|--mbargs|--mounts|--boot-filesystem|\ + --no-etc-grub-update) + no_etc_update=true + shift + ;; + --add-multiboot|--mbargs|--mounts|--boot-filesystem|\ --bootloader-probe|--debug|--devtree|--devtreedir|--elilo|--efi|\ --extlinux|--grub|--lilo|--output-file|--remove-mbargs|--silo|\ --remove-multiboot|--slilo|--yaboot) diff --git a/grubby.8 b/grubby.8 index 143decd..9bcd247 100644 --- a/grubby.8 +++ b/grubby.8 @@ -145,7 +145,10 @@ for the entry. \fB-\-update-kernel\fR=\fIkernel-path\fR The entries for kernels matching \fRkernel-path\fR are updated. Currently the only items that can be updated is the kernel argument list, which is -modified via the \fB-\-args\fR and \fB-\-remove-args\fR options. +modified via the \fB-\-args\fR and \fB-\-remove-args\fR options. If the +\fBALL\fR argument is used the variable \fB GRUB_CMDLINE_LINUX\fR in +\fB/etc/default/grub\fR is updated with the latest kernel argument list, +unless the \fB-\-no-etc-grub-update\fR option is used. .TP \fB-\-zipl\fR @@ -156,6 +159,12 @@ Configure \fBzipl\fR bootloader. Use \fIpath\fR as the directory for the BootLoaderSpec config files rather than the default \fB/boot/loader/entries\fR. +.TP +\fB-\-no-etc-grub-update\fR +Makes grubby to not update the \fBGRUB_CMDLINE_LINUX\fR variable in +\fB/etc/default/grub\fR when the \fB-\-update-kernel\fR option is +used with the \fBALL\fR argument. + .SH "SEE ALSO" .BR zipl (8), .BR mkinitrd (8), From b2ab29059a43cf3433a374da12438edb0bc0866c Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 5 May 2020 12:22:37 +0200 Subject: [PATCH 15/18] grubby-bls: add a --no-etc-grub-update option and a fix for --args Signed-off-by: Javier Martinez Canillas --- grubby.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grubby.spec b/grubby.spec index a070b1a..c9751d4 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 42%{?dist} +Release: 43%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -136,6 +136,10 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Tue May 05 2020 Javier Martinez Canillas - 8.40-43 +- grubby-bls: always escape the delimiter character used in sed commands +- grubby-bls: add a --no-etc-grub-update option + * Wed Apr 29 2020 Javier Martinez Canillas - 8.40-42 - grubby-bls: fix corner case when a kernel param value contains a '=' - grubby-bls: update man page to match options in current wrapper script From 959c481fa9132f887d7896841772751ac45bf45d Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 6 May 2020 11:34:31 +0200 Subject: [PATCH 16/18] Fix installed man page file mode bits Signed-off-by: Javier Martinez Canillas --- grubby.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grubby.spec b/grubby.spec index c9751d4..4d9aedf 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 43%{?dist} +Release: 44%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -87,7 +87,7 @@ sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \ > %{buildroot}%{_sbindir}/installkernel install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE5} rm %{buildroot}%{_mandir}/man8/grubby.8* -install -m 0755 %{SOURCE6} %{buildroot}%{_mandir}/man8/ +install -m 0644 %{SOURCE6} %{buildroot}%{_mandir}/man8/ %post if [ "$1" = 2 ]; then @@ -136,6 +136,9 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Wed May 06 2020 Javier Martinez Canillas - 8.40-44 +- Fix installed man page file mode bits + * Tue May 05 2020 Javier Martinez Canillas - 8.40-43 - grubby-bls: always escape the delimiter character used in sed commands - grubby-bls: add a --no-etc-grub-update option From 770392fcd0cc5a587a244706b0788241f59cbcd5 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 7 May 2020 10:15:39 +0200 Subject: [PATCH 17/18] grubby-bls: only attempt to update cmdline if was already set Signed-off-by: Javier Martinez Canillas --- grubby-bls | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/grubby-bls b/grubby-bls index 0306490..5b428a0 100755 --- a/grubby-bls +++ b/grubby-bls @@ -495,16 +495,20 @@ update_bls_fragment() { if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then local old_args="" - if [[ -z $no_etc_update ]]; then + if [[ -z $no_etc_update ]] && [[ -e ${grub_etc_default} ]]; then old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})" - opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" - opts=$(echo $opts | sed -e 's/\//\\\//g') - sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" + if [[ -n $old_args ]]; then + opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" + opts="$(echo "$opts" | sed -e 's/\//\\\//g')" + sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" + fi fi old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")" - opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" - grub2-editenv "${env}" set kernelopts="${opts}" + if [[ -n $old_args ]]; then + opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" + grub2-editenv "${env}" set kernelopts="${opts}" + fi elif [[ $bootloader = grub2 ]]; then opts="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")" fi From 12e62c4f0a6b0582e9292f19ea7771efc09f9789 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 13 May 2020 18:44:59 +0200 Subject: [PATCH 18/18] grubby-bls: don't replace options with kernelopts if values are the same If the options field in a BLS file has the same value than the kernelopts variable in grubenv, the options is replaced with the kernelopts variable. This was done to keep the options in the BLS files in sync when possible, but having the kernel cmdline as a variable in the grubenv file was proven to be fragile. Instead, the kernel cmdline will be stored in the BLS files to make the configuration more robust. This will work even if the grubenv gets corrupted or is deleted. Since we want to get rid of the kernelopts variable, don't attempt to use that in the BLS snippets anymore. Signed-off-by: Javier Martinez Canillas --- grubby-bls | 4 ---- grubby.spec | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/grubby-bls b/grubby-bls index 5b428a0..74dbe5b 100755 --- a/grubby-bls +++ b/grubby-bls @@ -521,10 +521,6 @@ update_bls_fragment() { if [[ $param != "ALL" || "$(has_kernelopts "$i")" = "false" ]]; then set_bls_value "${bls_file[$i]}" "options" "${new_args}" fi - - if [[ $bootloader = grub2 && "$(has_kernelopts "$i")" = "false" && $opts = $new_args ]]; then - set_bls_value "${bls_file[$i]}" "options" "\$kernelopts" - fi fi if [[ -n $initrd ]]; then diff --git a/grubby.spec b/grubby.spec index 4d9aedf..bc3e307 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 44%{?dist} +Release: 45%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -136,6 +136,9 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Wed May 13 2020 Javier Martinez Canillas - 8.40-45 +- grubby-bls: don't replace options with kernelopts if values are the same + * Wed May 06 2020 Javier Martinez Canillas - 8.40-44 - Fix installed man page file mode bits