dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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