Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3.2/setup/Standard Setup.nsi @ 6514

Last change on this file since 6514 was 6, checked in by swagner, 17 years ago

Added setup

File size: 9.7 KB
Line 
1;NSIS Modern User Interface
2;HeuristicLab Installation Script
3;Written by Stefan Wagner
4
5;--------------------------------
6;Global
7
8  !define PRODUCT "HeuristicLab"
9  !define VERSION "3.0"
10  !define CONFIGURATION "Release"
11  !define ALL_USERS
12
13;--------------------------------
14;Include Modern UI
15
16  !include "MUI2.nsh"
17
18;--------------------------------
19;General
20
21  ;Name and file
22  Name "${PRODUCT} ${VERSION}"
23  OutFile "${PRODUCT} ${VERSION} Setup.exe"
24
25  ;Default installation folder
26  InstallDir "$PROGRAMFILES\${PRODUCT} ${VERSION}"
27
28  ;Get installation folder from registry if available
29  InstallDirRegKey HKLM "Software\${PRODUCT} ${VERSION}" ""
30
31  ;Request application privileges for Windows Vista
32  RequestExecutionLevel user
33
34;--------------------------------
35;Interface Settings
36
37  !define MUI_ABORTWARNING
38
39;--------------------------------
40;Pages
41
42  !insertmacro MUI_PAGE_WELCOME
43  !insertmacro MUI_PAGE_LICENSE "Files\HeuristicLab License.txt"
44  !insertmacro MUI_PAGE_COMPONENTS
45  !insertmacro MUI_PAGE_DIRECTORY
46  !insertmacro MUI_PAGE_INSTFILES
47  !define MUI_FINISHPAGE_RUN "$INSTDIR\HeuristicLab.exe"
48  !define MUI_FINISHPAGE_RUN_NOTCHECKED
49  !define MUI_FINISHPAGE_LINK "http://www.heuristiclab.com"
50  !define MUI_FINISHPAGE_LINK_LOCATION "http://www.heuristiclab.com"
51  !insertmacro MUI_PAGE_FINISH
52
53  !insertmacro MUI_UNPAGE_WELCOME
54  !insertmacro MUI_UNPAGE_CONFIRM
55  !insertmacro MUI_UNPAGE_INSTFILES
56  !insertmacro MUI_UNPAGE_FINISH
57
58
59;--------------------------------
60;Languages
61
62  !insertmacro MUI_LANGUAGE "English"
63
64;--------------------------------
65;Installer Sections
66
67Section "HeuristicLab (required)" SecHeuristicLab
68  SectionIn RO
69
70  ;Get personal data folder
71  ReadRegStr $9 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" Personal
72
73  ;Install files
74  SetOutPath "$INSTDIR"
75  CreateDirectory "$INSTDIR\plugins"
76  CreateDirectory "$INSTDIR\plugins\backup"
77  CreateDirectory "$INSTDIR\plugins\cache"
78  CreateDirectory "$INSTDIR\plugins\temp"
79
80  File "..\sources\HeuristicLab.PluginInfrastructure\bin\${CONFIGURATION}\HeuristicLab.PluginInfrastructure.dll"
81  File "..\sources\HeuristicLab.PluginInfrastructure.GUI\bin\${CONFIGURATION}\HeuristicLab.PluginInfrastructure.GUI.dll"
82  File "..\sources\HeuristicLab.PluginInfrastructure.GUI\ICSharpCode.SharpZipLib.dll"
83  File "..\sources\HeuristicLab.PluginInfrastructure.GUI\ICSharpCode.SharpZipLib License.txt"
84  File "..\sources\HeuristicLab\bin\${CONFIGURATION}\HeuristicLab.exe"
85  File "..\sources\HeuristicLab\bin\${CONFIGURATION}\HeuristicLab.exe.config"
86  File "Files\HeuristicLab.ico"
87  File /a "Files\HeuristicLab License.txt"
88  File "..\documentation\API Documentation\HeuristicLab API Documentation.chm"
89
90  ;Add install folder
91  WriteRegStr HKLM "Software\${PRODUCT} ${VERSION}" "" $INSTDIR
92
93  ;Add uninstall information to "Add/Remove Programs"
94  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "UninstallString" "$INSTDIR\Uninstall HeuristicLab.exe"
95  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "InstallLocation" "$INSTDIR"
96  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "DisplayName" "${PRODUCT} ${VERSION}"
97  ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "DisplayVersion" "${VERSION}"
98  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "DisplayIcon" "$INSTDIR\HeuristicLab.exe"
99  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "Publisher" "HEAL"
100  ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "Contact" "HEAL"
101  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "URLInfoAbout" "http://www.heuristiclab.com"
102  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "HelpLink" "http://www.heuristiclab.com"
103  ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "Readme" "$INSTDIR\ReadMe.txt"
104  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "Comments" "A paradigm-independent and extensible environment for heuristic optimization."
105  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "NoModify" 1
106  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}" "NoRepair" 1
107
108  ;Create uninstaller
109  WriteUninstaller "$INSTDIR\Uninstall HeuristicLab.exe"
110SectionEnd
111
112SubSection "File Types" SubSecFileTypes
113  Section "HeuristicLab Files (.hl)" SecHeuristicLabFiles
114    ;Backup old extension association if any exists
115    ReadRegStr $R0 HKCR ".hl" ""
116    StrCmp $R0 "" skipBackup
117      StrCmp $R0 "HeuristicLab.File" skipBackup
118        WriteRegStr HKCR ".hl" "backup_value" $R0
119
120    skipBackup:
121    ;Write extension association
122    WriteRegStr HKCR ".hl" "" "HeuristicLab.File"
123
124    ;Delete file type if any exists
125    ReadRegStr $R0 HKCR "HeuristicLab.File" ""
126    StrCmp $R0 "" skipDelete
127      DeleteRegKey HKCR "HeuristicLab.File"
128
129    skipDelete:
130    ;Write file type
131    WriteRegStr HKCR "HeuristicLab.File" "" "HeuristicLab File"
132    WriteRegStr HKCR "HeuristicLab.File\DefaultIcon" "" $INSTDIR\HeuristicLab.ico
133    WriteRegStr HKCR "HeuristicLab.File\shell" "" "open"
134    WriteRegStr HKCR "HeuristicLab.File\shell\open\command" "" '$INSTDIR\HeuristicLab.exe "%1"'
135  SectionEnd
136SubSectionEnd
137
138SubSection "Shortcuts" SubSecShortcuts
139  Section "Create Start Menu Shortcuts" SecStartMenuShortcuts
140    CreateDirectory "$SMPROGRAMS\${PRODUCT} ${VERSION}"
141    CreateShortCut "$SMPROGRAMS\${PRODUCT} ${VERSION}\HeuristicLab.lnk" "$INSTDIR\HeuristicLab.exe"
142    CreateShortCut "$SMPROGRAMS\${PRODUCT} ${VERSION}\Uninstall HeuristicLab.lnk" "$INSTDIR\Uninstall HeuristicLab.exe"
143    CreateShortCut "$SMPROGRAMS\${PRODUCT} ${VERSION}\HeuristicLab API Documentation.lnk" "$INSTDIR\HeuristicLab API Documentation.chm"
144  SectionEnd
145
146  Section "Create Desktop Shortcuts" SecDesktopShortcuts
147    CreateShortCut "$DESKTOP\HeuristicLab ${VERSION}.lnk" "$INSTDIR\HeuristicLab.exe"
148  SectionEnd
149
150  Section "Create Quick Launch Shortcuts" SecQuickLaunchShortcuts
151    StrCmp $QUICKLAUNCH $TEMP skip
152      CreateShortCut "$QUICKLAUNCH\HeuristicLab ${VERSION}.lnk" "$INSTDIR\HeuristicLab.exe"
153    skip:
154  SectionEnd
155SubSectionEnd
156
157;--------------------------------
158;Descriptions
159
160  ;Language strings
161  LangString DESC_SecHeuristicLab ${LANG_ENGLISH} "Installs HeuristicLab and the core components."
162
163  LangString DESC_SubSecFileTypes ${LANG_ENGLISH} "Registers HeuristicLab specific file types."
164  LangString DESC_SecHeuristicLabFiles ${LANG_ENGLISH} "Associates HeuristicLab files (.hl) with HeuristicLab."
165
166  LangString DESC_SubSecShortcuts ${LANG_ENGLISH} "Adds shortcuts to the start menu, the desktop, etc. for easy and quick access."
167  LangString DESC_SecStartMenuShortcuts ${LANG_ENGLISH} "Adds shortcuts to the start menu of the current user."
168  LangString DESC_SecDesktopShortcuts ${LANG_ENGLISH} "Adds shortcuts to the desktop of the current user."
169  LangString DESC_SecQuickLaunchShortcuts ${LANG_ENGLISH} "Adds shortcuts to the quick launch bar of the current user."
170
171  ;Assign language strings to sections
172  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
173    !insertmacro MUI_DESCRIPTION_TEXT ${SecHeuristicLab} $(DESC_SecHeuristicLab)
174    !insertmacro MUI_DESCRIPTION_TEXT ${SubSecFileTypes} $(DESC_SubSecFileTypes)
175    !insertmacro MUI_DESCRIPTION_TEXT ${SecHeuristicLabFiles} $(DESC_SecHeuristicLabFiles)
176    !insertmacro MUI_DESCRIPTION_TEXT ${SubSecShortcuts} $(DESC_SubSecShortcuts)
177    !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcuts} $(DESC_SecStartMenuShortcuts)
178    !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcuts} $(DESC_SecDesktopShortcuts)
179    !insertmacro MUI_DESCRIPTION_TEXT ${SecQuickLaunchShortcuts} $(DESC_SecQuickLaunchShortcuts)
180  !insertmacro MUI_FUNCTION_DESCRIPTION_END
181
182;--------------------------------
183;Uninstaller Section
184
185Section "Uninstall"
186  ;Delete HeuristicLab
187  Delete "$INSTDIR\HeuristicLab.PluginInfrastructure.dll"
188  Delete "$INSTDIR\HeuristicLab.PluginInfrastructure.GUI.dll"
189  Delete "$INSTDIR\ICSharpCode.SharpZipLib.dll"
190  Delete "$INSTDIR\ICSharpCode.SharpZipLib License.txt"
191  Delete "$INSTDIR\HeuristicLab.exe"
192  Delete "$INSTDIR\HeuristicLab.exe.config"
193  Delete "$INSTDIR\Uninstall HeuristicLab.exe"
194  Delete "$INSTDIR\HeuristicLab.ico"
195  Delete "$INSTDIR\HeuristicLab License.txt"
196  Delete "$INSTDIR\HeuristicLab API Documentation.chm"
197
198  ;Delete shortcuts
199  Delete "$DESKTOP\HeuristicLab ${VERSION}.lnk"
200  Delete "$SMPROGRAMS\${PRODUCT} ${VERSION}\HeuristicLab.lnk"
201  Delete "$SMPROGRAMS\${PRODUCT} ${VERSION}\Uninstall HeuristicLab.lnk"
202  Delete "$SMPROGRAMS\${PRODUCT} ${VERSION}\HeuristicLab API Documentation.lnk"
203  RMDir "$SMPROGRAMS\${PRODUCT} ${VERSION}"
204  StrCmp $QUICKLAUNCH $TEMP skip
205    Delete "$QUICKLAUNCH\HeuristicLab ${VERSION}.lnk"
206  skip:
207
208  ;Delete folders
209  RMDir "$INSTDIR\plugins"
210  RMDir /r "$INSTDIR"
211
212  ;Remove install folder
213  DeleteRegKey /ifempty HKLM "Software\${PRODUCT} ${VERSION}"
214
215  ;Remove uninstall information from "Add/Remove Programs"
216  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT} ${VERSION}"
217
218  ;Remove extension associations
219  ;HeuristicLab File (hl)
220  ReadRegStr $R0 HKCR ".hl" ""
221  StrCmp $R0 "HeuristicLab.File" 0 hlFinished
222    ReadRegStr $R0 HKCR ".hl" "backup_value"
223    StrCmp $R0 "" 0 restoreHl
224      DeleteRegKey HKCR ".hl"
225      Goto hlFinished
226    restoreHl:
227      WriteRegStr HKCR ".hl" "" $R0
228      DeleteRegValue HKCR ".hl" "backup_value"
229  HlFinished:
230
231  ;Remove file types
232  DeleteRegKey HKCR "HeuristicLab.File"
233SectionEnd
Note: See TracBrowser for help on using the repository browser.