nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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