Updated NSIS script to support Driver and 32/64 bit installation
This commit is contained in:
230
windows/qcma.nsi
230
windows/qcma.nsi
@@ -3,31 +3,32 @@
|
|||||||
### Includes
|
### Includes
|
||||||
!include LogicLib.nsh
|
!include LogicLib.nsh
|
||||||
!include MUI.nsh
|
!include MUI.nsh
|
||||||
|
!include x64.nsh
|
||||||
|
|
||||||
### General information
|
### General information
|
||||||
!define PRODUCT_NAME "qcma"
|
!define PRODUCT_NAME "Qcma"
|
||||||
!define PRODUCT_EXE_NAME "qcma.exe"
|
!define PRODUCT_EXE_NAME "qcma.exe"
|
||||||
!define PRODUCT_VERSION_MAJOR 0
|
!define PRODUCT_VERSION_MAJOR 0
|
||||||
!define PRODUCT_VERSION_MINOR 2
|
!define PRODUCT_VERSION_MINOR 3
|
||||||
!define PRODUCT_VERSION_BUILD 5
|
!define PRODUCT_VERSION_BUILD 0
|
||||||
!define PRODUCT_PUBLISHER "codestation"
|
!define PRODUCT_PUBLISHER "codestation"
|
||||||
!define PRODUCT_WEB_SITE "https://github.com/codestation/qcma"
|
!define PRODUCT_WEB_SITE "https://github.com/codestation/qcma"
|
||||||
!define PRODUCT_INSTALLSIZE 43811
|
!define HELPURL "https://github.com/xiannox/qcma/wiki"
|
||||||
|
|
||||||
### Macros
|
### Macros
|
||||||
!macro VerifyUserIsAdmin
|
!macro VerifyUserIsAdmin
|
||||||
UserInfo::GetAccountType
|
UserInfo::GetAccountType
|
||||||
pop $0
|
pop $0
|
||||||
${If} $0 != "admin" ;Require admin rights on NT4+
|
${If} $0 != "admin" ;Require admin rights on NT4+
|
||||||
MessageBox mb_iconstop "Administrator rights required!"
|
MessageBox mb_iconstop "Administrator rights required!"
|
||||||
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
|
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
|
||||||
Quit
|
Quit
|
||||||
${EndIf}
|
${EndIf}
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
Function finishPageRunFunction
|
Function finishPageRunFunction
|
||||||
ExecShell "" "$INSTDIR\${PRODUCT_EXE_NAME}"
|
ExecShell "" "$INSTDIR\${PRODUCT_EXE_NAME}"
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
### Variables
|
### Variables
|
||||||
@@ -43,7 +44,7 @@ RequestExecutionLevel admin
|
|||||||
|
|
||||||
# This will be in the installer/uninstaller title bar
|
# This will be in the installer/uninstaller title bar
|
||||||
Name "${PRODUCT_NAME}"
|
Name "${PRODUCT_NAME}"
|
||||||
OutFile "${PRODUCT_NAME}_setup.exe"
|
OutFile "${PRODUCT_NAME}_setup_${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_BUILD}.exe"
|
||||||
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
|
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
|
||||||
|
|
||||||
!define MUI_LANGDLL_ALLLANGUAGES
|
!define MUI_LANGDLL_ALLLANGUAGES
|
||||||
@@ -77,100 +78,161 @@ InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
|
|||||||
### Installer
|
### Installer
|
||||||
|
|
||||||
function .onInit
|
function .onInit
|
||||||
setShellVarContext all
|
|
||||||
!insertmacro VerifyUserIsAdmin
|
setShellVarContext all
|
||||||
!insertmacro MUI_LANGDLL_DISPLAY
|
!insertmacro VerifyUserIsAdmin
|
||||||
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
|
||||||
|
${If} ${RunningX64}
|
||||||
|
StrCpy $InstDir "$ProgramFiles64\${PRODUCT_NAME}"
|
||||||
|
SetRegView 64
|
||||||
|
${Else}
|
||||||
|
StrCpy $InstDir "$ProgramFiles32\${PRODUCT_NAME}"
|
||||||
|
${EndIf}
|
||||||
functionEnd
|
functionEnd
|
||||||
|
|
||||||
section "install"
|
section "install"
|
||||||
# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
|
# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $InstDir
|
||||||
# Files added here should be removed by the uninstaller (see section "uninstall")
|
|
||||||
File ${PRODUCT_EXE_NAME}
|
|
||||||
File "qcma.ico"
|
|
||||||
|
|
||||||
File "avcodec-55.dll"
|
# Files added here should be removed by the uninstaller (see section "uninstall")
|
||||||
File "avformat-55.dll"
|
|
||||||
File "avutil-52.dll"
|
|
||||||
File "iconv.dll"
|
|
||||||
File "libgcc_s_sjlj-1.dll"
|
|
||||||
File "libjpeg-62.dll"
|
|
||||||
File "libpcre16-0.dll"
|
|
||||||
File "libpng16-16.dll"
|
|
||||||
File "libstdc++-6.dll"
|
|
||||||
File "libtiff-5.dll"
|
|
||||||
File "libusb-1.0.dll"
|
|
||||||
File "libvitamtp-2.dll"
|
|
||||||
File "libwinpthread-1.dll"
|
|
||||||
File "libxml2-2.dll"
|
|
||||||
File "Qt5Core.dll"
|
|
||||||
File "Qt5Gui.dll"
|
|
||||||
File "Qt5Network.dll"
|
|
||||||
File "Qt5Widgets.dll"
|
|
||||||
File "swscale-2.dll"
|
|
||||||
File "zlib1.dll"
|
|
||||||
|
|
||||||
SetOutPath "$INSTDIR\platforms"
|
${If} ${RunningX64}
|
||||||
File "platforms\qwindows.dll"
|
File "win_x86_64\qcma.exe"
|
||||||
|
File "win_x86_64\qcma_console.exe"
|
||||||
|
File "win_x86_64\avcodec-55.dll"
|
||||||
|
File "win_x86_64\avformat-55.dll"
|
||||||
|
File "win_x86_64\avutil-52.dll"
|
||||||
|
File "win_x86_64\iconv.dll"
|
||||||
|
File "win_x86_64\libgcc_s_seh-1.dll"
|
||||||
|
File "win_x86_64\libiconv-2.dll"
|
||||||
|
File "win_x86_64\libjpeg-62.dll"
|
||||||
|
File "win_x86_64\libpcre16-0.dll"
|
||||||
|
File "win_x86_64\libpng16-16.dll"
|
||||||
|
File "win_x86_64\libsqlite3-0.dll"
|
||||||
|
File "win_x86_64\libstdc++-6.dll"
|
||||||
|
File "win_x86_64\libtiff-5.dll"
|
||||||
|
File "win_x86_64\libusb-1.0.dll"
|
||||||
|
File "win_x86_64\libvitamtp-3.dll"
|
||||||
|
File "win_x86_64\libwinpthread-1.dll"
|
||||||
|
File "win_x86_64\libxml2-2.dll"
|
||||||
|
File "win_x86_64\Qt5Core.dll"
|
||||||
|
File "win_x86_64\Qt5Gui.dll"
|
||||||
|
File "win_x86_64\Qt5Network.dll"
|
||||||
|
File "win_x86_64\Qt5Sql.dll"
|
||||||
|
File "win_x86_64\Qt5Widgets.dll"
|
||||||
|
File "win_x86_64\swscale-2.dll"
|
||||||
|
File "win_x86_64\zlib1.dll"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR\imageformats"
|
SetOutPath "$INSTDIR\platforms"
|
||||||
File "imageformats\qgif.dll"
|
File "win_x86_64\platforms\qwindows.dll"
|
||||||
File "imageformats\qjpeg.dll"
|
|
||||||
File "imageformats\qtiff.dll"
|
|
||||||
|
|
||||||
# Uninstaller - See function un.onInit and section "uninstall" for configuration
|
SetOutPath "$INSTDIR\imageformats"
|
||||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
File "win_x86_64\imageformats\qgif.dll"
|
||||||
|
File "win_x86_64\imageformats\qjpeg.dll"
|
||||||
|
File "win_x86_64\imageformats\qtiff.dll"
|
||||||
|
|
||||||
# Start Menu
|
SetOutPath "$INSTDIR\sqldrivers"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
File "win_x86_64\sqldrivers\qsqlite.dll"
|
||||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
${Else}
|
||||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_EXE_NAME}"
|
File "win_i686\qcma.exe"
|
||||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\uninstall.exe"
|
File "win_i686\qcma_console.exe"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_END
|
File "win_i686\avcodec-55.dll"
|
||||||
|
File "win_i686\avformat-55.dll"
|
||||||
|
File "win_i686\avutil-52.dll"
|
||||||
|
File "win_i686\iconv.dll"
|
||||||
|
File "win_i686\libgcc_s_sjlj-1.dll"
|
||||||
|
File "win_i686\libiconv-2.dll"
|
||||||
|
File "win_i686\libjpeg-62.dll"
|
||||||
|
File "win_i686\libpcre16-0.dll"
|
||||||
|
File "win_i686\libpng16-16.dll"
|
||||||
|
File "win_i686\libsqlite3-0.dll"
|
||||||
|
File "win_i686\libstdc++-6.dll"
|
||||||
|
File "win_i686\libtiff-5.dll"
|
||||||
|
File "win_i686\libusb-1.0.dll"
|
||||||
|
File "win_i686\libvitamtp-3.dll"
|
||||||
|
File "win_i686\libwinpthread-1.dll"
|
||||||
|
File "win_i686\libxml2-2.dll"
|
||||||
|
File "win_i686\Qt5Core.dll"
|
||||||
|
File "win_i686\Qt5Gui.dll"
|
||||||
|
File "win_i686\Qt5Sql.dll"
|
||||||
|
File "win_i686\Qt5Network.dll"
|
||||||
|
File "win_i686\Qt5Widgets.dll"
|
||||||
|
File "win_i686\swscale-2.dll"
|
||||||
|
File "win_i686\zlib1.dll"
|
||||||
|
|
||||||
# Registry information for add/remove programs
|
SetOutPath "$INSTDIR\platforms"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME}"
|
File "win_i686\platforms\qwindows.dll"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
SetOutPath "$INSTDIR\imageformats"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "InstallLocation" "$\"$INSTDIR$\""
|
File "win_i686\imageformats\qgif.dll"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$\"$INSTDIR\qcma.ico$\""
|
File "win_i686\imageformats\qjpeg.dll"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "${PRODUCT_PUBLISHER}"
|
File "win_i686\imageformats\qtiff.dll"
|
||||||
#WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "HelpLink" "$\"${HELPURL}$\""
|
|
||||||
#WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
|
SetOutPath "$INSTDIR\sqldrivers"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "URLInfoAbout" "$\"${PRODUCT_WEB_SITE}$\""
|
File "win_i686\sqldrivers\qsqlite.dll"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_BUILD}"
|
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "VersionMajor" ${PRODUCT_VERSION_MAJOR}
|
${EndIf}
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "VersionMinor" ${PRODUCT_VERSION_MINOR}
|
|
||||||
# There is no option for modifying or repairing the install
|
# Uninstaller - See function un.onInit and section "uninstall" for configuration
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoModify" 1
|
WriteUninstaller "$InstDir\uninstall.exe"
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoRepair" 1
|
|
||||||
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
|
SetOutPath $InstDir
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "EstimatedSize" ${PRODUCT_INSTALLSIZE}
|
|
||||||
|
# Start Menu
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||||
|
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||||
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_EXE_NAME}"
|
||||||
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\uninstall.exe"
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
|
||||||
|
# Registry information for add/remove programs
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME}"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "InstallLocation" "$\"$INSTDIR$\""
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$\"$INSTDIR\qcma.ico$\""
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "${PRODUCT_PUBLISHER}"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "HelpLink" "$\"${HELPURL}$\""
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "URLInfoAbout" "$\"${PRODUCT_WEB_SITE}$\""
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_BUILD}"
|
||||||
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "VersionMajor" ${PRODUCT_VERSION_MAJOR}
|
||||||
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "VersionMinor" ${PRODUCT_VERSION_MINOR}
|
||||||
|
# There is no option for modifying or repairing the install
|
||||||
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoModify" 1
|
||||||
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoRepair" 1
|
||||||
|
sectionEnd
|
||||||
|
|
||||||
|
section "driver"
|
||||||
|
SetOutPath $InstDir\driver
|
||||||
|
File "QcmaDriver.exe"
|
||||||
|
DetailPrint "Starting the driver installation"
|
||||||
|
ExecWait "$InstDir\driver\QcmaDriver.exe"
|
||||||
sectionEnd
|
sectionEnd
|
||||||
|
|
||||||
### Uninstaller
|
### Uninstaller
|
||||||
|
|
||||||
function un.onInit
|
function un.onInit
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
!insertmacro VerifyUserIsAdmin
|
!insertmacro VerifyUserIsAdmin
|
||||||
!insertmacro MUI_LANGDLL_DISPLAY
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
functionEnd
|
functionEnd
|
||||||
|
|
||||||
section "uninstall"
|
section "uninstall"
|
||||||
|
|
||||||
# Remove Start Menu launcher
|
# Remove Start Menu launcher
|
||||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||||
Delete "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_NAME}.lnk"
|
Delete "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_NAME}.lnk"
|
||||||
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall ${PRODUCT_NAME}.lnk"
|
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall ${PRODUCT_NAME}.lnk"
|
||||||
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||||
|
|
||||||
# Remove Desktop launcher
|
# Remove Desktop launcher
|
||||||
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
|
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
|
||||||
|
|
||||||
# Recursively remove the contents of $INSTDIR, then $INSTDIR itself
|
# Recursively remove the contents of $INSTDIR, then $INSTDIR itself
|
||||||
RMDir /r "$INSTDIR"
|
RMDir /r "$INSTDIR"
|
||||||
RMDir "$INSTDIR"
|
RMDir "$INSTDIR"
|
||||||
|
|
||||||
# Remove uninstaller information from the registry
|
# Remove uninstaller information from the registry
|
||||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
||||||
sectionEnd
|
sectionEnd
|
Reference in New Issue
Block a user