From e8f7d96f90cae03917eaee256eeeb987483d43ad Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 29 Jun 2021 17:37:00 -0700 Subject: [PATCH] Fix building VM ISO, and start implementing start_vm --- .gitignore | 1 + BUILD.md | 2 +- dangerzone/gui/systray.py | 22 ++++++++++++++++++---- install/macos/get-vm.sh | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index ff7f6ca..958c995 100644 --- a/.gitignore +++ b/.gitignore @@ -135,5 +135,6 @@ deb_dist install/windows/Dangerzone.wxs test_docs/sample-safe.pdf share/bin +share/vm install/vm-builder/vm install/vm-builder/.vagrant \ No newline at end of file diff --git a/BUILD.md b/BUILD.md index e090f94..8b6c324 100644 --- a/BUILD.md +++ b/BUILD.md @@ -56,7 +56,7 @@ If you don't have it already, install poetry (`pip3 install --user poetry`). The poetry install ``` -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: +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 from Docker Desktop and then build a custom Alpine Linux ISO for Dangerzone, and copy them into the `share` folder: ``` ./install/macos/get-vm.sh diff --git a/dangerzone/gui/systray.py b/dangerzone/gui/systray.py index df85680..4b71030 100644 --- a/dangerzone/gui/systray.py +++ b/dangerzone/gui/systray.py @@ -1,4 +1,5 @@ -from PySide2 import QtCore, QtGui, QtWidgets +import os +from PySide2 import QtWidgets class SysTray(QtWidgets.QSystemTrayIcon): @@ -22,11 +23,20 @@ class SysTray(QtWidgets.QSystemTrayIcon): self.setContextMenu(menu) self.show() - # Processes for the Dangerzone VM + # Dangerzone VM self.vpnkit_p = None self.hyperkit_p = None - - # Start the VM + self.hyperkit_path = self.global_common.get_resource_path("bin/hyperkit") + self.vpnkit_path = self.global_common.get_resource_path("bin/vpnkit") + self.vm_iso_path = self.global_common.get_resource_path( + "vm/alpine-dangerzone-v3.14-x86_64.iso" + ) + self.vm_kernel_path = self.global_common.get_resource_path("vm/vmlinuz-virt") + self.vm_initramfs_path = self.global_common.get_resource_path( + "vm/initramfs-virt" + ) + self.vm_state_dir = os.path.join(self.global_common.appdata_path, "vm-state") + os.makedirs(self.vm_state_dir, exist_ok=True) self.vm_start() def vm_start(self): @@ -38,6 +48,10 @@ class SysTray(QtWidgets.QSystemTrayIcon): if self.hyperkit_p is not None: self.hyperkit_p.terminate() + # Run VPNKit + + # Run Hyperkit + def restart_clicked(self): self.status_action.setText("Restarting Dangerzone ...") diff --git a/install/macos/get-vm.sh b/install/macos/get-vm.sh index ff1f600..60d4d17 100755 --- a/install/macos/get-vm.sh +++ b/install/macos/get-vm.sh @@ -9,7 +9,7 @@ cp /Applications/Docker.app/Contents/Resources/bin/com.docker.vpnkit share/bin/v cd install/vm-builder vagrant up vagrant ssh -- /vagrant/build-iso.sh -vagrant down +vagrant halt cd ../.. # Copy the ISO to resources