2022-10-02 04:11:46 +03:00
|
|
|
;Start of user configurable options
|
|
|
|
;==============================================================================
|
|
|
|
|
|
|
|
; Uncomment if you want to use UPX to pack the installer header
|
|
|
|
; Doing so may make antivirus software flag the installer as virus/malware
|
|
|
|
;!define USE_UPX
|
|
|
|
|
2022-10-02 02:11:17 +03:00
|
|
|
; Uncomment when packaging 64bit qbittorrent
|
|
|
|
;!define QBT_IS_X64
|
|
|
|
|
|
|
|
; Uncomment when packaging qt6 qbittorrent
|
|
|
|
; It will also define QBT_IS_X64
|
|
|
|
;!define QBT_USES_QT6
|
|
|
|
|
|
|
|
!ifdef QBT_USES_QT6
|
|
|
|
!define /redef QBT_IS_X64
|
|
|
|
!endif
|
|
|
|
|
|
|
|
; qBittorrent version
|
2022-10-02 04:11:46 +03:00
|
|
|
; The string MUST contain ONLY numbers delimited by dots.
|
|
|
|
; It MUST contain a maximum of 4 delimited numbers
|
|
|
|
; Other values will result in undefined behavior
|
|
|
|
; examples:
|
|
|
|
; 4.5.0 -> good
|
|
|
|
; 4.5.1.3 -> good
|
|
|
|
; 4.5.1.3.2 -> bad
|
|
|
|
; 4.5.0beta -> bad
|
2023-10-22 03:12:59 +03:00
|
|
|
!define /ifndef QBT_VERSION "4.6.0"
|
2022-10-02 02:11:17 +03:00
|
|
|
|
2022-10-02 04:11:46 +03:00
|
|
|
; Option that controls the installer's window name
|
|
|
|
; If set, its value will be used like this:
|
|
|
|
; "qBittorrent ${QBT_INSTALLER_FILENAME}"
|
|
|
|
; If not set, the window name will be auto composed from QBT_VERSION, QBT_USES_QT6, QBT_IS_X64
|
|
|
|
; If you set this define then you MUST set QBT_INSTALLER_FILENAME too. Otherwise it will be ignored.
|
|
|
|
; This define is meant to ease automation from scripts/commandline
|
|
|
|
;!define QBT_INSTALLER_WINDOWNAME
|
|
|
|
|
|
|
|
; Option that controls the installer's window name
|
|
|
|
; If set, its value will be used like this:
|
|
|
|
; "qbittorrent_${QBT_INSTALLER_FILENAME}_setup.exe"
|
|
|
|
; If not set, the window name will be auto composed from QBT_VERSION, QBT_USES_QT6, QBT_IS_X64
|
|
|
|
; If you set this define then you MUST set QBT_INSTALLER_WINDOWNAME too. Otherwise it will be ignored.
|
|
|
|
; This define is meant to ease automation from scripts/commandline
|
|
|
|
;!define QBT_INSTALLER_FILENAME
|
|
|
|
|
|
|
|
;End of user configurable options
|
|
|
|
;==============================================================================
|
|
|
|
|
|
|
|
!ifndef QBT_INSTALLER_WINDOWNAME | QBT_INSTALLER_FILENAME
|
|
|
|
!ifndef QBT_IS_X64
|
|
|
|
; The name of the installer
|
|
|
|
!define QBT_INSTALLER_WINDOWNAME "${QBT_VERSION}"
|
|
|
|
|
|
|
|
; The file to write
|
|
|
|
!define QBT_INSTALLER_FILENAME "${QBT_VERSION}"
|
|
|
|
!else ; QBT_IS_X64
|
|
|
|
!ifndef QBT_USES_QT6
|
|
|
|
; The name of the installer
|
|
|
|
!define QBT_INSTALLER_WINDOWNAME "${QBT_VERSION} x64"
|
|
|
|
|
|
|
|
; The file to write
|
|
|
|
!define QBT_INSTALLER_FILENAME "${QBT_VERSION}_x64"
|
|
|
|
!else ; QBT_USES_QT6
|
|
|
|
; The name of the installer
|
|
|
|
!define QBT_INSTALLER_WINDOWNAME "${QBT_VERSION} (qt6) x64"
|
|
|
|
|
|
|
|
; The file to write
|
|
|
|
!define QBT_INSTALLER_FILENAME "${QBT_VERSION}_qt6_x64"
|
|
|
|
!endif ; QBT_USES_QT6
|
|
|
|
!endif ; QBT_IS_X64
|
|
|
|
!endif
|
|
|
|
|
2020-08-05 17:33:14 +03:00
|
|
|
Unicode true
|
2017-03-15 08:33:27 +03:00
|
|
|
ManifestDPIAware true
|
2022-10-02 04:11:46 +03:00
|
|
|
|
|
|
|
!ifdef USE_UPX
|
2013-01-23 23:06:50 +04:00
|
|
|
!packhdr "$%TEMP%\exehead.tmp" 'upx.exe -9 --best --ultra-brute "$%TEMP%\exehead.tmp"'
|
2022-10-02 04:11:46 +03:00
|
|
|
!endif
|
2013-01-23 23:06:50 +04:00
|
|
|
|
|
|
|
;Setting the compression
|
|
|
|
SetCompressor /SOLID LZMA
|
|
|
|
SetCompressorDictSize 64
|
|
|
|
XPStyle on
|
|
|
|
|
2022-10-02 04:11:46 +03:00
|
|
|
!include "MUI2.nsh"
|
2014-07-28 20:29:51 +04:00
|
|
|
!include "UAC.nsh"
|
2013-01-27 22:46:40 +04:00
|
|
|
!include "FileFunc.nsh"
|
2019-11-30 16:43:51 +03:00
|
|
|
!include "WinVer.nsh"
|
2022-10-02 02:11:17 +03:00
|
|
|
!ifdef QBT_IS_X64
|
2017-04-04 00:32:40 +03:00
|
|
|
!include "x64.nsh"
|
|
|
|
!endif
|
2022-10-02 04:11:46 +03:00
|
|
|
!include "3rdparty\VersionCompleteXXXX.nsi"
|
2013-01-23 23:06:50 +04:00
|
|
|
|
|
|
|
;For the file association
|
|
|
|
!define SHCNE_ASSOCCHANGED 0x8000000
|
|
|
|
!define SHCNF_IDLIST 0
|
|
|
|
|
|
|
|
;For special folder detection
|
|
|
|
!define CSIDL_APPDATA '0x1A' ;Application Data path
|
|
|
|
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
|
|
|
|
|
2014-07-28 20:29:51 +04:00
|
|
|
!define MUI_FINISHPAGE_RUN
|
|
|
|
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
|
2013-07-07 13:37:28 +04:00
|
|
|
!define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
|
2013-01-23 23:06:50 +04:00
|
|
|
|
2022-10-02 04:11:46 +03:00
|
|
|
; The name of the installer
|
|
|
|
Name "qBittorrent ${QBT_INSTALLER_WINDOWNAME}"
|
2022-10-02 02:11:17 +03:00
|
|
|
|
2022-10-02 04:11:46 +03:00
|
|
|
; The file to write
|
|
|
|
OutFile "qbittorrent_${QBT_INSTALLER_FILENAME}_setup.exe"
|
2013-01-23 23:06:50 +04:00
|
|
|
|
2013-01-27 22:17:13 +04:00
|
|
|
;Installer Version Information
|
|
|
|
VIAddVersionKey "ProductName" "qBittorrent"
|
2013-07-02 00:17:37 +04:00
|
|
|
VIAddVersionKey "CompanyName" "The qBittorrent project"
|
2023-08-29 00:17:23 +03:00
|
|
|
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2023 The qBittorrent project"
|
2013-01-27 22:17:13 +04:00
|
|
|
VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
|
2022-10-02 02:11:17 +03:00
|
|
|
VIAddVersionKey "FileVersion" "${QBT_VERSION}"
|
2013-01-27 22:17:13 +04:00
|
|
|
|
2022-10-02 04:11:46 +03:00
|
|
|
; VIProductVersion needs a 4 part version.
|
|
|
|
; If QBT_VERSION contains less than 4 parts then VersionCompleteXXXX, will extend it with zeroes.
|
|
|
|
${VersionCompleteXXXX} ${QBT_VERSION} VERSION_4_PART
|
|
|
|
VIProductVersion "${VERSION_4_PART}"
|
2013-01-27 22:17:13 +04:00
|
|
|
|
2017-04-04 00:32:40 +03:00
|
|
|
; The default installation directory. It changes depending if we install in the 64bit dir or not.
|
|
|
|
; A caveat of this is if a user has installed a 32bit version and then runs the 64bit installer
|
|
|
|
; (which in turn launches the 32bit uninstaller first) the value will still point to the 32bit location.
|
|
|
|
; The user has to manually uninstall the old version and THEN run the 64bit installer
|
2022-10-02 02:11:17 +03:00
|
|
|
!ifndef QBT_IS_X64
|
2017-04-04 00:32:40 +03:00
|
|
|
InstallDir $PROGRAMFILES32\qBittorrent
|
|
|
|
!else
|
|
|
|
InstallDir $PROGRAMFILES64\qBittorrent
|
|
|
|
!endif
|
2013-01-23 23:06:50 +04:00
|
|
|
|
2020-01-03 05:52:05 +03:00
|
|
|
; Registry key to check for directory (so if you install again, it will
|
2013-01-23 23:06:50 +04:00
|
|
|
; overwrite the old one automatically)
|
|
|
|
InstallDirRegKey HKLM Software\qbittorrent InstallLocation
|
|
|
|
|
|
|
|
; Request application privileges for Windows Vista
|
2014-07-28 20:29:51 +04:00
|
|
|
RequestExecutionLevel user
|
2013-01-23 23:06:50 +04:00
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;General Settings
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
!define MUI_HEADERIMAGE
|
|
|
|
!define MUI_COMPONENTSPAGE_NODESC
|
|
|
|
;!define MUI_ICON "qbittorrent.ico"
|
|
|
|
!define MUI_LICENSEPAGE_CHECKBOX
|
|
|
|
!define MUI_LANGDLL_ALLLANGUAGES
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Remember the unistaller/installer language
|
2020-01-03 05:52:05 +03:00
|
|
|
!define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
|
|
|
|
!define MUI_LANGDLL_REGISTRY_KEY "Software\qbittorrent"
|
2013-01-23 23:06:50 +04:00
|
|
|
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Installer Pages
|
|
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
|
|
!insertmacro MUI_PAGE_LICENSE "license.txt"
|
|
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
2013-02-02 04:39:08 +04:00
|
|
|
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE check_instance
|
2013-01-23 23:06:50 +04:00
|
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
2013-01-27 22:59:08 +04:00
|
|
|
!insertmacro MUI_PAGE_FINISH
|
2013-01-23 23:06:50 +04:00
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Uninstaller Pages
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
2013-01-28 02:44:51 +04:00
|
|
|
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.check_instance
|
2013-01-23 23:06:50 +04:00
|
|
|
!insertmacro MUI_UNPAGE_COMPONENTS
|
|
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
|
|
|
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
2013-06-30 15:43:23 +04:00
|
|
|
ReserveFile "${NSISDIR}\Plugins\x86-unicode\FindProcDLL.dll"
|
2014-07-28 20:29:51 +04:00
|
|
|
ReserveFile "${NSISDIR}\Plugins\x86-unicode\UAC.dll"
|
|
|
|
|
|
|
|
!macro Init thing
|
|
|
|
uac_tryagain:
|
|
|
|
!insertmacro UAC_RunElevated
|
|
|
|
${Switch} $0
|
|
|
|
${Case} 0
|
|
|
|
${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
|
|
|
|
${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
|
|
|
|
${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
|
|
|
|
MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0
|
|
|
|
${EndIf}
|
|
|
|
;fall-through and die
|
|
|
|
${Case} 1223
|
|
|
|
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, aborting!"
|
|
|
|
Quit
|
|
|
|
${Case} 1062
|
|
|
|
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!"
|
|
|
|
Quit
|
|
|
|
${Default}
|
|
|
|
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate , error $0"
|
|
|
|
Quit
|
|
|
|
${EndSwitch}
|
|
|
|
|
|
|
|
SetShellVarContext all
|
|
|
|
!macroend
|