summaryrefslogtreecommitdiffhomepage
path: root/dist-assets/linux
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-05-22 08:57:27 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-05-22 09:03:45 +0200
commit26b3e3473220984254afcac36f1c1916f33679e9 (patch)
tree6ffe6f60c6c7637bfeb1286c1dcbe1cca61bb2ad /dist-assets/linux
parent022b3e0e52d2ca1992debbb0b428ba0ab80523fe (diff)
downloadmullvadvpn-26b3e3473220984254afcac36f1c1916f33679e9.tar.xz
mullvadvpn-26b3e3473220984254afcac36f1c1916f33679e9.zip
Move linux scripts into dist-assets
Diffstat (limited to 'dist-assets/linux')
-rw-r--r--dist-assets/linux/install_script.sh4
-rw-r--r--dist-assets/linux/mullvad-daemon.service9
-rw-r--r--dist-assets/linux/uninstall_script.sh40
3 files changed, 53 insertions, 0 deletions
diff --git a/dist-assets/linux/install_script.sh b/dist-assets/linux/install_script.sh
new file mode 100644
index 0000000000..ea03f94c91
--- /dev/null
+++ b/dist-assets/linux/install_script.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+set -eu
+systemctl enable mullvad-daemon.service
+systemctl start mullvad-daemon.service
diff --git a/dist-assets/linux/mullvad-daemon.service b/dist-assets/linux/mullvad-daemon.service
new file mode 100644
index 0000000000..83c3032031
--- /dev/null
+++ b/dist-assets/linux/mullvad-daemon.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mullvad VPN daemon
+Wants=network.target
+
+[Service]
+ExecStart="/opt/Mullvad VPN/resources/mullvad-daemon" -v --disable-stdout-timestamps --log /var/log/mullvad-daemon/daemon.log --tunnel-log /var/log/mullvad-daemon/openvpn.log
+
+[Install]
+WantedBy=multi-user.target
diff --git a/dist-assets/linux/uninstall_script.sh b/dist-assets/linux/uninstall_script.sh
new file mode 100644
index 0000000000..b4f4671b92
--- /dev/null
+++ b/dist-assets/linux/uninstall_script.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+set -eu
+
+function remove_systemd_unit {
+ systemctl stop mullvad-daemon.service || \
+ echo "Failed to stop mullvad-daemon service"
+ systemctl disable mullvad-daemon.service || \
+ echo "Failed to disable mullvad-daemon service"
+}
+
+function remove_logs_and_cache {
+ rm -rf /var/log/mullvad-daemon/ || \
+ echo "Failed to remove mullvad-daemon logs"
+ rm -rf /var/cache/mullvad-daemon/ || \
+ echo "Failed to remove mullvad-daemon cache"
+}
+
+function remove_config {
+ rm -rf /etc/mullvad-daemon || \
+ echo "Failed to remove mullvad-daemon config"
+}
+
+# checking what kind of an action is taking place
+case $@ in
+ # apt purge passes "purge"
+ "purge")
+ remove_logs_and_cache
+ remove_config
+ ;;
+ # apt remove passes "remove"
+ "remove")
+ remove_systemd_unit
+ ;;
+ # yum remove passes a 0
+ "0")
+ remove_logs_and_cache
+ remove_systemd_unit
+ remove_config
+ ;;
+esac