Исходя из ответа @ Wim, вот мое решение.(Название приложения, которое мне нужно установить, - «Evergreen Programmer», и есть также код, чтобы проверить, является ли процессор 32- или 64-разрядным.) Мне не нравится, как Abort
заставляет GUI выглядеть,хотя (пользователь должен нажать Отмена):
!include "x64.nsh"
Function CheckReturnCode
DetailPrint "MSI return code was $0"
${If} $0 != 0
Abort "There was a problem installing the application."
${EndIf}
FunctionEnd
Section "FrameworkAndApp" SecFrameworkApp
SetOutPath "$TEMP"
File /oname=EvergreenProgrammerSetup.msi "${SETUP_FILE}"
File /oname=EvergreenProgrammerSetup64.msi "${SETUP_FILE_64}"
InstallEvergreenProgrammer:
Push "Starting Evergreen Programmer Install Version ${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION}"
Call DebugLog
DetailPrint "Starting Evergreen Programmer Install Version ${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION}"
IfSilent InstallAppWithNoProgressBar
${If} ${RunningX64}
DetailPrint "64-bit detected"
ExecWait "msiexec /passive /liare+ ${SETUP_LOG_FILE} -i $TEMP\EvergreenProgrammerSetup64.msi" $0
${Else}
ExecWait "msiexec /passive /liare+ ${SETUP_LOG_FILE} -i $TEMP\EvergreenProgrammerSetup.msi" $0
${EndIf}
Call CheckReturnCode
SetRebootFlag true
Goto EndInstall
InstallAppWithNoProgressBar:
${If} ${RunningX64}
DetailPrint "64-bit detected"
ExecWait "msiexec /quiet /liare+ ${SETUP_LOG_FILE} -i $TEMP\EvergreenProgrammerSetup64.msi" $0
${Else}
ExecWait "msiexec /quiet /liare+ ${SETUP_LOG_FILE} -i $TEMP\EvergreenProgrammerSetup.msi" $0
${EndIf}
Call CheckReturnCode
SetRebootFlag true
Goto EndInstall
EndInstall:
IfRebootFlag PromptForReboot
Return
PromptForReboot:
IfSilent SkipReboot
MessageBox MB_OK "The application will not function correctly without a reboot or log off."
SkipReboot:
SectionEnd