ZealOS/build/build_iso.sh

51 lines
1.7 KiB
Bash
Raw Normal View History

2021-10-31 09:09:00 +00:00
#!/bin/bash
2021-11-01 00:04:05 +00:00
# Build Distro ISO using AUTO.ISO minimal auto-install as bootstrap to merge codebase, recompile system, and export ISO
2021-10-31 09:09:00 +00:00
# Run this script inside build/ directory
2021-11-01 00:04:05 +00:00
2021-10-31 09:09:00 +00:00
echo "Making temp HDD, running auto-install"
2021-11-01 00:04:05 +00:00
qemu-img create -f raw ZealOS.raw 192M
2021-10-31 09:09:00 +00:00
qemu-system-x86_64 -machine q35,kernel_irqchip=off,accel=kvm -drive format=raw,file=ZealOS.raw -m 2G -smp $(nproc) -rtc base=localtime -cdrom AUTO.ISO -device isa-debug-exit
echo "Mounting"
sudo mkdir /tmp/zealtmp/
2021-11-30 02:54:36 +00:00
sudo rm /tmp/zealtmp/* -r
2021-10-31 09:09:00 +00:00
sudo sync
sudo modprobe nbd
sudo qemu-nbd -c dev/nbd0 -f raw ./ZealOS.raw
sudo partprobe /dev/nbd0
echo "Merging with src/"
2021-11-30 02:54:36 +00:00
sudo mount /dev/nbd0p1 /tmp/zealtmp
rm ../src/Home/Registry.ZC # we use Registry for auto-iso process, don't want to overwrite
rm ../src/Home/MakeHome.ZC # unneeded file
2021-11-30 02:54:36 +00:00
sudo cp -r ../src/* /tmp/zealtmp/
2021-10-31 09:09:00 +00:00
sudo sync
echo "Files copied, unmounting"
2021-11-30 02:54:36 +00:00
sudo umount /tmp/zealtmp
2021-10-31 09:09:00 +00:00
sudo qemu-nbd -d /dev/nbd0
2021-11-30 02:54:36 +00:00
sudo rm /tmp/zealtmp/* -r
2021-10-31 09:09:00 +00:00
sudo sync
qemu-system-x86_64 -machine q35,kernel_irqchip=off,accel=kvm -drive format=raw,file=ZealOS.raw -m 2G -smp $(nproc) -rtc base=localtime -device isa-debug-exit
echo "Mounting"
2021-11-30 02:54:36 +00:00
sudo rm /tmp/zealtmp/* -r
2021-10-31 09:09:00 +00:00
sudo sync
sudo modprobe nbd
sudo qemu-nbd -c dev/nbd0 -f raw ./ZealOS.raw
sudo partprobe /dev/nbd0
2021-11-30 02:54:36 +00:00
sudo mount /dev/nbd0p1 /tmp/zealtmp
2021-10-31 09:09:00 +00:00
echo "Extracting Distro ISO"
2021-11-01 00:04:05 +00:00
sudo rm ./ZealOS-*.iso # comment this line if you want lingering old ISOs
2021-11-30 02:54:36 +00:00
sudo cp /tmp/zealtmp/Tmp/MyDistro.ISO.C ./ZealOS-$(date +%Y-%m-%d-%H_%M_%S).iso
2021-10-31 09:09:00 +00:00
sudo chown -R $USER:$USER ./ZealOS-*.iso
echo "Files copied, unmounting"
2021-11-30 02:54:36 +00:00
sudo umount /tmp/zealtmp
2021-10-31 09:09:00 +00:00
sudo qemu-nbd -d /dev/nbd0
2021-11-30 02:54:36 +00:00
sudo rm /tmp/zealtmp/* -r
2021-10-31 09:09:00 +00:00
sudo sync
echo "Deleting temp HDD"
rm ./ZealOS.raw
2021-11-30 04:03:51 +00:00
echo "Deleting temp mount folder"
2021-11-30 05:23:02 +00:00
sudo rm -rf /tmp/zealtmp
2021-11-01 00:04:05 +00:00
echo "Done, build/ contents:"
ls