nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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