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