summaryrefslogtreecommitdiffhomepage
path: root/linux/uninstall_script.sh
diff options
context:
space:
mode:
Diffstat (limited to 'linux/uninstall_script.sh')
-rw-r--r--linux/uninstall_script.sh37
1 files changed, 33 insertions, 4 deletions
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