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