summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-05-15 22:16:14 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-05-15 22:16:14 +0200
commit9d546c06d9913528166363c72035f87eca8c0d24 (patch)
treeb1d734246b19bad7cfe15122af303ac221708ddf
parentd68e5be0572893d19f82699beab8948674ba2b31 (diff)
parentd744a1a99034ea031adbc932f3ac4926a18fe8fb (diff)
downloadmullvadvpn-9d546c06d9913528166363c72035f87eca8c0d24.tar.xz
mullvadvpn-9d546c06d9913528166363c72035f87eca8c0d24.zip
Merge branch 'fix-linux-install-scripts'
-rw-r--r--linux/install_script.sh4
-rw-r--r--linux/uninstall_script.sh44
2 files changed, 42 insertions, 6 deletions
diff --git a/linux/install_script.sh b/linux/install_script.sh
index c4c94eee52..ea03f94c91 100644
--- a/linux/install_script.sh
+++ b/linux/install_script.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
-set -eux
+#!/usr/bin/env bash
+set -eu
systemctl enable mullvad-daemon.service
systemctl start mullvad-daemon.service
diff --git a/linux/uninstall_script.sh b/linux/uninstall_script.sh
index 3d2194c8ac..b4f4671b92 100644
--- a/linux/uninstall_script.sh
+++ b/linux/uninstall_script.sh
@@ -1,4 +1,40 @@
-#!/bin/bash
-set -eux
-systemctl stop mullvad-daemon.service
-systemctl disable mullvad-daemon.service
+#!/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