grub2/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch
Robbie Harwood e622855aa2 Attempt to fix version display
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2022-04-18 21:58:58 +00:00

42 lines
1.5 KiB
Diff

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