fwupd/uefi-capsule-Do-not-call-grub2-probe-without-argumen.patch
Dominique Leuenberger af8eba5de5 Accepting request 1059434 from home:michals
- Fix error generating grub.cfg when an update is available.
  + uefi-capsule-Do-not-call-grub2-probe-without-argumen.patch

OBS-URL: https://build.opensuse.org/request/show/1059434
OBS-URL: https://build.opensuse.org/package/show/Base:System/fwupd?expand=0&rev=133
2023-01-19 08:02:18 +00:00

44 lines
1.7 KiB
Diff

From 9065f50057cb0e9a1609e44882740ba70d98c2a6 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Wed, 18 Jan 2023 16:07:05 +0100
Subject: [PATCH] uefi-capsule: Do not call grub2-probe without arguments
commit 684bc0381 ("trivial: fix various shellcheck warnings") adds call
to ${grub_probe} without any argument which causes grub2-probe to return
an error, and generating grub configuration fails.
Add --version argument to avoid the error, and redierct the output to
/dev/null so that it's not included in the grub configuration file.
The commit also adds superfluous single quotes causing another error:
/usr/sbin/grub2-probe: error: cannot find a GRUB drive for `${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/". Check your device.map.
Fix the quoting to work at least for single device.
Fixes: #5424
Fixes: 684bc0381 ("trivial: fix various shellcheck warnings")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
plugins/uefi-capsule/fwupd.grub.conf.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/uefi-capsule/fwupd.grub.conf.in b/plugins/uefi-capsule/fwupd.grub.conf.in
index 9c3a22f23..6d17fc3cc 100755
--- a/plugins/uefi-capsule/fwupd.grub.conf.in
+++ b/plugins/uefi-capsule/fwupd.grub.conf.in
@@ -14,8 +14,8 @@ if [ -f @localstatedir@/lib/fwupd/uefi_capsule.conf ] &&
cat << EOF
menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {
EOF
- ${grub_probe:?}
- prepare_grub_to_access_device '`${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/"'
+ ${grub_probe:?} --version > /dev/null
+ prepare_grub_to_access_device "$(${grub_probe} --target=device ${ESP})" | sed -e "s/^/\t/"
cat << EOF
chainloader ${EFI_PATH}
}
--
2.39.0