From 0b48d7432229603828349e8692fc79bcaa848d67 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 21 Feb 2022 13:41:47 +1100 Subject: [PATCH] bootloader: fix arm64 install path This fixes a regression introduced by Ia99687815667c3cf5e82cf21d841d3b1008b8fa9 It turns out that [[ -d /usr/lib/grub/*-efi ]] is not a good check, because [[ doesn't split that and try to glob match ( [ would ). This has resulted in us triggering this path on ARM64. This is an x86-64 only check, because on other platforms we either don't support EFI or are EFI only. Restrict this check to get arm64 working again. Change-Id: I6a75f8504826bcb0ac122d53dfb9faff975077f4 --- .../elements/bootloader/finalise.d/50-bootloader | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 630606ce..3876e9a8 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -94,10 +94,13 @@ GRUB_OPTS="--force " # * --target tells grub what's the target platform # * the boot images are placed in /usr/lib/grub/- # * i386-pc is used for BIOS-based machines -# http://www.gnu.org/software/grub/manual/grub.html#Installation -# -if [[ -d /sys/firmware/efi && ! -d /usr/lib/grub/*-efi ]]; then - GRUB_OPTS="$GRUB_OPTS --target=i386-pc" +# http://www.gnu.org/software/grub/manual/grub.html#Installation +# * this check is only valid for x86_64; other platforms we support +# are either not EFI (ppc) or always EFI (arm64) +if [[ "x86_64 amd64" =~ ${ARCH} ]]; then + if [[ -d /sys/firmware/efi && ! -d /usr/lib/grub/x86_64-efi ]]; then + GRUB_OPTS="$GRUB_OPTS --target=i386-pc" + fi fi if [[ "$ARCH" =~ "ppc" ]] ; then