Clean-up new build scripts.

Thanks to B4S3D for helpful tips on bash no-quote tilde expansion!
This commit is contained in:
TomAwezome 2021-12-17 12:50:03 -05:00
parent e7fec6b427
commit 93d81670e0
2 changed files with 12 additions and 6 deletions

View file

@ -28,7 +28,7 @@ umount_tempdisk() {
echo "Making temp vdisk, running auto-install..."
qemu-img create -f raw $TMPDISK 192M
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 512M -rtc base=localtime -cdrom AUTO.ISO -device isa-debug-exit
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -cdrom AUTO.ISO -device isa-debug-exit
echo "Mounting vdisk and copying src/..."
rm ../src/Home/Registry.ZC 2> /dev/null
@ -38,7 +38,7 @@ sudo cp -r ../src/* $TMPMOUNT
umount_tempdisk
echo "Generating ISO..."
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 512M -rtc base=localtime -device isa-debug-exit
qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -device isa-debug-exit
echo "Extracting ISO from vdisk..."
rm ./ZealOS-*.iso 2> /dev/null # comment this line if you want lingering old ISOs

View file

@ -9,16 +9,21 @@
#alias sudo=doas
# Set this
ZEALDISK=""
ZEALDISK=
# Examples:
#ZEALDISK=~/VirtualBox\ VMs/ZealOS/ZealOS.vdi
#ZEALDISK=~/vmware/ZealOS/ZealOS.vmdk
#ZEALDISK=ZealOS.qcow2
[ -z $ZEALDISK ] && echo "Please edit this script with the full path to your ZealOS virtual disk." && exit 1
[ -z "$ZEALDISK" ] && echo "Please edit this script with the full path to your ZealOS virtual disk." && exit 1
[ ! -f "$ZEALDISK" ] && echo "\$ZEALDISK is not a path to a file." && exit 1
TMPMOUNT=/tmp/zealtmp
USAGE="Usage: $0 [ repo | vm ]"
USAGE="Usage: $0 [ repo | vm ] \n\n repo - overwrites src/ with virtual disk contents.\n vm - overwrites virtual disk with src/ contents.\n"
mount_vdisk() {
echo "Mounting virtual disk..."
sudo qemu-nbd -c /dev/nbd0 $ZEALDISK
sudo qemu-nbd -c /dev/nbd0 "$ZEALDISK"
sudo partprobe /dev/nbd0
sudo mount /dev/nbd0p1 $TMPMOUNT
}
@ -28,6 +33,7 @@ umount_vdisk() {
sync
sudo umount $TMPMOUNT
sudo qemu-nbd -d /dev/nbd0
sudo rm -rf $TMPMOUNT
}
if [ -z $1 ]