From 85a5e81224f5832eca9ab0cbb77897abc25c6095 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 21 Nov 2023 11:53:50 +0200 Subject: [PATCH] BuildSystem: Check value of BANAN_UEFI_BOOT with `if ((...)); then` --- script/image-create.sh | 7 +++---- script/qemu.sh | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/script/image-create.sh b/script/image-create.sh index e3b002eae..9daf52a5a 100755 --- a/script/image-create.sh +++ b/script/image-create.sh @@ -41,7 +41,7 @@ MOUNT_DIR="${MOUNT_DIR:-$BANAN_BUILD_DIR/bananmnt}" truncate -s 0 "$BANAN_DISK_IMAGE_PATH" truncate -s $DISK_SIZE "$BANAN_DISK_IMAGE_PATH" -if [ "$BANAN_UEFI_BOOT" == "1" ]; then +if (($BANAN_UEFI_BOOT)); then sed -e 's/\s*\([-\+[:alnum:]]*\).*/\1/' << EOF | fdisk "$BANAN_DISK_IMAGE_PATH" > /dev/null g # gpt n # new partition @@ -92,7 +92,7 @@ sudo mkfs.ext2 -b 1024 -q $PARTITION2 sudo mkdir -p $MOUNT_DIR || { echo "Failed to create banan mount dir."; exit 1; } if [[ "$BANAN_BOOTLOADER" == "GRUB" ]]; then - if [[ "$BANAN_UEFI_BOOT" == "1" ]]; then + if (($BANAN_UEFI_BOOT)); then sudo mkfs.fat $PARTITION1 > /dev/null sudo mount $PARTITION1 "$MOUNT_DIR" sudo mkdir -p "$MOUNT_DIR/EFI/BOOT" @@ -119,7 +119,7 @@ sudo rm -rf $MOUNT_DIR || { echo "Failed to remove banan mount dir."; exit 1; } if [[ "$BANAN_BOOTLOADER" == "GRUB" ]]; then echo > /dev/null elif [[ "$BANAN_BOOTLOADER" == "BANAN" ]]; then - if [[ "$BANAN_UEFI_BOOT" == "1" ]]; then + if (($BANAN_UEFI_BOOT)); then echo "banan bootloader does not support UEFI" >&2 exit 1 fi @@ -128,4 +128,3 @@ else echo "unrecognized bootloader $BANAN_BOOTLOADER" >&2 exit 1 fi - diff --git a/script/qemu.sh b/script/qemu.sh index c472abf85..8683dbcd5 100755 --- a/script/qemu.sh +++ b/script/qemu.sh @@ -9,7 +9,7 @@ if [[ -z $OVMF_PATH ]]; then OVMF_PATH="/usr/share/ovmf/x64/OVMF.fd" fi -if [[ "$BANAN_UEFI_BOOT" == "1" ]]; then +if (($BANAN_UEFI_BOOT)); then BIOS_ARGS="-bios $OVMF_PATH -net none" fi