;------------------------------------------------------------------------------- ; ; Example of a NSIS basis Windows Installer suitable for use within the ; Vix-ERG environment ; ; This is an example of how things can be done ; It includes a lot of excess documentation that can be removed ; ;-------------------------------- ; Include Modern UI ; Provides an Installer that is similar to many other Windows-XP installers !include "MUI2.nsh" ;-------------------------------- ; General ; Specify basic settings ; ; Name - Already set based on package name and version ; BrandingText - Already set ; Caption - Already set ; FileDescription ; Will be available when the user selects the properties ; of the installer. All other properties have been set based the ; package name and version. ; VIAddVersionKey "FileDescription" "Texas Instruments MSP430 Compiler" ; Default installation folder ; Existing ERG Apps are installed into c:\AFC\${GBE_PACKAGE} ; $DESKTOP\${GBE_PACKAGE} - can be useful ; $PROGRAMFILES\Vix-ERG\${GBE_PACKAGE} - could be good too ; InstallDir "c:\Texas Instruments" ; Get installation folder from registry if available !define InstallDirReg "Software\Vix\${GBE_PACKAGE}" InstallDirRegKey HKCU ${InstallDirReg} "" ; Request application privileges for Windows Vista RequestExecutionLevel user ;-------------------------------- ; Modern Interface Settings #!define MUI_ABORTWARNING !define MUI_ICON "${GBE_NSISDATA}\VixIcon.ico" !define MUI_UNICON "${GBE_NSISDATA}\VixIcon.ico" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "${GBE_NSISDATA}\VixHeader.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "${GBE_NSISDATA}\VixPanel.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${GBE_NSISDATA}\VixPanel.bmp" !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_UNFINISHPAGE_NOAUTOCLOSE !define MUI_WELCOMEPAGE_TITLE_3LINES !define MUI_FINISHPAGE_TITLE_3LINES ;-------------------------------- ; Pages ; List of Pages for the Modern UI to show !insertmacro MUI_PAGE_WELCOME #!insertmacro MUI_PAGE_LICENSE "${GBE_NSISDATA}\license.txt" #!insertmacro MUI_PAGE_COMPONENTS #!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES #!insertmacro MUI_PAGE_FINISH #!insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM #!insertmacro MUI_UNPAGE_COMPONENTS !insertmacro MUI_UNPAGE_INSTFILES #!insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ; Languages ; System will select default language !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "French" # !insertmacro MUI_LANGUAGE "Swedish" ;-------------------------------- ; Allow user to select the language #Function .onInit # !insertmacro MUI_LANGDLL_DISPLAY #FunctionEnd #Function un.onInit # !insertmacro MUI_LANGDLL_DISPLAY #FunctionEnd ;-------------------------------- ; Installer Sections ; Each section will show up as a 'component', if that page is shown ; Section "Application" SecDummy SetOutPath "$INSTDIR" File /r ccsv4 SectionEnd ;-------------------------------- ;Uninstaller Sections ; Un Installer for files installed by the user ; Section "un.Application" ; RMDir /r "$INSTDIR\ccsv4" RMDir "$INSTDIR" SectionEnd ;-------------------------------- ; Section to create the Core of the Uninstaller ; This will be hidden Section "-Core" ;Store installation folder WriteRegStr HKCU ${InstallDirReg} "" $INSTDIR ;Create uninstaller and copy it into the install directory SetOutPath "$INSTDIR" WriteUninstaller "$INSTDIR\Uninstall.exe" ; Write the uninstall keys for Windows so that the package is seen in the ; Add/Remove Program section of the Control Panel. ; Create a 'unique' key in the windows registry ; Base it on the package name ; Could use a GUID but it MUST NOT be copied if this file is copied ; !define UnInstallKeyBase "Software\Microsoft\Windows\CurrentVersion\Uninstall" !define UnInstallKey "${UnInstallKeyBase}\${GBE_PACKAGE}" WriteRegStr HKLM ${UnInstallKey} "DisplayName" ${GBE_PACKAGE} WriteRegStr HKLM ${UnInstallKey} "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD HKLM ${UnInstallKey} "NoModify" 1 WriteRegDWORD HKLM ${UnInstallKey} "NoRepair" 1 SectionEnd ;-------------------------------- ; Uninistaller section to uninstall keys ; That have been installed as a part of the core installer ; Section "-un.Core" ; Delete the uninstaller and then the containing directory ; The directory will only be removed if its empty Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" ; Remove the programs registry key ; Keep around for next time ; DeleteRegKey /ifempty HKCU ${InstallDirReg} ; Remove Uninstaller registry keys DeleteRegKey HKLM ${UnInstallKey} SectionEnd