Don't overwrite vars that start with GRUB_CMDLINE_LINUX

When updating args for ALL kernels, grubby clobbers all variables
in /etc/default/grub that start with GRUB_CMDLINE_LINUX and renders
that line multiple times, for each variable that exists. This breaks
using recovery mode. Fix so this doesn't happen anymore.

Signed-off-by: Marta Lewandowska <mlewando@redhat.com>
This commit is contained in:
Marta Lewandowska 2024-01-10 16:40:47 +02:00 committed by Nicolas Frayer
parent a73ecd5815
commit 893f94f428
2 changed files with 5 additions and 2 deletions

View File

@ -500,7 +500,7 @@ update_bls_fragment() {
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}"
sed -i -e "s/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}"
fi
fi

View File

@ -3,7 +3,7 @@
Name: grubby
Version: 8.40
Release: 72%{?dist}
Release: 73%{?dist}
Summary: Command line tool for updating bootloader configs
License: GPL-2.0-or-later
Source1: grubby-bls
@ -74,6 +74,9 @@ fi
%{_mandir}/man8/grubby.8*
%changelog
* Wed Jan 10 2024 Marta Lewandowska <mlewando@redhat.com> - 8.40-73
- Do not overwrite all vars that start with GRUB_CMDLINE_LINUX
* Mon Sep 11 2023 Zbigniew Jedrzejewski-Szmek <zbyszek@in.waw.pl> - 8.40-72
- Drop installkernel so that it can be provided by systemd