Update script/image.sh

handle custom mount dir

Signed-off-by: Sinipelto <sinipelto@noreply.bananymous.com>
This commit is contained in:
Sinipelto 2023-11-20 13:24:15 +02:00
parent a6a5c00763
commit a7b1810aa2
1 changed files with 7 additions and 3 deletions

View File

@ -18,7 +18,9 @@ LOOP_DEV=$(sudo losetup --show -f "$BANAN_DISK_IMAGE_PATH")
sudo partprobe $LOOP_DEV sudo partprobe $LOOP_DEV
ROOT_PARTITION=${LOOP_DEV}p2 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 sudo mount $ROOT_PARTITION $MOUNT_DIR
@ -26,6 +28,8 @@ cd $MOUNT_DIR
sudo tar xf $BANAN_SYSROOT_TAR sudo tar xf $BANAN_SYSROOT_TAR
cd 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