Move qcow2 build script into separate file

This commit is contained in:
Micah Lee 2021-06-28 12:11:49 -07:00
parent ad5de25e76
commit c467831c3d
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
5 changed files with 12 additions and 12 deletions

View file

@ -1 +1 @@
vm vm

View file

@ -2,12 +2,12 @@
Thanks, [alpine-make-vm-image](https://github.com/alpinelinux/alpine-make-vm-image) project. License: MIT Thanks, [alpine-make-vm-image](https://github.com/alpinelinux/alpine-make-vm-image) project. License: MIT
To build the VM image: To build the qcow2 VM image:
```sh ```sh
docker run \ docker run \
--privileged --cap-add=ALL \ --privileged --cap-add=ALL \
-v $(pwd):/build ubuntu:latest /build/build.sh -v $(pwd):/build ubuntu:latest /build/build-qcow2.sh
``` ```
This will create a VM image file called `dangerzone.qcow2`. This will create a VM image file called `vm/dangerzone.qcow2`.

View file

@ -10,9 +10,9 @@ cd /build
rm -r /build/vm rm -r /build/vm
mkdir -p /build/vm mkdir -p /build/vm
./alpine-make-vm-image \ ./alpine-make-vm-image \
--image-format qcow2 \ --image-format raw \
--image-size 2G \ --image-size 2G \
--packages "$(cat packages)" \ --packages "podman openssh" \
--script-chroot \ --script-chroot \
/build/vm/dangerzone.qcow2 -- ./configure.sh /build/vm/dangerzone.qcow2 -- ./configure.sh

View file

@ -1,2 +0,0 @@
podman
openssh

View file

@ -1,11 +1,13 @@
#!/bin/bash #!/bin/bash
ROOT=$(pwd)/vm ROOT=$(pwd)/vm
HYPERKIT=/Applications/Docker.app/Contents/Resources/bin/com.docker.hyperkit
VPNKIT=/Applications/Docker.app/Contents/Resources/bin/com.docker.vpnkit
echo "[] Running vpnkit" echo "[] Running vpnkit"
VPNKIT_SOCK=$ROOT/vpnkit.eth.sock VPNKIT_SOCK=$ROOT/vpnkit.eth.sock
PIDFILE=$ROOT/vpnkit.pid PIDFILE=$ROOT/vpnkit.pid
vpnkit --ethernet=$VPNKIT_SOCK & $VPNKIT --ethernet=$VPNKIT_SOCK &
echo $! > $PIDFILE echo $! > $PIDFILE
trap 'test -f $PIDFILE && kill `cat $PIDFILE` && rm $PIDFILE' EXIT trap 'test -f $PIDFILE && kill `cat $PIDFILE` && rm $PIDFILE' EXIT
@ -15,15 +17,15 @@ sleep 1
# mkfile 1g $ROOT/disk.img # mkfile 1g $ROOT/disk.img
echo "[] Starting VM" echo "[] Starting VM"
hyperkit \ $HYPERKIT \
-A -u \ -A -u \
-m 2G \ -m 2G \
-c 2 \ -c 2 \
-s 0:0,hostbridge -s 31,lpc \ -s 0:0,hostbridge -s 31,lpc \
-l com1,stdio \ -l com1,stdio \
-s 1:0,ahci-hd,file://$ROOT/dangerzone.qcow2,format=qcow \ -s 3:0,ahci-cd,$ROOT/dangerzone.raw \
-s 2:0,virtio-vpnkit,path=$VPNKIT_SOCK \ -s 2:0,virtio-vpnkit,path=$VPNKIT_SOCK \
-U 9efa82d7-ebd5-4287-b1cc-ac4160a39fa7 \ -U 9efa82d7-ebd5-4287-b1cc-ac4160a39fa7 \
-f kexec,$ROOT/vmlinuz-virt,$ROOT/initramfs-virt,"earlyprintk=serial console=ttyS0 modules=loop,squashfs,sd-mod,usb-storage" -f kexec,$ROOT/vmlinuz-virt,$ROOT/initramfs-virt,"earlyprintk=serial console=ttyS0 modules=loop,squashfs,sd-mod,usb-storage"
# -s 4:0,virtio-blk,$ROOT/disk.img \ # -s 4:0,virtio-blk,$ROOT/disk.img \