summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-06-22 07:18:14 +0200
committerOskar Nyberg <oskar@mullvad.net>2023-06-22 07:18:14 +0200
commit4e85e925966a1d1496eb1acf25207ecd0c80db77 (patch)
treeab0a40cb5ea746fe20c65e581592626416fcae2d
parent3de7c40efddb04507474fc7091aec69d3a9a09ad (diff)
parent73c0c0ad944bb21ebb78af1cdbd0ebdea6c2a7b2 (diff)
downloadmullvadvpn-4e85e925966a1d1496eb1acf25207ecd0c80db77.tar.xz
mullvadvpn-4e85e925966a1d1496eb1acf25207ecd0c80db77.zip
Merge branch 'close-gui-before-daemon-on-upgrade-des-203'
-rwxr-xr-xdist-assets/pkg-scripts/postinstall5
-rwxr-xr-xdist-assets/pkg-scripts/preinstall9
2 files changed, 13 insertions, 1 deletions
diff --git a/dist-assets/pkg-scripts/postinstall b/dist-assets/pkg-scripts/postinstall
index b91cd8a4e4..c2e611100d 100755
--- a/dist-assets/pkg-scripts/postinstall
+++ b/dist-assets/pkg-scripts/postinstall
@@ -75,7 +75,10 @@ launchctl unload -w $DAEMON_PLIST_PATH
cp "$LOG_DIR/daemon.log" "$LOG_DIR/old-install-daemon.log" \
|| echo "Failed to copy old daemon log"
-pkill -x "Mullvad VPN" || echo "Unable to kill GUI, not running?"
+# For compatibility with versions older than 2022.5, kill the GUI after the
+# upgrade. We now do this in preinstall instead. This code can be removed when
+# we drop support for app versions older than 2022.5.
+pkill -x "Mullvad VPN" || true
sleep 1
echo "$DAEMON_PLIST" > $DAEMON_PLIST_PATH
diff --git a/dist-assets/pkg-scripts/preinstall b/dist-assets/pkg-scripts/preinstall
index 93d88d6271..b65f95d3cf 100755
--- a/dist-assets/pkg-scripts/preinstall
+++ b/dist-assets/pkg-scripts/preinstall
@@ -33,3 +33,12 @@ rm "$NEW_CACHE_DIR/api-ip-address.txt" || true
# Remove deprecated exclusion group. This line can be removed when 2023.4 is no longer supported
dscl . -delete /groups/mullvad-exclusion &>/dev/null || true
+
+# Kill the GUI before proceeding with the upgrade.
+#
+# When we drop support for all app versions older than 2022.5, we can skip this
+# check and always try to kill the GUI.
+if "$INSTALL_DIR/Mullvad VPN.app/Contents/Resources/mullvad-setup" is-older-version 2022.5; then
+ pkill -x "Mullvad VPN" || echo "Unable to kill GUI, not running?"
+ sleep 1
+fi