67f07b7
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
67f07b7
From: Javier Martinez Canillas <javierm@redhat.com>
67f07b7
Date: Mon, 5 Jul 2021 18:24:22 +0200
67f07b7
Subject: [PATCH] grub-set-password: Always use /boot/grub2/user.cfg as
67f07b7
 password default
67f07b7
67f07b7
The GRUB configuration file is always placed in /boot/grub2/ now, even for
67f07b7
EFI. But the tool is still creating the user.cfg in the ESP and not there.
67f07b7
67f07b7
Resolves: rhbz#1955294
67f07b7
67f07b7
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
67f07b7
---
67f07b7
 util/grub-set-password.in | 9 +--------
67f07b7
 1 file changed, 1 insertion(+), 8 deletions(-)
67f07b7
67f07b7
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
e622855
index c0b5ebbfdc..d8005e5a14 100644
67f07b7
--- a/util/grub-set-password.in
67f07b7
+++ b/util/grub-set-password.in
67f07b7
@@ -1,11 +1,6 @@
67f07b7
 #!/bin/sh -e
67f07b7
 
67f07b7
-EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g')
67f07b7
-if [ -d /sys/firmware/efi/efivars/ ]; then
67f07b7
-    grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'`
67f07b7
-else
67f07b7
-    grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
67f07b7
-fi
67f07b7
+grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
67f07b7
 
67f07b7
 PACKAGE_VERSION="@PACKAGE_VERSION@"
67f07b7
 PACKAGE_NAME="@PACKAGE_NAME@"
67f07b7
@@ -116,8 +111,6 @@ if [ -z "${MYPASS}" ]; then
67f07b7
       exit 1
67f07b7
 fi
67f07b7
 
67f07b7
-# on the ESP, these will fail to set the permissions, but it's okay because
67f07b7
-# the directory is protected.
67f07b7
 install -m 0600 /dev/null "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
67f07b7
 chmod 0600 "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
67f07b7
 echo "GRUB2_PASSWORD=${MYPASS}" > "${OUTPUT_PATH}/user.cfg"