Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Wed, 21 Nov 2018 15:37:32 +0100
Subject: [PATCH] Remove quotes when reading ID value from /etc/os-release

The field is used to obtain the path to the GRUB directory in the ESP for
UEFI installs. But in some OS the ID value is quoted, which leads to some
of the scripts to fail:

  $ grub2-setpassword
  /boot/efi/EFI/"redhat"/ does not exist.
  Usage: /usr/sbin/grub2-setpassword [OPTION]

Related: rhbz#1650706

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
 util/grub-set-password.in     | 2 +-
 util/grub-switch-to-blscfg.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/util/grub-set-password.in b/util/grub-set-password.in
index 5ebf50576..c0b5ebbfd 100644
--- a/util/grub-set-password.in
+++ b/util/grub-set-password.in
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')
+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
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
index 60cd6ca63..d353370cc 100644
--- a/util/grub-switch-to-blscfg.in
+++ b/util/grub-switch-to-blscfg.in
@@ -40,7 +40,7 @@ etcdefaultgrub=/etc/default/grub
 
 eval "$("${grub_get_kernel_settings}")" || true
 
-EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')
+EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g')
 if [ -d /sys/firmware/efi/efivars/ ]; then
     startlink=/etc/grub2-efi.cfg
     grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'`