From 6dbb8d2598980154809345f3179a5529490d04ce Mon Sep 17 00:00:00 2001 From: Arnaud Rebillout Date: Mon, 18 Sep 2023 08:39:38 +0700 Subject: [PATCH] efi-image: Fix /grub.cfg, variables must NOT be expanded The test 'if [ x$grub_platform == xefi -a x$lockdown != xy ]' is meant to be done by GRUB at runtime, so this line should appear verbatim in the grub.cfg file. However the variables are expanded at build-time by the script, because the dollar symbol is not escaped. Here's the result on a 12.1.0 live image: $ cat <>/boot/grub/x86_64-efi/grub.cfg if [ x == xefi -a x != xy ] ; then insmod part_acorn insmod part_amiga insmod part_apple insmod part_bsd insmod part_dfly insmod part_dvh insmod part_gpt insmod part_msdos insmod part_plan insmod part_sun insmod part_sunpc fi source /boot/grub/grub.cfg Note that this mistake would have been caught if only the nounset option had been used (ie. 'set -u'). Fixes commit: 7b36f5b0ad751081f6316dcb0498df307a2ec902 --- scripts/build/efi-image | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/efi-image b/scripts/build/efi-image index 0833f5793..17e4e1de9 100755 --- a/scripts/build/efi-image +++ b/scripts/build/efi-image @@ -64,7 +64,7 @@ for i in /usr/lib/grub/$platform/part_*.mod; do done mkdir -p "$outdir/boot/grub/$platform" cat >"$outdir/boot/grub/$platform/grub.cfg" <