nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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