ZealOS/build/sync_vm.sh

30 lines
817 B
Bash
Raw Normal View History

2021-10-31 09:09:00 +00:00
#!/bin/bash
2021-11-01 00:04:05 +00:00
2021-10-31 09:09:00 +00:00
# Sync repo --> VM
2021-11-01 00:04:05 +00:00
# (copy src/ to VM. Kernel code changes won't be reflected in VM until running BootHDIns; to recompile kernel.)
# Run this script inside build/ directory
2021-10-31 09:09:00 +00:00
sudo modprobe nbd
2021-11-30 05:27:25 +00:00
echo "Edit this script first to pick your VM path & file!"
exit # Comment this line out
2021-10-31 09:09:00 +00:00
# Uncomment ONE of the next lines and edit it to point to your VM HDD
2021-11-01 00:04:05 +00:00
# sudo qemu-nbd -c dev/nbd0 ~/VirtualBox\ VMs/ZealOS/ZealOS.vdi
2021-10-31 09:09:00 +00:00
# sudo qemu-nbd -c dev/nbd0 ~/vmware/ZealOS/ZealOS.vmdk
# sudo qemu-nbd -c dev/nbd0 ZealOS.qcow2
sudo partprobe /dev/nbd0
2021-11-30 05:23:02 +00:00
sudo mkdir /tmp/zealtmp
2021-11-30 02:56:25 +00:00
sudo mount /dev/nbd0p1 /tmp/zealtmp
2021-10-31 09:09:00 +00:00
echo "Merging with src/"
2021-11-30 02:56:25 +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:56:25 +00:00
sudo umount /tmp/zealtmp
2021-10-31 09:09:00 +00:00
sudo qemu-nbd -d /dev/nbd0
2021-11-30 05:23:02 +00:00
sudo rm -rf /tmp/zealtmp
2021-10-31 09:09:00 +00:00
sudo sync
echo "finished."