diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2023-06-16 16:28:36 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-06-22 07:16:53 +0200 |
| commit | 73c0c0ad944bb21ebb78af1cdbd0ebdea6c2a7b2 (patch) | |
| tree | ab0a40cb5ea746fe20c65e581592626416fcae2d | |
| parent | 3de7c40efddb04507474fc7091aec69d3a9a09ad (diff) | |
| download | mullvadvpn-73c0c0ad944bb21ebb78af1cdbd0ebdea6c2a7b2.tar.xz mullvadvpn-73c0c0ad944bb21ebb78af1cdbd0ebdea6c2a7b2.zip | |
Close GUI before daemon is killed when upgrading app version
Closing the GUI to prevent showing the disconnected and unsecure
notification and the tray icon switches to the unlocked state when it
loses the connection to the daemon.
| -rwxr-xr-x | dist-assets/pkg-scripts/postinstall | 5 | ||||
| -rwxr-xr-x | dist-assets/pkg-scripts/preinstall | 9 |
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 |
