summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-03-09 09:55:55 +0100
committerDavid Lönnhager <david.l@mullvad.net>2020-03-16 12:54:27 +0100
commit1c834ab5bd0b04bcebb41d69b4e8c708fda1ebe6 (patch)
tree6b98ad67767c84725eb0925c9f245ca93942bfea
parentd9105937064bb0f308cb6f2d4e11f680fcb49b9a (diff)
downloadmullvadvpn-1c834ab5bd0b04bcebb41d69b4e8c708fda1ebe6.tar.xz
mullvadvpn-1c834ab5bd0b04bcebb41d69b4e8c708fda1ebe6.zip
Use setup tool to save the target state when upgrading
-rwxr-xr-xbuild.sh1
-rw-r--r--dist-assets/windows/installer.nsh37
2 files changed, 24 insertions, 14 deletions
diff --git a/build.sh b/build.sh
index 1de226460f..83073f29fd 100755
--- a/build.sh
+++ b/build.sh
@@ -160,6 +160,7 @@ elif [[ ("$(uname -s)" == "MINGW"*) ]]; then
mullvad.exe
mullvad-problem-report.exe
talpid_openvpn_plugin.dll
+ mullvad-setup.exe
)
fi
for binary in ${binaries[*]}; do
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh
index c7adccc49e..45404e98fd 100644
--- a/dist-assets/windows/installer.nsh
+++ b/dist-assets/windows/installer.nsh
@@ -694,20 +694,6 @@
Push $0
Push $1
- nsExec::ExecToStack '"$SYSDIR\sc.exe" stop mullvadvpn'
-
- # Discard return value
- Pop $0
-
- Sleep 5000
-
- nsExec::ExecToStack '"$SYSDIR\sc.exe" delete mullvadvpn'
-
- # Discard return value
- Pop $0
-
- Sleep 1000
-
# Check command line arguments
Var /GLOBAL FullUninstall
@@ -722,6 +708,29 @@
${EndIf}
Pop $FullUninstall
+ ${If} $FullUninstall != 1
+ # Save the target tunnel state if we're upgrading
+ SetOutPath "$TEMP"
+ File "${BUILD_RESOURCES_DIR}\mullvad-setup.exe"
+ nsExec::ExecToStack '"$TEMP\mullvad-setup.exe" prepare-restart'
+ Pop $0
+ Pop $1
+ ${EndIf}
+
+ nsExec::ExecToStack '"$SYSDIR\sc.exe" stop mullvadvpn'
+
+ # Discard return value
+ Pop $0
+
+ Sleep 5000
+
+ nsExec::ExecToStack '"$SYSDIR\sc.exe" delete mullvadvpn'
+
+ # Discard return value
+ Pop $0
+
+ Sleep 1000
+
log::Log "Running uninstaller for ${PRODUCT_NAME} ${VERSION}"
${RemoveCLIFromEnvironPath}