Blame SOURCES/0188-Warn-if-grub-password-will-not-be-read-1290803.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Robert Marshall <rmarshall@redhat.com>
f725e3
Date: Mon, 22 Feb 2016 15:30:05 -0500
f725e3
Subject: [PATCH] Warn if grub password will not be read (#1290803)
f725e3
f725e3
It is possible for a system to have never run grub-mkconfig and add the
f725e3
section that reads the user.cfg file which contains a user set GRUB
f725e3
password. Users in that scenario will now be warned that grub-mkconfig
f725e3
must be run prior to their newly set password taking effect.
f725e3
f725e3
Resolves: rhbz#1290803
f725e3
---
f725e3
 util/grub-setpassword.in | 5 +++++
f725e3
 1 file changed, 5 insertions(+)
f725e3
f725e3
diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in
f725e3
index dd76f00fc0e..fb9d3a3b6f9 100755
f725e3
--- a/util/grub-setpassword.in
f725e3
+++ b/util/grub-setpassword.in
f725e3
@@ -121,3 +121,8 @@ fi
f725e3
 install -m 0600 /dev/null "${grubdir}/user.cfg" 2>/dev/null || :
f725e3
 chmod 0600 "${grubdir}/user.cfg" 2>/dev/null || :
f725e3
 echo "GRUB2_PASSWORD=${MYPASS}" > "${grubdir}/user.cfg"
f725e3
+
f725e3
+if ! grep -q "^### BEGIN /etc/grub.d/01_users ###$" "${grubdir}/grub.cfg"; then
f725e3
+    echo "WARNING: The current configuration lacks password support!"
f725e3
+    echo "Update your configuration with @grub_mkconfig@ to support this feature."
f725e3
+fi