Set specific exit codes when NSIS installer failed in silent mode

* Set specific exit codes when NSIS installer failed in silent mode
  Related: https://github.com/qbittorrent/qBittorrent/issues/18115#issuecomment-1789404780
* GHA CI: treat NSIS warnings as errors

PR #20296.
This commit is contained in:
Chocobo1 2024-01-22 14:01:15 +08:00 committed by GitHub
parent c5d7b62473
commit 31d456c43b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 12 deletions

View file

@ -187,7 +187,7 @@ jobs:
- name: Create installer - name: Create installer
run: | run: |
7z x -o"dist/windows/" "dist/windows/NSISPlugins.zip" 7z x -o"dist/windows/" "dist/windows/NSISPlugins.zip"
makensis /DQBT_DIST_DIR="../../upload/qBittorrent" dist/windows/qbittorrent.nsi makensis /DQBT_DIST_DIR="../../upload/qBittorrent" /WX dist/windows/qbittorrent.nsi
- name: Upload installer - name: Upload installer
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View file

@ -117,12 +117,14 @@ Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY !insertmacro MUI_LANGDLL_DISPLAY
${IfNot} ${AtLeastWaaS} 1809 ; Windows 10 (1809) / Windows Server 2019. Min supported version by Qt6 ${IfNot} ${AtLeastWaaS} 1809 ; Windows 10 (1809) / Windows Server 2019. Min supported version by Qt6
MessageBox MB_OK|MB_ICONEXCLAMATION $(inst_requires_win10) MessageBox MB_OK|MB_ICONEXCLAMATION $(inst_requires_win10) /SD IDOK
SetErrorLevel 1654 # WinError.h: `ERROR_INSTALL_REJECTED`
Abort Abort
${EndIf} ${EndIf}
${IfNot} ${RunningX64} ${IfNot} ${RunningX64}
MessageBox MB_OK|MB_ICONEXCLAMATION $(inst_requires_64bit) MessageBox MB_OK|MB_ICONEXCLAMATION $(inst_requires_64bit) /SD IDOK
SetErrorLevel 1654 # WinError.h: `ERROR_INSTALL_REJECTED`
Abort Abort
${EndIf} ${EndIf}
@ -147,9 +149,10 @@ Function check_instance
check: check:
FindProcDLL::FindProc "qbittorrent.exe" FindProcDLL::FindProc "qbittorrent.exe"
StrCmp $R0 "1" 0 notfound StrCmp $R0 "1" 0 notfound
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(inst_warning) IDRETRY check IDCANCEL done MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(inst_warning) /SD IDCANCEL IDRETRY check IDCANCEL canceled
done: canceled:
SetErrorLevel 15618 # WinError.h: `ERROR_PACKAGES_IN_USE`
Abort Abort
notfound: notfound:

View file

@ -75,15 +75,16 @@ FunctionEnd
Function un.check_instance Function un.check_instance
check: check:
FindProcDLL::FindProc "qbittorrent.exe" FindProcDLL::FindProc "qbittorrent.exe"
StrCmp $R0 "1" 0 notfound StrCmp $R0 "1" 0 notfound
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(uninst_warning) IDRETRY check IDCANCEL done MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(uninst_warning) /SD IDCANCEL IDRETRY check IDCANCEL canceled
done: canceled:
Abort SetErrorLevel 15618 # WinError.h: `ERROR_PACKAGES_IN_USE`
Abort
notfound: notfound:
FunctionEnd FunctionEnd