Subversion Repositories DevTools

Rev

Rev 1141 | Details | Compare with Previous | 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
;   
1141 dpurdie 34
InstallDir C:\AFC\${GBE_PACKAGE}
1139 dpurdie 35
 
36
;   Get installation folder from registry if available
37
!define InstallDirReg "Software\ERG\${GBE_PACKAGE}"
38
InstallDirRegKey HKCU ${InstallDirReg} ""
39
 
1141 dpurdie 40
;   Request application privileges for Windows Vista/7
41
;   Need admin privileges to modify registry, otherwise use user
42
RequestExecutionLevel admin
1139 dpurdie 43
 
44
;   Program Group for Shortcuts
45
!define ProgramGroupBase "ERG"
46
!define ProgramGroup "${ProgramGroupBase}\${GBE_PACKAGE}"
47
 
48
;--------------------------------
49
;   Modern Interface Settings
50
 
51
#!define MUI_ABORTWARNING
2062 dpurdie 52
 !define MUI_ICON                       "${GBE_NSISDATA}\inVix.ico"
53
 !define MUI_UNICON                     "${GBE_NSISDATA}\unVix.ico"
1139 dpurdie 54
 !define MUI_HEADERIMAGE
55
 !define MUI_HEADERIMAGE_BITMAP         "${GBE_NSISDATA}\VixHeader.bmp"
56
 !define MUI_WELCOMEFINISHPAGE_BITMAP   "${GBE_NSISDATA}\VixPanel.bmp"
57
 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${GBE_NSISDATA}\VixPanel.bmp"
58
 !define MUI_FINISHPAGE_NOAUTOCLOSE
59
 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
60
 !define MUI_WELCOMEPAGE_TITLE_3LINES
61
 !define MUI_FINISHPAGE_TITLE_3LINES
62
 
63
;--------------------------------
64
;   Pages
65
;   List of Pages for the Modern UI to show
66
 
67
 !insertmacro MUI_PAGE_WELCOME
68
#!insertmacro MUI_PAGE_LICENSE "${GBE_NSISDATA}\license.txt"
69
#!insertmacro MUI_PAGE_COMPONENTS
70
#!insertmacro MUI_PAGE_DIRECTORY
71
 !insertmacro MUI_PAGE_INSTFILES
72
#!insertmacro MUI_PAGE_FINISH
73
 
74
#!insertmacro MUI_UNPAGE_WELCOME
75
 !insertmacro MUI_UNPAGE_CONFIRM
76
#!insertmacro MUI_UNPAGE_COMPONENTS
77
 !insertmacro MUI_UNPAGE_INSTFILES
78
#!insertmacro MUI_UNPAGE_FINISH
79
 
80
;--------------------------------
81
;   Languages
82
;   System will select default language
83
 
84
  !insertmacro MUI_LANGUAGE "English"
85
  !insertmacro MUI_LANGUAGE "French"
86
#  !insertmacro MUI_LANGUAGE "Swedish"
87
 
88
;--------------------------------
89
;   Allow user to select the language
90
;   By default the system will select the 'system' language
91
;   Uncomment the following lines and th user can select
92
;   the installation laguage.
93
#Function .onInit 
94
#    !insertmacro MUI_LANGDLL_DISPLAY 
95
#FunctionEnd
96
 
97
#Function un.onInit 
98
#    !insertmacro MUI_LANGDLL_DISPLAY 
99
#FunctionEnd
100
 
101
;--------------------------------
102
;   Installer Sections
103
;   Each section will show up as a 'component', if that page is shown
104
;
105
Section "Application" SecDummy
106
 
107
    SetOutPath "$INSTDIR"
108
 
109
    ; Install a program
110
    CreateDirectory "$INSTDIR\bin"
111
    SetOutPath "$INSTDIR\bin"
112
    File "${GBE_INTERFACE}\bin\WIN32P\AT91load.exe"
113
 
114
    ; Create a Short Cut
115
    SetShellVarContext all
116
    CreateDirectory "$SMPROGRAMS\${ProgramGroup}"
117
    CreateShortCut  "$SMPROGRAMS\${ProgramGroup}\AT91load.lnk"  "$INSTDIR\bin\AT91load.exe"
118
    CreateShortCut  "$SMPROGRAMS\${ProgramGroup}\UnInstall ${GBE_PACKAGE}.lnk" "$INSTDIR\Uninstall.exe"
