mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Rename rip_docker to install/vm-builder, and start making a build script that uses it
This commit is contained in:
parent
57f9c6bf2c
commit
7b2211fc1f
16 changed files with 39 additions and 57 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -134,4 +134,6 @@ deb_dist
|
|||
.DS_Store
|
||||
install/windows/Dangerzone.wxs
|
||||
test_docs/sample-safe.pdf
|
||||
share/bin
|
||||
share/bin
|
||||
install/vm-builder/vm
|
||||
install/vm-builder/.vagrant
|
4
BUILD.md
4
BUILD.md
|
@ -56,10 +56,10 @@ If you don't have it already, install poetry (`pip3 install --user poetry`). The
|
|||
poetry install
|
||||
```
|
||||
|
||||
Make sure Docker Desktop is installed (Dangerzone copies hyperkit and vpnkit binaries from it) and run this to collect the binaries:
|
||||
Make sure [Docker Desktop](https://www.docker.com/products/docker-desktop) and vagrant (`brew install vagrant`) are installed and run this to collect the binaries:
|
||||
|
||||
```
|
||||
./install/macos/collect-bins.sh
|
||||
./install/macos/get-vm.sh
|
||||
```
|
||||
|
||||
Run from source tree:
|
||||
|
|
|
@ -11,7 +11,7 @@ class SysTray(QtWidgets.QSystemTrayIcon):
|
|||
self.setIcon(self.gui_common.get_window_icon())
|
||||
|
||||
menu = QtWidgets.QMenu()
|
||||
self.status_action = menu.addAction("Dangerzone is starting ...")
|
||||
self.status_action = menu.addAction("...")
|
||||
self.status_action.setEnabled(False)
|
||||
menu.addSeparator()
|
||||
self.restart_action = menu.addAction("Restart")
|
||||
|
@ -22,6 +22,22 @@ class SysTray(QtWidgets.QSystemTrayIcon):
|
|||
self.setContextMenu(menu)
|
||||
self.show()
|
||||
|
||||
# Processes for the Dangerzone VM
|
||||
self.vpnkit_p = None
|
||||
self.hyperkit_p = None
|
||||
|
||||
# Start the VM
|
||||
self.vm_start()
|
||||
|
||||
def vm_start(self):
|
||||
self.status_action.setText("Starting Dangerzone ...")
|
||||
|
||||
# Kill existing processes
|
||||
if self.vpnkit_p is not None:
|
||||
self.vpnkit_p.terminate()
|
||||
if self.hyperkit_p is not None:
|
||||
self.hyperkit_p.terminate()
|
||||
|
||||
def restart_clicked(self):
|
||||
self.status_action.setText("Restarting Dangerzone ...")
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
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
|
17
install/macos/get-vm.sh
Executable file
17
install/macos/get-vm.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Extract hyperkit and vpnkit from Docker Desktop
|
||||
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
|
||||
|
||||
# Build ISO
|
||||
cd install/vm-builder
|
||||
vagrant up
|
||||
vagrant ssh -- /vagrant/build-iso.sh
|
||||
vagrant down
|
||||
cd ../..
|
||||
|
||||
# Copy the ISO to resources
|
||||
mkdir -p share/vm
|
||||
cp install/vm-builder/vm/* share/vm
|
2
rip_docker/.gitignore
vendored
2
rip_docker/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
vm
|
||||
.vagrant
|
|
@ -1,47 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import uuid
|
||||
import os
|
||||
|
||||
|
||||
def main():
|
||||
base_dir = os.path.join(
|
||||
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "vm"
|
||||
)
|
||||
|
||||
vm_uuid = uuid.uuid4()
|
||||
|
||||
cmd = [
|
||||
"hyperkit",
|
||||
"-m",
|
||||
"4G",
|
||||
"-c",
|
||||
"2",
|
||||
"-s",
|
||||
"0:0,hostbridge",
|
||||
"-s",
|
||||
"31,lpc",
|
||||
"-s",
|
||||
"2:0,virtio-net",
|
||||
"-l",
|
||||
"com1,stdio",
|
||||
# "-F",
|
||||
# os.path.join(base_dir, "hyperkit.pid"),
|
||||
"-U",
|
||||
str(vm_uuid),
|
||||
"-s",
|
||||
"3:0,ahci-cd," + os.path.join(base_dir, "alpine-dangerzone-v3.14-x86_64.iso"),
|
||||
"-f",
|
||||
"kexec,"
|
||||
+ os.path.join(base_dir, "vmlinuz-virt")
|
||||
+ ","
|
||||
+ os.path.join(base_dir, "initramfs-virt")
|
||||
+ ',"modules=virtio_net console=ttyS0"',
|
||||
]
|
||||
print(" ".join(cmd))
|
||||
|
||||
subprocess.run(cmd)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in a new issue