mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-27 07:46:33 +00:00
Merge branch 'B4S3D-master'
This commit is contained in:
commit
076542f12c
9 changed files with 130 additions and 180 deletions
53
build/build-iso.sh
Executable file
53
build/build-iso.sh
Executable file
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Build Distro ISO using AUTO.ISO minimal auto-install as bootstrap to merge codebase, recompile system, and export ISO
|
||||||
|
|
||||||
|
# Run this script inside build/ directory
|
||||||
|
|
||||||
|
# Uncomment if you use doas instead of sudo
|
||||||
|
#alias sudo=doas
|
||||||
|
|
||||||
|
TMPDIR="/tmp/zealtmp"
|
||||||
|
TMPDISK="$TMPDIR/ZealOS.raw"
|
||||||
|
TMPMOUNT="$TMPDIR/mnt"
|
||||||
|
|
||||||
|
mount_tempdisk() {
|
||||||
|
sudo modprobe nbd
|
||||||
|
sudo qemu-nbd -c /dev/nbd0 -f raw $TMPDISK
|
||||||
|
sudo partprobe /dev/nbd0
|
||||||
|
sudo mount /dev/nbd0p1 $TMPMOUNT
|
||||||
|
}
|
||||||
|
|
||||||
|
umount_tempdisk() {
|
||||||
|
sync
|
||||||
|
sudo umount $TMPMOUNT
|
||||||
|
sudo qemu-nbd -d /dev/nbd0
|
||||||
|
}
|
||||||
|
|
||||||
|
[ ! -d $TMPMOUNT ] && mkdir -p $TMPMOUNT
|
||||||
|
|
||||||
|
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 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
|
||||||
|
rm ../src/Home/MakeHome.ZC 2> /dev/null
|
||||||
|
mount_tempdisk
|
||||||
|
sudo cp -r ../src/* $TMPMOUNT
|
||||||
|
umount_tempdisk
|
||||||
|
|
||||||
|
echo "Generating ISO..."
|
||||||
|
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
|
||||||
|
mount_tempdisk
|
||||||
|
cp $TMPMOUNT/Tmp/MyDistro.ISO.C ./ZealOS-$(date +%Y-%m-%d-%H_%M_%S).iso
|
||||||
|
umount_tempdisk
|
||||||
|
|
||||||
|
echo "Deleting temp folder..."
|
||||||
|
rm -rf $TMPDIR
|
||||||
|
echo "Finished."
|
||||||
|
ls -lh ZealOS-*.iso
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Build Distro ISO using AUTO.ISO minimal auto-install as bootstrap to merge codebase, recompile system, and export ISO
|
|
||||||
|
|
||||||
# Run this script inside build/ directory
|
|
||||||
|
|
||||||
echo "Making temp HDD, running auto-install"
|
|
||||||
qemu-img create -f raw ZealOS.raw 192M
|
|
||||||
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/
|
|
||||||
sudo rm /tmp/zealtmp/* -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 /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
|
|
||||||
sudo cp -r ../src/* /tmp/zealtmp/
|
|
||||||
sudo sync
|
|
||||||
echo "Files copied, unmounting"
|
|
||||||
sudo umount /tmp/zealtmp
|
|
||||||
sudo qemu-nbd -d /dev/nbd0
|
|
||||||
sudo rm /tmp/zealtmp/* -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 /tmp/zealtmp/* -r
|
|
||||||
sudo sync
|
|
||||||
sudo modprobe nbd
|
|
||||||
sudo qemu-nbd -c dev/nbd0 -f raw ./ZealOS.raw
|
|
||||||
sudo partprobe /dev/nbd0
|
|
||||||
sudo mount /dev/nbd0p1 /tmp/zealtmp
|
|
||||||
echo "Extracting Distro ISO"
|
|
||||||
sudo rm ./ZealOS-*.iso # comment this line if you want lingering old ISOs
|
|
||||||
sudo cp /tmp/zealtmp/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 /tmp/zealtmp
|
|
||||||
sudo qemu-nbd -d /dev/nbd0
|
|
||||||
sudo rm /tmp/zealtmp/* -r
|
|
||||||
sudo sync
|
|
||||||
echo "Deleting temp HDD"
|
|
||||||
rm ./ZealOS.raw
|
|
||||||
echo "Deleting temp mount folder"
|
|
||||||
sudo rm -rf /tmp/zealtmp
|
|
||||||
echo "Done, build/ contents:"
|
|
||||||
ls
|
|
|
@ -1,4 +0,0 @@
|
||||||
Remove-Item -Recurse -Force .\src\*
|
|
||||||
Copy-Item -Recurse -Force Z:\* .\src\
|
|
||||||
Remove-Item .\ZealOS-*.iso
|
|
||||||
Move-Item .\src\Tmp\MyDistro.ISO.C .\ZealOS-$(Get-Date -Format "yyyy-MM-dd-HH_mm_ss").iso
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
echo "mounting..."
|
|
||||||
sudo modprobe nbd
|
|
||||||
sudo qemu-nbd -c dev/nbd0 ~/VirtualBox\ VMs/ZealOS/ZealOS.vdi #Replace with path to disk
|
|
||||||
#sudo qemu-nbd -c dev/nbd0 ~/vmware/ZealOS/ZealOS.vmdk #Replace with path to disk
|
|
||||||
sudo partprobe /dev/nbd0
|
|
||||||
sudo mount /dev/nbd0p1 /mnt
|
|
||||||
echo "mounted .vdi"
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "unmounting..."
|
|
||||||
sudo umount /mnt
|
|
||||||
sudo qemu-nbd -d /dev/nbd0
|
|
||||||
echo "unmounted .vdi"
|
|
||||||
echo "not copying/updating ISO."
|
|
||||||
#echo "set perms, update ISO."
|
|
||||||
#sudo chown -R $USER:$USER src/*
|
|
||||||
#rm ZealOS-*
|
|
||||||
#mv src/Tmp/MyDistro.ISO.C ./ZealOS-$(date +%Y-%m-%d-%H_%M_%S).iso
|
|
||||||
echo "finished."
|
|
|
@ -1,37 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
echo "mounting..."
|
|
||||||
sudo modprobe nbd
|
|
||||||
sudo qemu-nbd -c dev/nbd0 ~/VirtualBox\ VMs/ZealOS/ZealOS.vdi #Replace with path to disk
|
|
||||||
#sudo qemu-nbd -c dev/nbd0 ~/vmware/ZealOS/ZealOS.vmdk #Replace with path to disk
|
|
||||||
sudo partprobe /dev/nbd0
|
|
||||||
sudo mount /dev/nbd0p1 /mnt
|
|
||||||
echo "mounted .vdi"
|
|
||||||
|
|
||||||
echo "removing src/ files"
|
|
||||||
rm -rf src/*
|
|
||||||
echo "copying src/ files from root of mounted .vdi"
|
|
||||||
sudo cp -r /mnt/* src/
|
|
||||||
echo "src/ files copied"
|
|
||||||
|
|
||||||
echo "removing doc/ files"
|
|
||||||
rm -rf docs/*
|
|
||||||
echo "copying docs/ files from HTML/ folder of mounted .vdi"
|
|
||||||
sudo cp -r /mnt/HTML/* docs/
|
|
||||||
echo "docs/ files copied"
|
|
||||||
|
|
||||||
echo "unmounting..."
|
|
||||||
sudo umount /mnt
|
|
||||||
sudo qemu-nbd -d /dev/nbd0
|
|
||||||
echo "unmounted .vdi"
|
|
||||||
echo "set perms, update ISO."
|
|
||||||
sudo chown -R $USER:$USER src/*
|
|
||||||
sudo chown -R $USER:$USER docs/*
|
|
||||||
rm ZealOS-*
|
|
||||||
mv src/Tmp/MyDistro.ISO.C ./ZealOS-$(date +%Y-%m-%d-%H_%M_%S).iso
|
|
||||||
mv src/Tmp/AUTO.ISO.C ./build/AUTO.ISO
|
|
||||||
|
|
||||||
echo "removing duplicates"
|
|
||||||
rm -rf ./src/HTML/*
|
|
||||||
|
|
||||||
echo "finished."
|
|
||||||
git status
|
|
77
build/sync.sh
Executable file
77
build/sync.sh
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Sync VM <--> Repo.
|
||||||
|
# Run this script inside build/ directory.
|
||||||
|
|
||||||
|
# On copying from virtual disk to src/, the directory is emptied before copy. Comment out "rm -rf ../src/*" to copy onto src.
|
||||||
|
|
||||||
|
# Uncomment if you use doas instead of sudo
|
||||||
|
#alias sudo=doas
|
||||||
|
|
||||||
|
# Set this
|
||||||
|
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
|
||||||
|
[ ! -f "$ZEALDISK" ] && echo "\$ZEALDISK is not a path to a file." && exit 1
|
||||||
|
|
||||||
|
TMPMOUNT=/tmp/zealtmp
|
||||||
|
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 partprobe /dev/nbd0
|
||||||
|
sudo mount /dev/nbd0p1 $TMPMOUNT
|
||||||
|
}
|
||||||
|
|
||||||
|
umount_vdisk() {
|
||||||
|
echo "Unmounting virtual disk..."
|
||||||
|
sync
|
||||||
|
sudo umount $TMPMOUNT
|
||||||
|
sudo qemu-nbd -d /dev/nbd0
|
||||||
|
sudo rm -rf $TMPMOUNT
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z $1 ]
|
||||||
|
then
|
||||||
|
echo $USAGE
|
||||||
|
else
|
||||||
|
sudo modprobe nbd
|
||||||
|
[ ! -d $TMPMOUNT ] && mkdir $TMPMOUNT
|
||||||
|
case $1 in
|
||||||
|
repo)
|
||||||
|
echo "Emptying src..."
|
||||||
|
rm -rf ../src/*
|
||||||
|
mount_vdisk
|
||||||
|
echo "Copying vdisk root to src..."
|
||||||
|
cp -r $TMPMOUNT/* ../src
|
||||||
|
rm ../src/Boot/BootMHD2.BIN.C
|
||||||
|
if [ -d $TMPMOUNT/HTML ]
|
||||||
|
then
|
||||||
|
echo "Copying HTML docs to docs/..."
|
||||||
|
cp -r $TMPMOUNT/HTML/* ../docs
|
||||||
|
else
|
||||||
|
echo "No HTML docs to copy."
|
||||||
|
fi
|
||||||
|
umount_vdisk
|
||||||
|
[ -f ../src/Tmp/AUTO.ISO.C ] && mv ../src/Tmp/AUTO.ISO.C ./AUTO.ISO
|
||||||
|
echo "Finished."
|
||||||
|
git status
|
||||||
|
;;
|
||||||
|
vm)
|
||||||
|
mount_vdisk
|
||||||
|
echo "Copying src to vdisk..."
|
||||||
|
sudo cp -r ../src/* $TMPMOUNT
|
||||||
|
umount_vdisk
|
||||||
|
echo "Finished."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown action."
|
||||||
|
echo $USAGE
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
|
@ -1,39 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Sync VM --> repo
|
|
||||||
# (wipe src/, copy VM to src/. To copy over src/ in-place, comment out the `rm -rf ../src/*` line.)
|
|
||||||
|
|
||||||
sudo modprobe nbd
|
|
||||||
|
|
||||||
echo "Edit this script first to pick your VM path & file!"
|
|
||||||
exit # Comment this line out
|
|
||||||
|
|
||||||
# Uncomment ONE of the next lines and edit it to point to your VM HDD
|
|
||||||
# sudo qemu-nbd -c dev/nbd0 ~/VirtualBox\ VMs/ZealOS/ZealOS.vdi
|
|
||||||
# sudo qemu-nbd -c dev/nbd0 ~/vmware/ZealOS/ZealOS.vmdk
|
|
||||||
# sudo qemu-nbd -c dev/nbd0 ZealOS.qcow2
|
|
||||||
|
|
||||||
sudo partprobe /dev/nbd0
|
|
||||||
sudo mkdir /tmp/zealtmp
|
|
||||||
sudo mount /dev/nbd0p1 /tmp/zealtmp
|
|
||||||
echo "removing src/ files"
|
|
||||||
rm -rf ../src/*
|
|
||||||
echo "copying src/ files from root of mounted hdd"
|
|
||||||
sudo cp -r /tmp/zealtmp/* ../src/
|
|
||||||
sudo rm ../src/Boot/BootMHD2.BIN.C
|
|
||||||
echo "src/ files copied"
|
|
||||||
|
|
||||||
echo "copying docs/ files from HTML/ folder of mounted .vdi"
|
|
||||||
sudo cp -r /tmp/zealtmp/HTML/* ../docs/
|
|
||||||
echo "docs/ files copied"
|
|
||||||
|
|
||||||
echo "unmounting..."
|
|
||||||
sudo umount /tmp/zealtmp
|
|
||||||
sudo rm -rf /tmp/zealtmp
|
|
||||||
sudo qemu-nbd -d /dev/nbd0
|
|
||||||
echo "unmounted hdd"
|
|
||||||
echo "set perms"
|
|
||||||
sudo chown -R $USER:$USER ../src/*
|
|
||||||
mv ../src/Tmp/AUTO.ISO.C ./AUTO.ISO
|
|
||||||
echo "finished."
|
|
||||||
git status
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Sync repo --> VM
|
|
||||||
# (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
|
|
||||||
|
|
||||||
sudo modprobe nbd
|
|
||||||
|
|
||||||
echo "Edit this script first to pick your VM path & file!"
|
|
||||||
exit # Comment this line out
|
|
||||||
|
|
||||||
# Uncomment ONE of the next lines and edit it to point to your VM HDD
|
|
||||||
# sudo qemu-nbd -c dev/nbd0 ~/VirtualBox\ VMs/ZealOS/ZealOS.vdi
|
|
||||||
# sudo qemu-nbd -c dev/nbd0 ~/vmware/ZealOS/ZealOS.vmdk
|
|
||||||
# sudo qemu-nbd -c dev/nbd0 ZealOS.qcow2
|
|
||||||
|
|
||||||
sudo partprobe /dev/nbd0
|
|
||||||
sudo mkdir /tmp/zealtmp
|
|
||||||
sudo mount /dev/nbd0p1 /tmp/zealtmp
|
|
||||||
echo "Merging with src/"
|
|
||||||
sudo cp -r ../src/* /tmp/zealtmp
|
|
||||||
sudo sync
|
|
||||||
echo "Files copied, unmounting"
|
|
||||||
sudo umount /tmp/zealtmp
|
|
||||||
sudo qemu-nbd -d /dev/nbd0
|
|
||||||
sudo rm -rf /tmp/zealtmp
|
|
||||||
sudo sync
|
|
||||||
echo "finished."
|
|
Loading…
Reference in a new issue