nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch

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