diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-05-19 15:49:09 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-06-28 15:52:14 +0200 |
| commit | 1d77bc771af5f39cc76c2cd69082ea9b32638216 (patch) | |
| tree | 446fafc90d7b9001086908055cf21c9ec594057a | |
| parent | 3626d6059633e598459444f91646c8bf499029d0 (diff) | |
| download | mullvadvpn-1d77bc771af5f39cc76c2cd69082ea9b32638216.tar.xz mullvadvpn-1d77bc771af5f39cc76c2cd69082ea9b32638216.zip | |
Handle uninstall errors appropriately
| -rw-r--r-- | dist-assets/windows/installer.nsh | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh index 9a9a8a59dd..8284988703 100644 --- a/dist-assets/windows/installer.nsh +++ b/dist-assets/windows/installer.nsh @@ -705,19 +705,6 @@ SetShellVarContext current RMDir /r "$LOCALAPPDATA\mullvad-vpn-updater" - # - # Hack to check whether the uninstaller succeeded. - # This assumes that it got far enough to create a log file. - # Note that the uninstaller has already been replaced at this point. - # - SetShellVarContext all - IfFileExists "$LOCALAPPDATA\Mullvad VPN\uninstall.log" 0 customInstall_uninstaller_succeeded - - MessageBox MB_OK "Failed to uninstall a previous version. Contact support or see the logs for more information." - Goto customInstall_abort_installation - - customInstall_uninstaller_succeeded: - ${MigrateCache} ${RemoveRelayCache} ${RemoveApiAddressCache} @@ -766,6 +753,51 @@ !macroend +# +# customUnInstallCheck +# +# This is called from the installer during an upgrade after the old version +# has been uninstalled or failed to uninstall. +# +# The error flag is set if the uninstaller failed to run. Otherwise, $R0 +# contains the exit status. +# +!macro customUnInstallCheck + + IfErrors 0 customUnInstallCheck_CheckReturnCode + + log::SetLogTarget ${LOG_UNINSTALL} + log::Log "Unable to launch uninstaller for previous ${PRODUCT_NAME} version" + + # + # If $INSTDIR is gone or can be removed, proceed anyway + # + IfFileExists $INSTDIR\*.* 0 customUnInstallCheck_Done + RMDir /r $INSTDIR + IfErrors 0 customUnInstallCheck_Done + + log::Log "Aborting since $INSTDIR exists" + Goto customUnInstallCheck_Abort + + customUnInstallCheck_CheckReturnCode: + + ${if} $R0 == 0 + Goto customUnInstallCheck_Done + ${endif} + + customUnInstallCheck_Abort: + + ${ExtractMullvadSetup} + ${ClearFirewallRules} + + MessageBox MB_OK "Failed to uninstall a previous version. Contact support or review the logs for more information." + SetErrorLevel 5 + Abort + + customUnInstallCheck_Done: + +!macroend + ############################################################################### # # Uninstaller |
