Subversion Repositories DevTools

Rev

Rev 1141 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1139 dpurdie 1
;-------------------------------------------------------------------------------
2
;
3
;   Example of a NSIS basis Windows Installer suitable for use within the
4
;    Vix-ERG PCC environment
5
;
6
;   This is an example of how things can be done
7
;   It includes a lot of excess documentation that can be removed
8
;
9
;--------------------------------
10
;   Include Modern UI
11
;   Provides an Installer that is similar to many other Windows-XP installers
12
!include "MUI2.nsh"
13
 
14
;--------------------------------
15
;   General
16
;   Specify basic settings
17
;
18
;   Name            - Already set based on package name and version
19
;   BrandingText    - Already set
20
;   Caption         - Already set
21
 
22
;   FileDescription
23
;       Will be available when the user selects the properties
24
;       of the installer. All other properties have been set based the
25
;       package name and version.    
26
;                       
27
VIAddVersionKey "FileDescription" "This is a example file description"
28
 
29
;   Default installation folder
30
;       Existing ERG Apps are installed into c:\AFC\${GBE_PACKAGE}
31
;       $DESKTOP\${GBE_PACKAGE} - can be useful
32
;       $PROGRAMFILES\ERG\${GBE_PACKAGE} - could be good too
33
;   
34
InstallDir c:\AFC\${GBE_PACKAGE}
35
 
36
;   Get installation folder from registry if available
37
!define InstallDirReg "Software\ERG\${GBE_PACKAGE}"
38
InstallDirRegKey HKCU ${InstallDirReg} ""
39
 
40
;   Request application privileges for Windows Vista
41
RequestExecutionLevel user
42
 
43
;   Program Group for Shortcuts
44
!define ProgramGroupBase "ERG"
45
!define ProgramGroup "${ProgramGroupBase}\${GBE_PACKAGE}"
46
 
47
;--------------------------------
48
;   Modern Interface Settings
49
 
50
#!define MUI_ABORTWARNING
51
 !define MUI_ICON                       "${GBE_NSISDATA}\VixIcon.ico"
52
 !define MUI_UNICON                     "${GBE_NSISDATA}\VixIcon.ico"
53
 !define MUI_HEADERIMAGE
54
 !define MUI_HEADERIMAGE_BITMAP         "${GBE_NSISDATA}\VixHeader.bmp"
55
 !define MUI_WELCOMEFINISHPAGE_BITMAP   "${GBE_NSISDATA}\VixPanel.bmp"
56
 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${GBE_NSISDATA}\VixPanel.bmp"
57
 !define MUI_FINISHPAGE_NOAUTOCLOSE
58
 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
59
 !define MUI_WELCOMEPAGE_TITLE_3LINES
60
 !define MUI_FINISHPAGE_TITLE_3LINES
61
 
62
;--------------------------------
63
;   Pages
64
;   List of Pages for the Modern UI to show
65
 
66
 !insertmacro MUI_PAGE_WELCOME
67
#!insertmacro MUI_PAGE_LICENSE "${GBE_NSISDATA}\license.txt"
68
#!insertmacro MUI_PAGE_COMPONENTS
69
#!insertmacro MUI_PAGE_DIRECTORY
70
 !insertmacro MUI_PAGE_INSTFILES
71
#!insertmacro MUI_PAGE_FINISH
72
 
73
#!insertmacro MUI_UNPAGE_WELCOME
74
 !insertmacro MUI_UNPAGE_CONFIRM
75
#!insertmacro MUI_UNPAGE_COMPONENTS
76
 !insertmacro MUI_UNPAGE_INSTFILES
77
#!insertmacro MUI_UNPAGE_FINISH
78
 
79
;--------------------------------
80
;   Languages
81
;   System will select default language
82
 
83
  !insertmacro MUI_LANGUAGE "English"
84
  !insertmacro MUI_LANGUAGE "French"
85
#  !insertmacro MUI_LANGUAGE "Swedish"
86
 
87
;--------------------------------
88
;   Allow user to select the language
89
;   By default the system will select the 'system' language
90
;   Uncomment the following lines and th user can select
91
;   the installation laguage.
92
#Function .onInit 
93
#    !insertmacro MUI_LANGDLL_DISPLAY 
94
#FunctionEnd
95
 
96
#Function un.onInit 
97
#    !insertmacro MUI_LANGDLL_DISPLAY 
98
#FunctionEnd
99
 
