summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-11-10 15:44:24 +0100
committerOskar Nyberg <oskar@mullvad.net>2021-11-22 10:51:25 +0100
commit91e26feb8fce6d7fa6e258941c5c35f7c0232f59 (patch)
tree9d85d67a91380d995849d127f86d972c619f524e
parent2b31085240e32bff902816ed978dce7e7917e933 (diff)
downloadmullvadvpn-91e26feb8fce6d7fa6e258941c5c35f7c0232f59.tar.xz
mullvadvpn-91e26feb8fce6d7fa6e258941c5c35f7c0232f59.zip
Quit without disconnect during upgrade if old is newer than 2021.2
-rw-r--r--dist-assets/windows/installer.nsh39
1 files changed, 22 insertions, 17 deletions
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh
index c1dac59bf8..402802e1dc 100644
--- a/dist-assets/windows/installer.nsh
+++ b/dist-assets/windows/installer.nsh
@@ -911,29 +911,32 @@
# The default behavior may cause the daemon to disconnect.
#
!macro customCheckAppRunning
+ push $R0
+ push $R1
# 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
+ Var /GLOBAL OldVersion
+ ReadRegStr $OldVersion HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APP_GUID}" "DisplayVersion"
+ StrCpy $R0 $OldVersion 4 # Major version
+ StrCpy $R1 $OldVersion 1 5 # Minor version
+ ${If} $R0 > 2021
+ Goto customCheckAppRunning_skip_kill
+ ${OrIf} $R0 == 2021
+ ${If} $R1 > 2
+ Goto customCheckAppRunning_skip_kill
+ ${EndIf}
+ ${EndIf}
+ # Killing without /f will likely cause the daemon to disconnect.
nsExec::Exec `taskkill /f /t /im "${APP_EXECUTABLE_FILENAME}"` $R0
-
Sleep 500
-!macroend
+ customCheckAppRunning_skip_kill:
+ pop $R1
+ pop $R0
-!define KillGui '!insertmacro "KillGui"'
+!macroend
#
# customInstall
@@ -1231,6 +1234,10 @@
Pop $FullUninstall
+ nsExec::Exec '"$INSTDIR\Mullvad VPN.exe" --quit-without-disconnect' $0
+ Sleep 500
+ nsExec::Exec `taskkill /f /t /im "${APP_EXECUTABLE_FILENAME}"` $0
+
${If} $FullUninstall == 0
# Save the target tunnel state if we're upgrading
nsExec::ExecToStack '"$TEMP\mullvad-setup.exe" prepare-restart'
@@ -1251,8 +1258,6 @@
Goto customRemoveFiles_abort
${EndIf}
- ${KillGui}
-
# Remove application files
log::Log "Deleting $INSTDIR"
RMDir /r $INSTDIR