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