dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0191-Fix-grub-setpassword-o-s-output-path.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Andy Lutomirski <luto@kernel.org>
8631a2
Date: Sun, 11 Jun 2017 19:17:40 -0400
8631a2
Subject: [PATCH] Fix grub-setpassword -o's output path
8631a2
8631a2
The output path is set up in the command line parsing, but completely ignored
8631a2
in the code that actually writes the files.  This patch fixes that.
8631a2
8631a2
Signed-off-by: Peter Jones <pjones@redhat.com>
8631a2
---
8631a2
 util/grub-setpassword.in | 8 ++++----
8631a2
 1 file changed, 4 insertions(+), 4 deletions(-)
8631a2
8631a2
diff --git a/util/grub-setpassword.in b/util/grub-setpassword.in
8631a2
index cf70257eed6..5ebf50576d6 100644
8631a2
--- a/util/grub-setpassword.in
8631a2
+++ b/util/grub-setpassword.in
8631a2
@@ -118,11 +118,11 @@ fi
8631a2
 
8631a2
 # on the ESP, these will fail to set the permissions, but it's okay because
8631a2
 # the directory is protected.
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
+install -m 0600 /dev/null "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
8631a2
+chmod 0600 "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
8631a2
+echo "GRUB2_PASSWORD=${MYPASS}" > "${OUTPUT_PATH}/user.cfg"
8631a2
 
8631a2
-if ! grep -q "^### BEGIN /etc/grub.d/01_users ###$" "${grubdir}/grub.cfg"; then
8631a2
+if ! grep -q "^### BEGIN /etc/grub.d/01_users ###$" "${OUTPUT_PATH}/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