2023-10-23 13:27:23 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [[ -z $BANAN_DISK_IMAGE_PATH ]]; then
|
|
|
|
echo "You must set the BANAN_DISK_IMAGE_PATH environment variable" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-11-04 17:50:43 +02:00
|
|
|
if [[ -z $BANAN_SYSROOT_TAR ]]; then
|
|
|
|
echo "You must set the BANAN_SYSROOT_TAR environment variable" >&2
|
2023-10-23 13:27:23 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-11-04 17:50:43 +02:00
|
|
|
if [[ "$1" == "full" ]] || [[ ! -f $BANAN_DISK_IMAGE_PATH ]]; then
|
|
|
|
$BANAN_SCRIPT_DIR/image-create.sh
|
2023-10-23 13:27:23 +03:00
|
|
|
fi
|
|
|
|
|
2023-11-04 17:50:43 +02:00
|
|
|
LOOP_DEV=$(sudo losetup --show -f "$BANAN_DISK_IMAGE_PATH")
|
2023-10-23 13:27:23 +03:00
|
|
|
sudo partprobe $LOOP_DEV
|
|
|
|
|
2023-11-04 17:50:43 +02:00
|
|
|
ROOT_PARTITION=${LOOP_DEV}p2
|
|
|
|
MOUNT_DIR=/mnt
|
2023-10-23 13:27:23 +03:00
|
|
|
|
2023-11-04 17:50:43 +02:00
|
|
|
sudo mount $ROOT_PARTITION $MOUNT_DIR
|
2023-10-23 13:27:23 +03:00
|
|
|
|
2023-11-04 17:50:43 +02:00
|
|
|
cd $MOUNT_DIR
|
|
|
|
sudo tar xf $BANAN_SYSROOT_TAR
|
|
|
|
cd
|
2023-10-23 13:27:23 +03:00
|
|
|
|
|
|
|
sudo umount $MOUNT_DIR
|
|
|
|
|
|
|
|
sudo losetup -d $LOOP_DEV
|