From 566724d986856b83a5b8e3a9b26dfeb7459f5509 Mon Sep 17 00:00:00 2001 From: Sinipelto Date: Mon, 20 Nov 2023 13:28:10 +0200 Subject: [PATCH] Update script/image-create.sh custom mount dir Signed-off-by: Sinipelto --- script/image-create.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/script/image-create.sh b/script/image-create.sh index 246df4ca..e617d904 100755 --- a/script/image-create.sh +++ b/script/image-create.sh @@ -26,7 +26,7 @@ if [[ -z $BANAN_ARCH ]]; then fi DISK_SIZE=$[50 * 1024 * 1024] -MOUNT_DIR=/mnt +MOUNT_DIR="${MOUNT_DIR:-/bananmnt}" truncate -s 0 "$BANAN_DISK_IMAGE_PATH" truncate -s $DISK_SIZE "$BANAN_DISK_IMAGE_PATH" @@ -79,6 +79,8 @@ PARTITION2=${LOOP_DEV}p2 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 sudo mkfs.fat $PARTITION1 > /dev/null @@ -100,7 +102,9 @@ if [[ "$BANAN_BOOTLOADER" == "GRUB" ]]; then fi fi -sudo losetup -d $LOOP_DEV +sudo losetup -d $LOOP_DEV || { echo "Failed to remove loop device for banan mount."; exit 1; } + +sudo rm -rf $MOUNT_DIR || { echo "Failed to remove banan mount dir."; exit 1; } if [[ "$BANAN_BOOTLOADER" == "GRUB" ]]; then echo > /dev/null