summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xdist-assets/pkg-scripts/postinstall7
-rw-r--r--dist-assets/windows/installer.nsh32
2 files changed, 36 insertions, 3 deletions
diff --git a/dist-assets/pkg-scripts/postinstall b/dist-assets/pkg-scripts/postinstall
index 0723e90f5e..7034cc15a3 100755
--- a/dist-assets/pkg-scripts/postinstall
+++ b/dist-assets/pkg-scripts/postinstall
@@ -51,12 +51,13 @@ EOM
ZSH_COMPLETIONS_DIR="/usr/local/share/zsh/site-functions/"
FISH_COMPLETIONS_DIR="/usr/local/share/fish/vendor_completions.d/"
-pkill -x "Mullvad VPN" || echo "Unable to kill GUI, not running?"
-sleep 1
-
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?"
+sleep 1
+
echo "$DAEMON_PLIST" > $DAEMON_PLIST_PATH
launchctl load -w $DAEMON_PLIST_PATH
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh
index 935c390384..2106b50226 100644
--- a/dist-assets/windows/installer.nsh
+++ b/dist-assets/windows/installer.nsh
@@ -651,6 +651,36 @@
!macroend
#
+# customCheckAppRunning
+#
+# The default behavior may cause the daemon to disconnect.
+#
+!macro customCheckAppRunning
+
+ # This must be done here for compatibility with <= 2021.2,
+ # since those versions do not kill the GUI in the uninstaller.
+ # This is fine as long as /f is used.
+
+ ${KillGui}
+
+!macroend
+
+#
+# KillGui
+#
+# Kill "Mullvad VPN.exe" if it is running. Killing without /f may cause the daemon to disconnect.
+#
+!macro KillGui
+
+ nsExec::Exec `taskkill /f /t /im "${APP_EXECUTABLE_FILENAME}"` $R0
+
+ Sleep 500
+
+!macroend
+
+!define KillGui '!insertmacro "KillGui"'
+
+#
# customInstall
#
# This macro is activated towards the end of the installation
@@ -943,6 +973,8 @@
Goto customRemoveFiles_abort
${EndIf}
+ ${KillGui}
+
# Remove application files
log::Log "Deleting $INSTDIR"
RMDir /r $INSTDIR