summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2018-05-15 14:45:28 +0100
committerLinus Färnstrand <linus@mullvad.net>2018-05-15 21:59:39 +0200
commit11c6597e5c1f103b47bc178d0dea9aa7fb7d8a2b (patch)
tree3633d7b28b2e616dda3317ee5e6bfe0a19ec59e2
parent04249e15f415a228b52d8c0e6414592da0f2655d (diff)
downloadmullvadvpn-11c6597e5c1f103b47bc178d0dea9aa7fb7d8a2b.tar.xz
mullvadvpn-11c6597e5c1f103b47bc178d0dea9aa7fb7d8a2b.zip
Change uninstall script behaviour depending on package management action
-rw-r--r--linux/install_script.sh2
-rw-r--r--linux/uninstall_script.sh37
2 files changed, 34 insertions, 5 deletions
diff --git a/linux/install_script.sh b/linux/install_script.sh
index 37d7e312fc..ea03f94c91 100644
--- a/linux/install_script.sh
+++ b/linux/install_script.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
-set -eux
+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 b349962968..d4565bcae2 100644
--- a/linux/uninstall_script.sh
+++ b/linux/uninstall_script.sh
@@ -1,5 +1,34 @@
#!/usr/bin/env bash
-set -ux
-systemctl stop mullvad-daemon.service
-systemctl disable mullvad-daemon.service
-exit 0
+set -eu
+function remove_systemd_unit {
+ systemctl stop mullvad-daemon.service
+ systemctl disable mullvad-daemon.service
+}
+
+function remove_logs_and_cache {
+ rm -rf /var/log/mullvad-daemon/
+ rm -rf /var/cache/mullvad-daemon/
+}
+
+function remove_config {
+ rm -rf /etc/mullvad-daemon
+}
+
+# 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