diff options
author | bitraid <bitraid@protonmail.ch> | 2018-10-06 23:59:37 +0300 |
---|---|---|
committer | bitraid <bitraid@protonmail.ch> | 2018-10-06 23:59:37 +0300 |
commit | 7fb0c858bcf1623a8d3482c12e8fbc54ef4d04cf (patch) | |
tree | 84b1595b5a8d830b70a789f58da97f06159d93ee /misc/nsis | |
parent | b1876c475548047e4826a85e372edd7ee8252719 (diff) | |
download | qutebrowser-7fb0c858bcf1623a8d3482c12e8fbc54ef4d04cf.tar.gz qutebrowser-7fb0c858bcf1623a8d3482c12e8fbc54ef4d04cf.zip |
NSIS: don't try to run the uninstaller if missing
Diffstat (limited to 'misc/nsis')
-rwxr-xr-x | misc/nsis/install.nsh | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/misc/nsis/install.nsh b/misc/nsis/install.nsh index 92f79ed0e..a9cbd119d 100755 --- a/misc/nsis/install.nsh +++ b/misc/nsis/install.nsh @@ -193,36 +193,39 @@ Section "Core Files (required)" SectionCoreFiles StrCpy $4 "/upgrade" ${endif} - HideWindow - ClearErrors - StrCpy $0 0 - ; $1 is quoted in registry; the _? param stops the uninstaller from copying - ; itself to the temporary directory, which is the only way for ExecWait to work - ExecWait '$1 $4 /SS $2 _?=$3' $0 - - ${if} ${errors} ; stay in installer - SetErrorLevel 2 ; Installation aborted by script - BringToFront - Abort "Error executing uninstaller." - ${else} - ${Switch} $0 - ${Case} 0 ; uninstaller completed successfully - continue with installation - BringToFront - ${Break} - ${Case} 1 ; Installation aborted by user (cancel button) - ${Case} 2 ; Installation aborted by script - SetErrorLevel $0 - Quit ; uninstaller was started, but completed with errors - Quit installer - ${Default} ; all other error codes - uninstaller could not start, elevate, etc. - Abort installer - SetErrorLevel $0 - BringToFront - Abort "Error executing uninstaller." - ${EndSwitch} - ${endif} + ; Make sure the uninstaller is there before attempting to run it + ${if} ${FileExists} $1 + HideWindow + ClearErrors + StrCpy $0 0 + ; $1 is quoted in registry; the _? param stops the uninstaller from copying + ; itself to the temporary directory, which is the only way for ExecWait to work + ExecWait '$1 $4 /SS $2 _?=$3' $0 + + ${if} ${errors} ; stay in installer + SetErrorLevel 2 ; Installation aborted by script + BringToFront + Abort "Error executing uninstaller." + ${else} + ${Switch} $0 + ${Case} 0 ; uninstaller completed successfully - continue with installation + BringToFront + ${Break} + ${Case} 1 ; Installation aborted by user (cancel button) + ${Case} 2 ; Installation aborted by script + SetErrorLevel $0 + Quit ; uninstaller was started, but completed with errors - Quit installer + ${Default} ; all other error codes - uninstaller could not start, elevate, etc. - Abort installer + SetErrorLevel $0 + BringToFront + Abort "Error executing uninstaller." + ${EndSwitch} + ${endif} - ; the uninstaller doesn't delete itself when not copied to the temp directory - !insertmacro DeleteRetryAbort "$3\${UNINSTALL_FILENAME}" - RMDir "$3" + ; the uninstaller doesn't delete itself when not copied to the temp directory + !insertmacro DeleteRetryAbort "$3\${UNINSTALL_FILENAME}" + RMDir "$3" + ${endif} ${endif} ; Remove the old uninstaller if it's leftover |