From 2b59d1355d3c81a9a8b0f561e4368071823bddea Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Jun 09 2021 21:40:23 +0000 Subject: grubby-bls: expand only the kernelopts variable The BLS snippets have the options field set to a kernelopts variable by default, which is set in GRUB's environemnt block to the kernel cmdline. When the kernel command line parameters are modified for all the entries, the value of this kernelopts variable is modified. But if the cmdline is modified for a single entry, then the kernelopts variable is expanded and the resulted modified value stored in the BLS snippet. The grubby tool expanded all the variables in the options field, but it's possible that some of these variables are managed by another tool. For example the tuned program adds a tuned variable that shouldn't be changed by the grubby tool. Otherwise it will mangle the tuned configuration set. To prevent this, let's make grubby to only expand the kernelopts variable. Signed-off-by: Javier Martinez Canillas --- diff --git a/grubby-bls b/grubby-bls index aa1f3a2..97bb14c 100755 --- a/grubby-bls +++ b/grubby-bls @@ -235,7 +235,7 @@ get_bls_args() { local opts=(${args}) for opt in ${opts[*]}; do - if [[ $opt =~ ^\$ ]]; then + if [[ $opt = "\$kernelopts" ]]; then value="$(expand_var $opt)" args="$(echo ${args} | sed -e "s/${opt}/${value}/")" fi diff --git a/grubby.spec b/grubby.spec index 4f22e97..713aa0a 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 52%{?dist} +Release: 53%{?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 Jun 09 2021 Javier Martinez Canillas - 8.40-53 +- grubby-bls: expand only the kernelopts variable + * Mon Apr 26 2021 Javier Martinez Canillas - 8.40-52 - grubby-bs: Fix changing kernel cmdline params not working on ppc64le