nsi: Handle silent uninstall

Fixes #1323
This commit is contained in:
Jonas Kvinge 2023-11-26 21:35:48 +01:00
parent 54c42b276f
commit eeeea8566e
1 changed files with 13 additions and 12 deletions

View File

@ -136,8 +136,6 @@ SetCompressor /SOLID lzma
ReserveFile "${NSISDIR}\Plugins\x86-unicode\INetC.dll" ReserveFile "${NSISDIR}\Plugins\x86-unicode\INetC.dll"
!endif !endif
!define LockedListPATH $InstallDir
; Installer pages ; Installer pages
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE COPYING !insertmacro MUI_PAGE_LICENSE COPYING
@ -184,19 +182,22 @@ FunctionEnd
Function CheckPreviousInstall Function CheckPreviousInstall
ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} "UninstallString" ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} "UninstallString"
StrCmp $R0 "" done StrCmp $R0 "" Done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ ${IfNot} ${Silent}
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \ MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the previous version or `Cancel` to cancel this upgrade." IDOK Uninstall
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort Abort
; Run the uninstaller ${EndIf}
uninst:
ClearErrors
ExecWait '$R0' ; Do not copy the uninstaller to a temp file
done: Uninstall:
ClearErrors
${If} ${Silent}
ExecWait '$R0 /S'
${Else}
ExecWait '$R0'
${EndIf}
Done:
FunctionEnd FunctionEnd