summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2018-04-17 16:01:26 +0100
committerEmīls Piņķis <emils@mullvad.net>2018-04-17 16:01:26 +0100
commitc4051935bce33d57d0708a4ed610279e67b58ce2 (patch)
tree5ee6bb5e2bf9e7d03ff05f02efd266968e7e1460
parent0009eca64d31768b6eef1be787761b217cf0cdc8 (diff)
parent06618e704849a42cf3dc522d9d30efac5c07d869 (diff)
downloadmullvadvpn-c4051935bce33d57d0708a4ed610279e67b58ce2.tar.xz
mullvadvpn-c4051935bce33d57d0708a4ed610279e67b58ce2.zip
Merge branch 'linux-packaging'
-rw-r--r--app/app.js8
-rw-r--r--app/main.js15
-rw-r--r--electron-builder.yml13
-rw-r--r--linux/install_script.sh4
-rw-r--r--linux/mullvad-daemon.service9
-rw-r--r--linux/uninstall_script.sh4
6 files changed, 49 insertions, 4 deletions
diff --git a/app/app.js b/app/app.js
index 6e9272e88b..13a5c75f59 100644
--- a/app/app.js
+++ b/app/app.js
@@ -47,6 +47,14 @@ ipcRenderer.on('shutdown', () => {
log.warn('Unable to shut down the backend', e.message);
});
});
+
+ipcRenderer.on('disconnect', () => {
+ log.info('Been told by the node process to disconnect the tunnel');
+ backend.disconnect()
+ .catch( e => {
+ log.warn('Unable to disconnect the tunnel', e.message);
+ });
+});
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
diff --git a/app/main.js b/app/main.js
index 6370292d72..0c5eb7ec73 100644
--- a/app/main.js
+++ b/app/main.js
@@ -95,10 +95,17 @@ const appDelegate = {
ipcMain.on('hide-window', () => window.hide());
window.loadURL('file://' + path.join(__dirname, 'index.html'));
- window.on('close', () => {
- log.debug('The browser window is closing, shutting down the tunnel...');
- window.webContents.send('shutdown');
- });
+ if (process.platform === 'linux') {
+ window.on('close', () => {
+ log.debug('The browser window is closing, shutting down the tunnel...');
+ window.webContents.send('disconnect');
+ });
+ } else {
+ window.on('close', () => {
+ log.debug('The browser window is closing, shutting down the daemon...');
+ window.webContents.send('shutdown');
+ });
+ }
ipcMain.on('collect-logs', (event, id, toRedact) => {
log.info('Collecting logs in', appDelegate._logFileLocation);
diff --git a/electron-builder.yml b/electron-builder.yml
index 38b4636d4d..7b1cd6ef7e 100644
--- a/electron-builder.yml
+++ b/electron-builder.yml
@@ -73,6 +73,7 @@ win:
linux:
target:
- deb
+ - rpm
artifactName: MullvadVPN-${version}_${arch}.${ext}
extraResources:
- from: ./target/release/mullvad
@@ -83,3 +84,15 @@ linux:
to: .
- from: ./target/release/libtalpid_openvpn_plugin.so
to: .
+
+deb:
+ fpm: ["--config-files", "/etc/systemd/system/mullvad-daemon.service",
+ "./linux/mullvad-daemon.service=/etc/systemd/system/"]
+ afterInstall: linux/install_script.sh
+ afterRemove: linux/uninstall_script.sh
+
+rpm:
+ fpm: ["--config-files", "/etc/systemd/system/mullvad-daemon.service",
+ "./linux/mullvad-daemon.service=/etc/systemd/system/"]
+ afterInstall: linux/install_script.sh
+ afterRemove: linux/uninstall_script.sh
diff --git a/linux/install_script.sh b/linux/install_script.sh
new file mode 100644
index 0000000000..c4c94eee52
--- /dev/null
+++ b/linux/install_script.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -eux
+systemctl enable mullvad-daemon.service
+systemctl start mullvad-daemon.service
diff --git a/linux/mullvad-daemon.service b/linux/mullvad-daemon.service
new file mode 100644
index 0000000000..2fe6550f51
--- /dev/null
+++ b/linux/mullvad-daemon.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mullvad VPN daemon
+Wants=network.target
+
+[Service]
+ExecStart="/opt/Mullvad VPN/resources/mullvad-daemon" --disable-stdout-timestamps
+
+[Install]
+WantedBy=multi-user.target
diff --git a/linux/uninstall_script.sh b/linux/uninstall_script.sh
new file mode 100644
index 0000000000..3d2194c8ac
--- /dev/null
+++ b/linux/uninstall_script.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -eux
+systemctl stop mullvad-daemon.service
+systemctl disable mullvad-daemon.service