From a7b1810aa26442e4f60d6dfd3ab879fb1ddaf928 Mon Sep 17 00:00:00 2001 From: Sinipelto Date: Mon, 20 Nov 2023 13:24:15 +0200 Subject: [PATCH] Update script/image.sh handle custom mount dir Signed-off-by: Sinipelto --- script/image.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script/image.sh b/script/image.sh index 9b7760ee..404a0a0f 100755 --- a/script/image.sh +++ b/script/image.sh @@ -18,7 +18,9 @@ LOOP_DEV=$(sudo losetup --show -f "$BANAN_DISK_IMAGE_PATH") sudo partprobe $LOOP_DEV ROOT_PARTITION=${LOOP_DEV}p2 -MOUNT_DIR=/mnt +MOUNT_DIR=/bananmnt + +sudo mkdir -p $MOUNT_DIR || { echo "Failed to create mount point dir."; exit 1; } sudo mount $ROOT_PARTITION $MOUNT_DIR @@ -26,6 +28,8 @@ cd $MOUNT_DIR sudo tar xf $BANAN_SYSROOT_TAR cd -sudo umount $MOUNT_DIR +sudo umount $MOUNT_DIR || { echo "Failed to unmount banan mount."; exit 1; } -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