Subversion Repositories DevTools

Rev

Rev 2877 | Details | Compare with Previous | Last modification | View Log | RSS feed

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