GumTree Installer Notes_136675359 - Gumtree/gumtree GitHub Wiki
Created by Tony Lam, last modified on Dec 17, 2009
This page describes some notes on the GumTree NSIS installer.
The technology we use for creating installers is called NSIS. It is free and provides a nice development environment under Eclipse (EclipseNSIS).
The installation strategies are follow:
You can use the EclipseNSIS template dialog to help you to create the basis of above script, but you need to modify and add the following code:
When compile, you need to addtional symbols:
The installer generation is automated in the CruiseControl build system. The automation needs to go through the following steps:
It makes the installer to use Bragg's setting to launch GumTree.
- Copy complete instrument specific artefacts to the install directory
- Create shortcut on desktop and start menu
- Replace <instrument>.ini depending on installation type
Name "GumTree ${INSTRUMENT_LABEL}"
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION ${APP_VERSION}
!define COMPANY ANSTO
!define URL http://gumtree.codehaus.org
# MUI Symbol Definitions
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-full.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER GumTree
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
# Included files
!include "FileFunc.nsh"
!include Sections.nsh
!include MUI2.nsh
# Variables
Var StartMenuGroup
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile ${INSTRUMENT_LABEL}Setup_${VERSION}.exe
InstallDir $PROGRAMFILES\GumTree\${INSTRUMENT}
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion ${APP_VERSION}.0
VIAddVersionKey ProductName "GumTree ${INSTRUMENT_LABEL}"
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
VIAddVersionKey CompanyWebsite "${URL}"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey FileDescription ""
VIAddVersionKey LegalCopyright ""
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show
# Installer sections
Section -Main SEC0000
SetOutPath $INSTDIR
SetOverwrite on
File /r ${SOURCE}\${INSTRUMENT}\*
CreateShortcut "$INSTDIR\${INSTRUMENT_LABEL} ${VERSION}.lnk" $INSTDIR\${INSTRUMENT}.exe
# Grant access
AccessControl::GrantOnFile $INSTDIR "BUILTIN\USERS" "FullAccess"
WriteRegStr HKLM "${REGKEY}\Components" Main 1
SectionEnd
Section -post SEC0001
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
# For all users
SetShellVarContext all
SetOutPath $SMPROGRAMS\$StartMenuGroup
CopyFiles "$INSTDIR\${INSTRUMENT_LABEL} ${VERSION}.lnk" "$DESKTOP\${INSTRUMENT_LABEL} ${VERSION}.lnk"
CopyFiles "$INSTDIR\${INSTRUMENT_LABEL} ${VERSION}.lnk" "$SMPROGRAMS\$StartMenuGroup\${INSTRUMENT_LABEL} ${VERSION}.lnk"
Delete "$INSTDIR\${INSTRUMENT_LABEL} ${VERSION}.lnk"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
# Replace .ini file based on type
${GetOptions} $CMDLINE "-type" $R0
CopyFiles $INSTDIR\ini\${INSTRUMENT}.$R0.ini $INSTDIR\${INSTRUMENT}.ini
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
# Uninstaller sections
Section /o -un.Main UNSEC0000
RmDir /r /REBOOTOK $INSTDIR
DeleteRegValue HKLM "${REGKEY}\Components" Main
SectionEnd
Section -un.post UNSEC0001
# For all users
SetShellVarContext all
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\${INSTRUMENT_LABEL} ${VERSION}.lnk"
Delete /REBOOTOK $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
Delete /REBOOTOK "$DESKTOP\${INSTRUMENT_LABEL} ${VERSION}.lnk"
DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
DeleteRegValue HKLM "${REGKEY}" Path
DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKLM "${REGKEY}"
RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
RmDir /REBOOTOK $INSTDIR
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
FunctionEnd
# Uninstaller functions
Function un.onInit
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd
Global:
(M) Name "GumTree ${INSTRUMENT_LABEL}"
General Symbol Definitions:
(M) !define VERSION ${APP_VERSION}
Included files:
(A) !include "FileFunc.nsh"
Installer attributes:
(M) OutFile ${INSTRUMENT_LABEL}Setup_${VERSION}.exe
(M) InstallDir $PROGRAMFILES\GumTree\${INSTRUMENT}
Installer attributes:
(M) VIProductVersion ${APP_VERSION}.0
(M) VIAddVersionKey ProductName "GumTree ${INSTRUMENT_LABEL}"
Section -Main:
(M) File /r ${SOURCE}\${INSTRUMENT}\*
(A) CreateShortcut "$INSTDIR\${INSTRUMENT_LABEL} ${VERSION}.lnk" $INSTDIR\${INSTRUMENT}.exe
(A) # Grant access
(A) AccessControl::GrantOnFile $INSTDIR "BUILTIN\USERS" "FullAccess"
Section -post:
(M) WriteUninstaller $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
(A) # For all users
(A) SetShellVarContext all
(A) CopyFiles "$INSTDIR\${INSTRUMENT_LABEL} ${VERSION}.lnk" "$DESKTOP\${INSTRUMENT_LABEL} ${VERSION}.lnk"
(A) CopyFiles "$INSTDIR\${INSTRUMENT_LABEL} ${VERSION}.lnk" "$SMPROGRAMS\$StartMenuGroup\${INSTRUMENT_LABEL} ${VERSION}.lnk"
(A) Delete "$INSTDIR\${INSTRUMENT_LABEL} ${VERSION}.lnk"
(M) CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
(A) # Replace .ini file based on type
(A) ${GetOptions} $CMDLINE "-type" $R0
(A) CopyFiles $INSTDIR\ini\${INSTRUMENT}.$R0.ini $INSTDIR\${INSTRUMENT}.ini
(M) WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
(M) WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
Uninstaller sections:
(A) # For all users
(A) SetShellVarContext all
(M) Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\${INSTRUMENT_LABEL} ${VERSION}.lnk"
(A) Delete /REBOOTOK $INSTDIR\${INSTRUMENT_LABEL}Uninstall.exe
(A) Delete /REBOOTOK "$DESKTOP\${INSTRUMENT_LABEL} ${VERSION}.lnk"
| INSTRUMENT | quokka |
| INSTRUMENT_LABEL | Quokka |
| APP_VERSION | 1.4.1 |
| SOURCE | X:\gumtree\releases\apps |
- Clean "export" folder and use it as the temporary space
- Copy all necessary artifacts
- Copy the generic GumTree runtime except the .exe and .ini file (ie configuration, features, p2, plugins, artifacts.xml)
- Copy instrument specific artifacts (ie ini, xxx.exe, xxx.ini, splash.bmp)
- Copy GumTree common features
- Copy instrument specific feature
- Copy properties and scripts
- Run makensis to compile nsi script
- Create custom batch for running the installer in different mode
- Clear all temporary files except the installers and batches
- Repeat Step 1 - 5 for all instruments
- Copy all installers and batches to the CruiseControl artifacts folder
EchidnaSetup_1.4.1.exe -type bragg
Document generated by Confluence on Apr 01, 2015 00:11