Move vm-builder up a dir, and start replacing Docker Desktop with building hyperkit and vpnkit manually

This commit is contained in:
Micah Lee 2021-11-17 13:41:45 -08:00
parent e4c241a0d1
commit fd1dec7438
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
25 changed files with 177 additions and 16 deletions

View file

@ -54,23 +54,32 @@ Create a .rpm:
## macOS
Install [Docker Desktop](https://www.docker.com/products/docker-desktop).
Install python@3.9 from Homebrew:
Ensure you have the git submodules checked out:
```
brew install python@3.9 create-dmg
git submodule init
git submodule update
```
If you don't have it already, install poetry (`pip3 install --user poetry`). Then install dependencies:
Install Xcode from the App Store.
Install Python 3.9.9 [[from python.org])(https://www.python.org/downloads/release/python-399/).
Install Python dependencies:
```sh
pip3 install --user poetry
poetry install
```
Make sure [Docker Desktop](https://www.docker.com/products/docker-desktop) and vagrant (`brew install vagrant`) are installed.
Install [Homebrew](https://brew.sh/) dependencies:
Run this to build a custom Alpine Linux ISO for Dangerzone, and copy it into the `share` folder:
```
brew install vagrant create-dmg
brew install wget opam pkg-config
```
Run this to compile hyperkit and vpnkit, and build a custom Alpine Linux ISO for Dangerzone, and copy it into the `share` folder:
```sh
./install/macos/make-vm.sh

View file

@ -1,17 +1,28 @@
#!/bin/sh
# Extract hyperkit and vpnkit from Docker Desktop
# Compile hyperkit
cd vendor/hyperkit/
make || { echo 'Failed to compile hyperkit' ; exit 1; }
cd ../..
# Compile vpnkit
cd vendor/vpnkit/
unset OPAMROOT
make || { echo 'Failed to compile vpnkit' ; exit 1; }
cd ../..
# Copy binaries to share
mkdir -p share/bin
cp /Applications/Docker.app/Contents/Resources/bin/com.docker.hyperkit share/bin/hyperkit
cp /Applications/Docker.app/Contents/Resources/bin/com.docker.vpnkit share/bin/vpnkit
cp vendor/hyperkit/build/hyperkit share/bin/hyperkit
cp vendor/vpnkit/build/vpnkit share/bin/vpnkit
# Build ISO
cd install/vm-builder
cd vm-builder
vagrant up
vagrant ssh -- /vagrant/build-iso.sh
vagrant halt
cd ../..
cd ..
# Copy the ISO to resources
mkdir -p share/vm
cp install/vm-builder/vm/* share/vm
cp vm-builder/vm/* share/vm

View file

@ -0,0 +1 @@
{"dependencies":[["vagrant-vmware-desktop",["= 3.0.1"]]],"checksum":"0ad00f1ec196455770fca952e89c309b84036297f2a9b4b560b24f477e0315e1","vagrant_version":"2.2.19"}

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>disallowUpgrade</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,5 @@
.encoding = "UTF-8"
cloneOf0 = "/Users/user/.vagrant.d/boxes/generic-VAGRANTSLASH-alpine314/3.5.2/vmware_desktop/generic-alpine314-vmware.vmx"
numCloneOf = "1"
sentinel0 = "generic-alpine314-vmware-cl1.vmdk"
numSentinels = "1"

View file

@ -0,0 +1,106 @@
.encoding = "UTF-8"
bios.bootorder = "hdd,cdrom"
checkpoint.vmstate = ""
cleanshutdown = "TRUE"
config.version = "8"
cpuid.corespersocket = "1"
displayname = "vm-builder: default"
ehci.pcislotnumber = "-1"
ehci.present = "FALSE"
ethernet0.addresstype = "generated"
ethernet0.connectiontype = "nat"
ethernet0.present = "TRUE"
ethernet0.virtualdev = "e1000"
extendedconfigfile = "generic-alpine314-vmware.vmxf"
filesearchpath = ".;/Users/user/.vagrant.d/boxes/generic-VAGRANTSLASH-alpine314/3.5.2/vmware_desktop"
floppy0.present = "FALSE"
guestos = "otherlinux-64"
gui.fullscreenatpoweron = "FALSE"
gui.viewmodeatpoweron = "windowed"
hgfs.linkrootshare = "TRUE"
hgfs.maprootshare = "TRUE"
ide0:0.clientdevice = "TRUE"
ide0:0.devicetype = "cdrom-raw"
ide0:0.filename = "auto detect"
ide0:0.present = "TRUE"
invmteam = "FALSE"
isolation.tools.hgfs.disable = "FALSE"
memsize = "2048"
monitor.phys_bits_used = "42"
msg.autoanswer = "true"
numa.autosize.cookie = "20001"
numa.autosize.vcpu.maxpervirtualnode = "2"
numvcpus = "2"
nvme0.present = "FALSE"
nvram = "generic-alpine314-vmware.nvram"
parallel0.autodetect = "FALSE"
parallel0.bidirectional = ""
parallel0.filename = ""
parallel0.present = "FALSE"
parallel0.startconnected = "FALSE"
pcibridge0.pcislotnumber = "17"
pcibridge0.present = "TRUE"
pcibridge4.functions = "8"
pcibridge4.pcislotnumber = "21"
pcibridge4.present = "TRUE"
pcibridge4.virtualdev = "pcieRootPort"
pcibridge5.functions = "8"
pcibridge5.pcislotnumber = "22"
pcibridge5.present = "TRUE"
pcibridge5.virtualdev = "pcieRootPort"
pcibridge6.functions = "8"
pcibridge6.pcislotnumber = "23"
pcibridge6.present = "TRUE"
pcibridge6.virtualdev = "pcieRootPort"
pcibridge7.functions = "8"
pcibridge7.pcislotnumber = "24"
pcibridge7.present = "TRUE"
pcibridge7.virtualdev = "pcieRootPort"
policy.vm.mvmtid = ""
powertype.poweroff = "hard"
powertype.poweron = "hard"
powertype.reset = "hard"
powertype.suspend = "hard"
proxyapps.publishtohost = "FALSE"
remotedisplay.vnc.enabled = "FALSE"
remotedisplay.vnc.ip = "127.0.0.1"
remotedisplay.vnc.port = "5993"
replay.filename = ""
replay.supported = "FALSE"
sata0.present = "FALSE"
scsi0.pcislotnumber = "16"
scsi0.present = "TRUE"
scsi0.virtualdev = "lsilogic"
scsi0:0.filename = "generic-alpine314-vmware-cl1.vmdk"
scsi0:0.present = "TRUE"
scsi0:0.redo = ""
serial0.autodetect = "FALSE"
serial0.filename = ""
serial0.filetype = ""
serial0.pipe.endpoint = ""
serial0.present = "FALSE"
serial0.startconnected = "FALSE"
serial0.trynorxloss = ""
serial0.yieldonmsrread = ""
softpoweroff = "FALSE"
sound.autodetect = "TRUE"
sound.filename = "-1"
sound.present = "FALSE"
sound.startconnected = "FALSE"
svga.guestbackedprimaryaware = "TRUE"
svga.vramsize = "134217728"
tools.synctime = "TRUE"
tools.upgrade.policy = "upgradeAtPowerCycle"
usb.pcislotnumber = "-1"
usb.present = "FALSE"
uuid.action = "create"
uuid.bios = ""
uuid.location = ""
vc.uuid = ""
virtualhw.productcompatibility = "hosted"
virtualhw.version = "12"
vmci0.id = "1861462631"
vmci0.pcislotnumber = "35"
vmci0.present = "TRUE"
vmotion.checkpointfbsize = "134217728"
vmotion.checkpointsvgaprimarysize = "134217728"

View file

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<Foundry>
<VM>
<ClientMetaData>
<clientMetaDataAttributes/>
<HistoryEventList/></ClientMetaData>
<VMId type="string">52 59 c0 38 41 3e 81 21-fb fe 13 82 cc 38 5e 9d</VMId>
<vmxPathName type="string">generic-alpine314-vmware.vmx</vmxPathName></VM></Foundry>

View file

@ -0,0 +1 @@
{"name":"generic/alpine314","version":"3.5.2","provider":"vmware_desktop","directory":"boxes/generic-VAGRANTSLASH-alpine314/3.5.2/vmware_desktop"}

View file

@ -0,0 +1 @@
502

View file

@ -0,0 +1 @@
/Users/user/code/dangerzone/install/vm-builder/.vagrant/machines/default/vmware_desktop/1a6cd45d-9c66-466a-8102-8e7fbbe66804/generic-alpine314-vmware.vmx

View file

@ -0,0 +1 @@
8055cfc1c36c4fe0af1dc2f53d5369ae

View file

@ -0,0 +1 @@
/Users/user/code/dangerzone/install/vm-builder

View file

@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end

View file

@ -2,11 +2,10 @@
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/alpine313"
config.vm.box = "generic/alpine314"
config.vm.synced_folder "../../dangerzone-converter", "/opt/dangerzone-converter"
config.vm.synced_folder ".", "/vagrant"
config.vm.provision "shell", inline: <<-SHELL
sed -i 's/3.13/3.14/' /etc/apk/repositories
apk update
apk add alpine-sdk build-base apk-tools alpine-conf busybox fakeroot syslinux xorriso squashfs-tools sudo
apk add mtools dosfstools grub-efi

View file

@ -1,6 +1,6 @@
#!/bin/sh
ALPINE_TAG=v3.14.1
ALPINE_TAG=v3.14.3
# Set up podman
sudo modprobe fuse