>From 487a864b4275644c5f8a32a2978ffe8264ae9a71 Mon Sep 17 00:00:00 2001 From: Anton Midyukov Date: Sun, 5 Jan 2020 20:00:50 +0700 Subject: [PATCH 04/20] grub: do not create grub.cfg if EFI_BOOTLOADER is set to not equal grub-efi --- .../grub/scripts.d/20-propagator-ramdisk | 2 ++ .../grub/scripts.d/20-propagator-rescue-hash | 2 ++ features.in/grub/stage1/scripts.d/01-grub | 20 ++++++++++++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/features.in/grub/scripts.d/20-propagator-ramdisk b/features.in/grub/scripts.d/20-propagator-ramdisk index a01b8f3127..059c60ef76 100755 --- a/features.in/grub/scripts.d/20-propagator-ramdisk +++ b/features.in/grub/scripts.d/20-propagator-ramdisk @@ -5,6 +5,8 @@ cd "$WORKDIR" +[ -d boot/grub ] || exit 0 + cfgs="$(find boot/grub -name '*.cfg')" [ -n "$cfgs" ] || { echo "${0##*/}: did not find any config under boot/grub " >&2 diff --git a/features.in/grub/scripts.d/20-propagator-rescue-hash b/features.in/grub/scripts.d/20-propagator-rescue-hash index 7a13499693..92c5972a65 100755 --- a/features.in/grub/scripts.d/20-propagator-rescue-hash +++ b/features.in/grub/scripts.d/20-propagator-rescue-hash @@ -5,6 +5,8 @@ cd "$WORKDIR" +[ -d boot/grub ] || exit 0 + grep -qs "@rescue_hash@" boot/grub/*.cfg || exit 0 find -maxdepth 1 -type f -name rescue \ diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub index 4d2a7ac007..4c7d5e23ee 100755 --- a/features.in/grub/stage1/scripts.d/01-grub +++ b/features.in/grub/stage1/scripts.d/01-grub @@ -4,16 +4,22 @@ CFG="grub.cfg" +if [ -n "$GLOBAL_EFI_BOOTLOADER" -a ! "$GLOBAL_EFI_BOOTLOADER" = "grub-efi" ]; then + rm -fr "$WORKDIR/boot" + exit 0 +fi + +if [ -z "$GLOBAL_EFI_BOOTLOADER" ]; then + case "$GLOBAL_BOOTLOADER" in + ieee1275boot|grubaa64boot|grubx86boot) ;; + *) rm -fr "$WORKDIR/boot" + exit 0;; + esac +fi + mkdir -p "$WORKDIR/boot/grub" cd "$WORKDIR/boot/grub" -# validate just in case (see also stage1 Makefile) -case "$GLOBAL_BOOTLOADER" in - isolinux|syslinux|ieee1275boot|grubaa64boot|grubx86boot) ;; - *) echo "error: weird GLOBAL_BOOTLOADER: \`$GLOBAL_BOOTLOADER'" >&2; - exit 1;; -esac - # copy extra files, if any GRUB_FILES="$(cat .in/grub.list)" if [ -n "${GRUB_FILES% }" ]; then -- 2.24.1