274 lines
No EOL
6.7 KiB
Text
274 lines
No EOL
6.7 KiB
Text
!include LogicLib.nsh
|
|
!include x64.nsh
|
|
|
|
!define setup $%INSTALLER_NAME%
|
|
!define srcdir $%INSTALLER_SOURCE_DIR%
|
|
!define scriptsdir $%INSTALLER_SCRIPTS_DIR%
|
|
!define company "High Fidelity"
|
|
!define prodname "Interface"
|
|
!define exec "interface.exe"
|
|
!define icon "interface.ico"
|
|
!define regkey "Software\${company}\${prodname}"
|
|
!define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"
|
|
!define install_dir_company "$PROGRAMFILES\${company}"
|
|
!define install_dir_product "${install_dir_company}\${prodname}"
|
|
!define startmenu_company "$SMPROGRAMS\${company}"
|
|
!define startmenu_product "${startmenu_company}\${prodname}"
|
|
!define uninstaller "uninstall.exe"
|
|
|
|
;--------------------------------
|
|
|
|
XPStyle on
|
|
ShowInstDetails hide
|
|
ShowUninstDetails hide
|
|
|
|
Name "${prodname}"
|
|
Caption "${prodname}"
|
|
|
|
!ifdef icon
|
|
Icon "${icon}"
|
|
!endif
|
|
|
|
OutFile "${setup}"
|
|
|
|
SetDateSave on
|
|
SetDatablockOptimize on
|
|
CRCCheck on
|
|
SilentInstall normal
|
|
|
|
InstallDir "${install_dir_product}"
|
|
InstallDirRegKey HKLM "${regkey}" ""
|
|
|
|
!ifdef licensefile
|
|
LicenseText "License"
|
|
LicenseData "${srcdir}\${licensefile}"
|
|
!endif
|
|
|
|
; pages
|
|
; we keep it simple - leave out selectable installation types
|
|
|
|
!ifdef licensefile
|
|
Page license
|
|
!endif
|
|
|
|
; Page components
|
|
Page directory
|
|
Page instfiles
|
|
|
|
UninstPage uninstConfirm
|
|
UninstPage instfiles
|
|
|
|
;--------------------------------
|
|
|
|
AutoCloseWindow true
|
|
ShowInstDetails show
|
|
|
|
|
|
!ifdef screenimage
|
|
|
|
; set up background image
|
|
; uses BgImage plugin
|
|
|
|
Function .onGUIInit
|
|
; extract background BMP into temp plugin directory
|
|
InitPluginsDir
|
|
File /oname=$PLUGINSDIR\1.bmp "${screenimage}"
|
|
|
|
BgImage::SetBg /NOUNLOAD /FILLSCREEN $PLUGINSDIR\1.bmp
|
|
BgImage::Redraw /NOUNLOAD
|
|
FunctionEnd
|
|
|
|
Function .onGUIEnd
|
|
; Destroy must not have /NOUNLOAD so NSIS will be able to unload and delete BgImage before it exits
|
|
BgImage::Destroy
|
|
FunctionEnd
|
|
|
|
!endif
|
|
|
|
; beginning (invisible) section
|
|
Section
|
|
|
|
WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
|
|
; write uninstall strings
|
|
WriteRegStr HKLM "${uninstkey}" "DisplayName" "${prodname} (remove only)"
|
|
WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'
|
|
|
|
!ifdef filetype
|
|
WriteRegStr HKCR "${filetype}" "" "${prodname}"
|
|
!endif
|
|
|
|
WriteRegStr HKCR "${prodname}\Shell\open\command\" "" '"$INSTDIR\${exec} "%1"'
|
|
|
|
!ifdef icon
|
|
WriteRegStr HKCR "${prodname}\DefaultIcon" "" "$INSTDIR\${icon}"
|
|
!endif
|
|
|
|
WriteRegStr HKCR 'hifi' '' 'URL:Alert Protocol'
|
|
WriteRegStr HKCR 'hifi' 'URL Protocol' ''
|
|
WriteRegStr HKCR 'hifi\DefaultIcon' '' '$INSTDIR\${icon},1'
|
|
WriteRegStr HKCR 'hifi\shell\open\command' '' '$INSTDIR\${exec} --url "%1"'
|
|
|
|
SetOutPath $INSTDIR
|
|
|
|
; package all files, recursively, preserving attributes
|
|
; assume files are in the correct places
|
|
File /r "${srcdir}\"
|
|
|
|
!ifdef licensefile
|
|
File /a "${srcdir}\${licensefile}"
|
|
!endif
|
|
|
|
!ifdef notefile
|
|
File /a "${srcdir}\${notefile}"
|
|
!endif
|
|
|
|
!ifdef icon
|
|
File /a "${srcdir}\${icon}"
|
|
!endif
|
|
|
|
; any application-specific files
|
|
!ifdef files
|
|
!include "${files}"
|
|
!endif
|
|
|
|
SetOutPath "$DOCUMENTS\${company}\Scripts"
|
|
File /r "${scriptsdir}\"
|
|
|
|
SetOutPath $INSTDIR
|
|
WriteUninstaller "${uninstaller}"
|
|
|
|
; Check for 2013 redistributable
|
|
Call CheckRedistributable2013Installed
|
|
Pop $R1
|
|
|
|
${If} $R1 == "Error"
|
|
ExecWait '"$INSTDIR\2013_vcredist_x86.exe" /passive /norestart'
|
|
${EndIf}
|
|
|
|
; Check for 2010 redistributable
|
|
Call CheckRedistributable2010Installed
|
|
Pop $R1
|
|
|
|
${If} $R1 == "Error"
|
|
ExecWait '"$INSTDIR\2010_vcredist_x86.exe" /passive /norestart'
|
|
${EndIf}
|
|
SectionEnd
|
|
|
|
; create shortcuts
|
|
Section
|
|
|
|
; This should install the shortcuts for "All Users"
|
|
SetShellVarContext all
|
|
CreateDirectory "${startmenu_product}"
|
|
SetOutPath $INSTDIR ; for working directory
|
|
!ifdef icon
|
|
CreateShortCut "${startmenu_product}\${prodname}.lnk" "$INSTDIR\${exec}" "" "$INSTDIR\${icon}"
|
|
!else
|
|
CreateShortCut "${startmenu_product}\${prodname}.lnk" "$INSTDIR\${exec}"
|
|
!endif
|
|
|
|
CreateShortCut "${startmenu_product}\Uninstall ${prodname}.lnk" "$INSTDIR\${uninstaller}"
|
|
|
|
!ifdef notefile
|
|
CreateShortCut "${startmenu_product}\Release Notes.lnk" "$INSTDIR\${notefile}"
|
|
!endif
|
|
|
|
!ifdef helpfile
|
|
CreateShortCut "${startmenu_product}\Documentation.lnk" "$INSTDIR\${helpfile}"
|
|
!endif
|
|
|
|
!ifdef website
|
|
WriteINIStr "${startmenu_product}\web site.url" "InternetShortcut" "URL" ${website}
|
|
; CreateShortCut "${startmenu_product}\Web Site.lnk" "${website}" "URL"
|
|
!endif
|
|
|
|
!ifdef notefile
|
|
ExecShell "open" "$INSTDIR\${notefile}"
|
|
!endif
|
|
|
|
SectionEnd
|
|
|
|
; Uninstaller
|
|
; All section names prefixed by "Un" will be in the uninstaller
|
|
|
|
UninstallText "This will uninstall ${prodname}."
|
|
|
|
!ifdef icon
|
|
UninstallIcon "${icon}"
|
|
!endif
|
|
|
|
Section "Uninstall"
|
|
|
|
; Explicitly remove all added shortcuts
|
|
SetShellVarContext all
|
|
DELETE "${startmenu_product}\${prodname}.lnk"
|
|
DELETE "${startmenu_product}\Uninstall ${prodname}.lnk"
|
|
|
|
!ifdef notefile
|
|
DELETE "${startmenu_product}\Release Notes.lnk"
|
|
!endif
|
|
|
|
!ifdef helpfile
|
|
DELETE "${startmenu_product}\Documentation.lnk"
|
|
!endif
|
|
|
|
RMDIR "${startmenu_product}"
|
|
; This should remove the High Fidelity folder in Start Menu if it's empty
|
|
RMDIR "${startmenu_company}"
|
|
|
|
RMDIR /r "$INSTDIR"
|
|
; This should remove the High Fidelity folder in Program Files if it's empty
|
|
RMDIR "${install_dir_company}"
|
|
|
|
!ifdef unfiles
|
|
!include "${unfiles}"
|
|
!endif
|
|
|
|
; It's good practice to put the registry key removal at the very end
|
|
DeleteRegKey HKLM "${uninstkey}"
|
|
DeleteRegKey HKLM "${regkey}"
|
|
DeleteRegKey HKCR 'hifi'
|
|
|
|
SectionEnd
|
|
|
|
Function CheckRedistributable2013Installed
|
|
Push $R1
|
|
ClearErrors
|
|
|
|
${If} ${RunningX64}
|
|
ReadRegDword $R1 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\VC\Runtimes\x86" "Installed"
|
|
${Else}
|
|
ReadRegDword $R1 HKLM "SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x86" "Installed"
|
|
${EndIf}
|
|
|
|
;was there error or not?
|
|
IfErrors 0 NoErrors
|
|
|
|
;error occured, copy "Error" to R1
|
|
StrCpy $R1 "Error"
|
|
|
|
NoErrors:
|
|
|
|
Exch $R1
|
|
FunctionEnd
|
|
|
|
Function CheckRedistributable2010Installed
|
|
Push $R1
|
|
ClearErrors
|
|
|
|
${If} ${RunningX64}
|
|
ReadRegDword $R1 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x64" "Installed"
|
|
${Else}
|
|
ReadRegDword $R1 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" "Installed"
|
|
${EndIf}
|
|
|
|
;was there error or not?
|
|
IfErrors 0 NoErrors
|
|
|
|
;error occured, copy "Error" to R1
|
|
StrCpy $R1 "Error"
|
|
|
|
NoErrors:
|
|
|
|
Exch $R1
|
|
FunctionEnd |