summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-05-15 09:56:30 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-05-15 09:56:30 +0200
commit256dce53b27981f4c80543e7b5fbf221a1099070 (patch)
treee5aec8116e893a0c3a907ce17879ac92af58c11f
parentd1e88e72910669d0ef71c114ffa889095ebafd66 (diff)
downloadmullvadvpn-256dce53b27981f4c80543e7b5fbf221a1099070.tar.xz
mullvadvpn-256dce53b27981f4c80543e7b5fbf221a1099070.zip
Add preinstall script for macOS that removes old MullvadVPN
-rwxr-xr-xdist-assets/pkg-scripts/postinstall4
-rwxr-xr-xdist-assets/pkg-scripts/preinstall20
2 files changed, 23 insertions, 1 deletions
diff --git a/dist-assets/pkg-scripts/postinstall b/dist-assets/pkg-scripts/postinstall
index 2180d91ee4..c2d3b3f7e1 100755
--- a/dist-assets/pkg-scripts/postinstall
+++ b/dist-assets/pkg-scripts/postinstall
@@ -5,7 +5,9 @@ set -eu
LOG_DIR=/var/log/mullvad-daemon
mkdir -p $LOG_DIR
-exec 2>&1 > $LOG_DIR/install.log
+exec 2>&1 > $LOG_DIR/postinstall.log
+
+echo "Running postinstall at $(date)"
INSTALL_DIR=$2
DAEMON_PLIST_PATH="/Library/LaunchDaemons/net.mullvad.daemon.plist"
diff --git a/dist-assets/pkg-scripts/preinstall b/dist-assets/pkg-scripts/preinstall
new file mode 100755
index 0000000000..08ada60d4d
--- /dev/null
+++ b/dist-assets/pkg-scripts/preinstall
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -eux
+
+LOG_DIR=/var/log/mullvad-daemon
+
+mkdir -p $LOG_DIR
+exec 2>&1 > $LOG_DIR/preinstall.log
+
+echo "Running preinstall at $(date)"
+
+OLD_INSTALL_DIR="/Applications/MullvadVPN.app"
+
+if [ -d "$OLD_INSTALL_DIR" ]; then
+ echo "Found old Mullvad VPN install at $OLD_INSTALL_DIR. Stopping and uninstalling"
+ pkill MullvadVPN || true
+ pkill mullvad-daemon || true
+ rm -rf "$OLD_INSTALL_DIR"
+fi
+