2023-06-02 18:40:24 +03:00
|
|
|
#!/bin/bash
|
2023-04-02 04:07:27 +03:00
|
|
|
|
|
|
|
if [ ! -f $DISK_IMAGE_PATH ]; then
|
|
|
|
$(dirname "$0")/image-full.sh
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2023-10-16 01:37:57 +03:00
|
|
|
fdisk -l $DISK_IMAGE_PATH | grep -q 'EFI System'; IMAGE_IS_UEFI=$?
|
|
|
|
[[ $UEFI_BOOT == 1 ]]; CREATE_IS_UEFI=$?
|
|
|
|
|
|
|
|
if [ $IMAGE_IS_UEFI -ne $CREATE_IS_UEFI ]; then
|
|
|
|
echo Converting disk image to/from UEFI
|
|
|
|
$(dirname "$0")/image-full.sh
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2023-04-02 04:07:27 +03:00
|
|
|
MOUNT_DIR=/mnt
|
|
|
|
|
|
|
|
LOOP_DEV=$(sudo losetup -f --show $DISK_IMAGE_PATH)
|
|
|
|
sudo partprobe $LOOP_DEV
|
|
|
|
|
|
|
|
ROOT_PARTITON=${LOOP_DEV}p2
|
|
|
|
|
|
|
|
sudo mount $ROOT_PARTITON $MOUNT_DIR
|
|
|
|
|
2023-09-08 02:41:39 +03:00
|
|
|
sudo rsync -a ${SYSROOT}/* ${MOUNT_DIR}/
|
2023-04-02 04:07:27 +03:00
|
|
|
|
|
|
|
sudo umount $MOUNT_DIR
|
|
|
|
|
|
|
|
sudo losetup -d $LOOP_DEV
|