nalika / rpms / grub2

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