1141 dpurdie 119
    IfErrors 0 +2
120
        Abort "Error creating Application Shortcut"
1139 dpurdie 121
 
122
    ; Create a Desktop Icon     
123
    CreateShortCut "$DESKTOP\AT91load.lnk" "$INSTDIR\bin\AT91load.exe"
1141 dpurdie 124
    IfErrors 0 +2
125
        Abort "Error creating Desktop Icon"
1139 dpurdie 126
 
127
    ; Install a data file
128
    CreateDirectory $INSTDIR\data
129
    SetOutPath "$INSTDIR\data"
130
    File /oname=datafile.txt example.nsi
131
 
1141 dpurdie 132
    IfErrors 0 +2
133
        Abort "Error Installing Application"
134
 
1139 dpurdie 135
SectionEnd
136
 
137
;--------------------------------
138
;   Uninstaller Sections
139
;   Un Installer for files installed by the user
140
;
141
Section "un.Application"
142
  ;
143
  ; Remove the data file
144
  Delete "$INSTDIR\data\datafile.txt"
145
  RMDir  "$INSTDIR\data"
146
 
147
  ; Remove the program
148
  RMDir /r "$INSTDIR\bin"
149
 
150
  ; Remove the shortcuts
151
  SetShellVarContext all
152
  Delete "$DESKTOP\AT91load.lnk"
153
  RMDir /r "$SMPROGRAMS\${ProgramGroup}"
154
  RMDir "$SMPROGRAMS\${ProgramGroupBase}"
155
 
156
SectionEnd
157
 
158
;--------------------------------
159
;   Section to create the Core of the Uninstaller
160
;   This will be hidden
161
;
162
Section "-Core"
163
 
164
    ;Store installation folder
165
    WriteRegStr HKCU ${InstallDirReg} "" $INSTDIR
166
 
167
    ;Create uninstaller and copy it into the install directory
168
    SetOutPath "$INSTDIR"
169
    WriteUninstaller "$INSTDIR\Uninstall.exe"
170
 
171
    ; Write the uninstall keys for Windows so that the package is seen in the
172
    ; Add/Remove Program section of the Control Panel.
173
    ;     Create a 'unique' key in the windows registry
174
    ;     Base it on the package name
175
    ;         Could use a GUID but it MUST NOT be copied if this file is copied
176
    ;
177
    !define UnInstallKeyBase "Software\Microsoft\Windows\CurrentVersion\Uninstall"
178
    !define UnInstallKey "${UnInstallKeyBase}\${GBE_PACKAGE}"
179
 
1141 dpurdie 180
    WriteRegStr   HKLM ${UnInstallKey} "DisplayName" "${GBE_PACKAGE}"
181
    WriteRegStr   HKLM ${UnInstallKey} "DisplayVersion" "${GBE_VERSION_FULL}"
182
    WriteRegStr   HKLM ${UnInstallKey} "Publisher" "${GBE_COMPANY}"
183
    WriteRegStr   HKLM ${UnInstallKey} "InstallLocation" "$INSTDIR"
184
    WriteRegStr   HKLM ${UnInstallKey} "UninstallString" '"$INSTDIR\uninstall.exe"'
2062 dpurdie 185
    WriteRegStr   HKLM ${UnInstallKey} "DisplayIcon" '"$INSTDIR\uninstall.exe"'
1139 dpurdie 186
    WriteRegDWORD HKLM ${UnInstallKey} "NoModify" 1
187
    WriteRegDWORD HKLM ${UnInstallKey} "NoRepair" 1
1141 dpurdie 188
 
189
    IfErrors 0 +2
190
        Abort "Error creating uninstaller information"
191
 
1139 dpurdie 192
SectionEnd
193
 
194
;--------------------------------
195
;   Uninistaller section to uninstall keys
196
;   That have been installed as a part of the core installer
197
;
198
Section "-un.Core"
199
 
200
  ; Delete the uninstaller and then the containing directory
201
  ; The directory will only be removed if its empty  
202
  Delete "$INSTDIR\Uninstall.exe"
203
  RMDir "$INSTDIR"
204
 
205
  ; Remove the programs registry key
206
  ;     Keep around for next time
207
  ; DeleteRegKey /ifempty HKCU ${InstallDirReg}
208
 
209
  ; Remove Uninstaller registry keys
210
  DeleteRegKey HKLM ${UnInstallKey}
211
 
212
SectionEnd
213