100
;--------------------------------
101
;   Installer Sections
102
;   Each section will show up as a 'component', if that page is shown
103
;
104
Section "Application" SecDummy
105
 
106
    SetOutPath "$INSTDIR"
107
 
108
    ; Install a program
109
    CreateDirectory "$INSTDIR\bin"
110
    SetOutPath "$INSTDIR\bin"
111
    File "${GBE_INTERFACE}\bin\WIN32P\AT91load.exe"
112
 
113
    ; Create a Short Cut
114
    SetShellVarContext all
115
    CreateDirectory "$SMPROGRAMS\${ProgramGroup}"
116
    CreateShortCut  "$SMPROGRAMS\${ProgramGroup}\AT91load.lnk"  "$INSTDIR\bin\AT91load.exe"
117
    CreateShortCut  "$SMPROGRAMS\${ProgramGroup}\UnInstall ${GBE_PACKAGE}.lnk" "$INSTDIR\Uninstall.exe"
118
 
119
    ; Create a Desktop Icon     
120
    CreateShortCut "$DESKTOP\AT91load.lnk" "$INSTDIR\bin\AT91load.exe"
121
 
122
    ; Install a data file
123
    CreateDirectory $INSTDIR\data
124
    SetOutPath "$INSTDIR\data"
125
    File /oname=datafile.txt example.nsi
126
 
127
SectionEnd
128
 
129
;--------------------------------
130
;   Uninstaller Sections
131
;   Un Installer for files installed by the user
132
;
133
Section "un.Application"
134
  ;
135
  ; Remove the data file
136
  Delete "$INSTDIR\data\datafile.txt"
137
  RMDir  "$INSTDIR\data"
138
 
139
  ; Remove the program
140
  RMDir /r "$INSTDIR\bin"
141
 
142
  ; Remove the shortcuts
143
  SetShellVarContext all
144
  Delete "$DESKTOP\AT91load.lnk"
145
  RMDir /r "$SMPROGRAMS\${ProgramGroup}"
146
  RMDir "$SMPROGRAMS\${ProgramGroupBase}"
147
 
148
SectionEnd
149
 
150
;--------------------------------
151
;   Section to create the Core of the Uninstaller
152
;   This will be hidden
153
;
154
Section "-Core"
155
 
156
    ;Store installation folder
157
    WriteRegStr HKCU ${InstallDirReg} "" $INSTDIR
158
 
159
    ;Create uninstaller and copy it into the install directory
160
    SetOutPath "$INSTDIR"
161
    WriteUninstaller "$INSTDIR\Uninstall.exe"
162
 
163
    ; Write the uninstall keys for Windows so that the package is seen in the
164
    ; Add/Remove Program section of the Control Panel.
165
    ;     Create a 'unique' key in the windows registry
166
    ;     Base it on the package name
167
    ;         Could use a GUID but it MUST NOT be copied if this file is copied
168
    ;
169
    !define UnInstallKeyBase "Software\Microsoft\Windows\CurrentVersion\Uninstall"
170
    !define UnInstallKey "${UnInstallKeyBase}\${GBE_PACKAGE}"
171
 
172
    WriteRegStr HKLM ${UnInstallKey} "DisplayName" ${GBE_PACKAGE}
173
    WriteRegStr HKLM ${UnInstallKey} "UninstallString" '"$INSTDIR\uninstall.exe"'
174
    WriteRegDWORD HKLM ${UnInstallKey} "NoModify" 1
175
    WriteRegDWORD HKLM ${UnInstallKey} "NoRepair" 1
176
 
177
SectionEnd
178
 
179
;--------------------------------
180
;   Uninistaller section to uninstall keys
181
;   That have been installed as a part of the core installer
182
;
183
Section "-un.Core"
184
 
185
  ; Delete the uninstaller and then the containing directory
186
  ; The directory will only be removed if its empty  
187
  Delete "$INSTDIR\Uninstall.exe"
188
  RMDir "$INSTDIR"
189
 
190
  ; Remove the programs registry key
191
  ;     Keep around for next time
192
  ; DeleteRegKey /ifempty HKCU ${InstallDirReg}
193
 
194
  ; Remove Uninstaller registry keys
195
  DeleteRegKey HKLM ${UnInstallKey}
196
 
197
SectionEnd
198