Fix duplicated args and cope with /etc/default/grub modification

Signed-off-by: Robbie Harwood <rharwood@redhat.com>
This commit is contained in:
Robbie Harwood 2022-08-17 15:03:25 +00:00
parent 2f39adbb14
commit fc76aed533
4 changed files with 44 additions and 1 deletions

View file

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Wed, 17 Aug 2022 10:26:07 -0400
Subject: [PATCH] squish: don't dup rhgb quiet, check mtimes
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
util/grub.d/10_linux.in | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 950a92f5e8..03f091a4dc 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -161,10 +161,16 @@ update_bls_cmdline()
local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
local -a files=($(get_sorted_bls))
- if [[ ! -f /etc/kernel/cmdline ]]; then
- # anaconda has the correct information to do this during install;
- # afterward, grubby will take care of syncing on updates.
- echo "$cmdline rhgb quiet" > /etc/kernel/cmdline
+ if [[ ! -f /etc/kernel/cmdline ]] ||
+ [[ /etc/kernel/cmdline -ot /etc/default/grub ]]; then
+ # anaconda has the correct information to create this during install;
+ # afterward, grubby will take care of syncing on updates. If the user
+ # has modified /etc/default/grub, try to cope.
+ if [[ ! "$cmdline" =~ "rhgb quiet" ]]; then
+ # ensure these only show up once
+ cmdline="$cmdline rhgb quiet"
+ fi
+ echo "$cmdline" > /etc/kernel/cmdline
fi
for bls in "${files[@]}"; do

View file

@ -87,6 +87,10 @@ case "$COMMAND" in
if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then
if [[ -f /etc/kernel/cmdline ]]; then if [[ -f /etc/kernel/cmdline ]]; then
if [[ /etc/kernel/cmdline -ot /etc/default/grub ]]; then
# user modified /etc/default/grub manually; sync
grub2-mkconfig -o /etc/grub2.cfg
fi
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline

View file

@ -275,3 +275,4 @@ Patch0274: 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch
Patch0275: 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch Patch0275: 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch
Patch0276: 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch Patch0276: 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch
Patch0277: 0277-Try-reserving-less-ram.patch Patch0277: 0277-Try-reserving-less-ram.patch
Patch0278: 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch

View file

@ -17,7 +17,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.06 Version: 2.06
Release: 49%{?dist} Release: 50%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/grub/ URL: http://www.gnu.org/software/grub/
@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
%endif %endif
%changelog %changelog
* Wed Aug 17 2022 Robbie Harwood <rharwood@redhat.com> - 2.06-50
- Fix duplicated args and cope with /etc/default/grub modification
* Mon Aug 15 2022 Robbie Harwood <rharwood@redhat.com> - 2.06-49 * Mon Aug 15 2022 Robbie Harwood <rharwood@redhat.com> - 2.06-49
- Skip rpm mtime verification on likely-vfat filesystems - Skip rpm mtime verification on likely-vfat filesystems