forked from Bananymous/banan-os
update main 21.11.23 #2
|
@ -25,8 +25,18 @@ if [[ -z $BANAN_ARCH ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $BANAN_UEFI_BOOT ]]; then
|
||||
echo "You must set the BANAN_UEFI_BOOT environment variable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $BANAN_BUILD_DIR ]]; then
|
||||
echo "You must set the BANAN_BUILD_DIR environment variable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DISK_SIZE=$[50 * 1024 * 1024]
|
||||
MOUNT_DIR=/mnt
|
||||
MOUNT_DIR="${MOUNT_DIR:-$BANAN_BUILD_DIR/bananmnt}"
|
||||
|
||||
truncate -s 0 "$BANAN_DISK_IMAGE_PATH"
|
||||
truncate -s $DISK_SIZE "$BANAN_DISK_IMAGE_PATH"
|
||||
|
@ -79,6 +89,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 +112,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
|
||||
|
|
|
@ -10,15 +10,22 @@ if [[ -z $BANAN_SYSROOT_TAR ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $BANAN_BUILD_DIR ]]; then
|
||||
echo "You must set the BANAN_BUILD_DIR environment variable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$1" == "full" ]] || [[ ! -f $BANAN_DISK_IMAGE_PATH ]]; then
|
||||
$BANAN_SCRIPT_DIR/image-create.sh
|
||||
fi
|
||||
|
||||
LOOP_DEV=$(sudo losetup --show -f "$BANAN_DISK_IMAGE_PATH")
|
||||
LOOP_DEV="$(sudo losetup --show -f $BANAN_DISK_IMAGE_PATH)"
|
||||
sudo partprobe $LOOP_DEV
|
||||
|
||||
ROOT_PARTITION=${LOOP_DEV}p2
|
||||
MOUNT_DIR=/mnt
|
||||
ROOT_PARTITION="${LOOP_DEV}p2"
|
||||
MOUNT_DIR="${MOUNT_DIR:-$BANAN_BUILD_DIR/bananmnt}"
|
||||
|
||||
sudo mkdir -p $MOUNT_DIR || { echo "Failed to create mount point dir."; exit 1; }
|
||||
|
||||
sudo mount $ROOT_PARTITION $MOUNT_DIR
|
||||
|
||||
|
@ -26,6 +33,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"
|
||||
|
|
Loading…
Reference in New Issue