ZealOS/build/build_iso.sh

48 lines
1.6 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 rm /mnt/* -r
sudo sync
sudo modprobe nbd
sudo qemu-nbd -c dev/nbd0 -f raw ./ZealOS.raw
sudo partprobe /dev/nbd0
echo "Merging with src/"
sudo mount /dev/nbd0p1 /mnt
2021-11-01 00:04:05 +00:00
rm ../src/Home/Registry.CC # we use Registry for auto-iso process, don't want to overwrite
rm ../src/Home/MakeHome.CC # unneeded file
2021-10-31 09:09:00 +00:00
sudo cp -r ../src/* /mnt/
sudo sync
echo "Files copied, unmounting"
sudo umount /mnt
sudo qemu-nbd -d /dev/nbd0
sudo rm /mnt/* -r
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"
sudo rm /mnt/* -r
sudo sync
sudo modprobe nbd
sudo qemu-nbd -c dev/nbd0 -f raw ./ZealOS.raw
sudo partprobe /dev/nbd0
sudo mount /dev/nbd0p1 /mnt
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-10-31 09:09:00 +00:00
sudo cp /mnt/Tmp/MyDistro.ISO.C ./ZealOS-$(date +%Y-%m-%d-%H_%M_%S).iso
sudo chown -R $USER:$USER ./ZealOS-*.iso
echo "Files copied, unmounting"
sudo umount /mnt
sudo qemu-nbd -d /dev/nbd0
sudo rm /mnt/* -r
sudo sync
echo "Deleting temp HDD"
rm ./ZealOS.raw
2021-11-01 00:04:05 +00:00
echo "Done, build/ contents:"
ls