-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstaller.nsi
More file actions
278 lines (212 loc) · 8.68 KB
/
installer.nsi
File metadata and controls
278 lines (212 loc) · 8.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;General
;Properly display all languages
Unicode true
!define VERSION "0.2.2-alpha"
;Define name of the product
!define PRODUCT "Game Maker Hub Catalyst ${VERSION}"
!define INSTALLDIR "GameMakerHub\Catalyst"
;Define optional URL that will be opened after the installation was successful
!define AFTER_INSTALLATION_URL "https://github.com/GameMakerHub/Catalyst"
;Define the main name of the installer
Name "${PRODUCT}"
;Define the directory where the installer should be saved
OutFile ".\dist\gmh_catalyst_setup_${VERSION}.exe"
;Define the default installation folder (Windows ProgramFiles example)
InstallDir "$PROGRAMFILES\${INSTALLDIR}"
;Define optional a directory for program files that change (Windows AppData example)
!define INSTDIR_DATA "$APPDATA\${INSTALLDIR}"
;Request rights if you want to install the program to program files
RequestExecutionLevel admin
;Properly display all languages
Unicode true
;Show 'console' in installer and uninstaller
ShowInstDetails "show"
ShowUninstDetails "show"
;Get installation folder from registry if available
InstallDirRegKey HKLM "Software\${INSTALLDIR}" ""
;--------------------------------
;Interface Settings
;Show warning if user wants to abort
!define MUI_ABORTWARNING
;Show all languages, despite user's codepage
!define MUI_LANGDLL_ALLLANGUAGES
;Use optional a custom icon:
!define MUI_ICON ".\files\icon.ico" # for the Installer
;!define MUI_UNICON ".\files\icon_uninstaller.ico" # for the later created UnInstaller
;Use optional a custom picture for the 'Welcome' and 'Finish' page:
!define MUI_HEADERIMAGE_RIGHT
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\files\installer.bmp" # for the Installer
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\files\installer.bmp" # for the later created UnInstaller
;Optional no descripton for all components
!define MUI_COMPONENTSPAGE_NODESC
;--------------------------------
;Pages
;For the installer
!insertmacro MUI_PAGE_WELCOME # simply remove this and other pages if you don't want it
!insertmacro MUI_PAGE_LICENSE ".\LICENSE" # link to an ANSI encoded license file
!insertmacro MUI_PAGE_COMPONENTS # remove if you don't want to list components
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
;For the uninstaller
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
;At start will be searched if the current system language is in this list,
;if not the first language in this list will be chosen as language
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "SpanishInternational"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Bulgarian"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Latvian"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Hebrew"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Luxembourgish"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Icelandic"
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Bosnian"
!insertmacro MUI_LANGUAGE "Kurdish"
!insertmacro MUI_LANGUAGE "Irish"
!insertmacro MUI_LANGUAGE "Uzbek"
!insertmacro MUI_LANGUAGE "Galician"
!insertmacro MUI_LANGUAGE "Afrikaans"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Esperanto"
!insertmacro MUI_LANGUAGE "Asturian"
!insertmacro MUI_LANGUAGE "Basque"
!insertmacro MUI_LANGUAGE "Pashto"
!insertmacro MUI_LANGUAGE "Georgian"
!insertmacro MUI_LANGUAGE "Vietnamese"
!insertmacro MUI_LANGUAGE "Welsh"
!insertmacro MUI_LANGUAGE "Armenian"
!insertmacro MUI_LANGUAGE "Corsican"
;--------------------------------
;Installer Section
Section "GMH Catalyst CLI"
SectionIn RO # Just means if in component mode this is locked
;Set output path to the installation directory.
SetOutPath $INSTDIR
;Put the following file in the SetOutPath
File /r ".\dist\packed\windows\*.*"
;Store installation folder in registry
WriteRegStr HKLM "Software\${INSTALLDIR}" "" $INSTDIR
;Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLDIR}" "DisplayName" "${PRODUCT}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLDIR}" "UninstallString" '"$INSTDIR\uninstaller.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLDIR}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLDIR}" "NoRepair" 1
;Create optional start menu shortcut for uninstaller and Main component
CreateDirectory "$SMPROGRAMS\${INSTALLDIR}"
CreateShortCut "$SMPROGRAMS\${INSTALLDIR}\Catalyst.lnk" "$INSTDIR\bin\catalyst_help.cmd" "" "$INSTDIR\icon.ico" 0
CreateShortCut "$SMPROGRAMS\${INSTALLDIR}\Uninstall ${PRODUCT}.lnk" "$INSTDIR\uninstaller.exe" "" "$INSTDIR\uninstaller.exe" 0
;Create uninstaller
WriteUninstaller "uninstaller.exe"
SectionEnd
Section "Add to PATH (recommended)"
;Add catalyst to path
EnVar::AddValueEx "PATH" "$INSTDIR\bin"
Pop $0
DetailPrint "EnVar::AddValue returned=|$0|"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;Remove all registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLDIR}"
DeleteRegKey HKLM "Software\${INSTALLDIR}"
;Delete the installation directory + all files in it
;Add 'RMDir /r "$INSTDIR\folder\*.*"' for every folder you have added additionaly
RMDir /r /REBOOTOK "$INSTDIR\bin\*.*"
RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\*.*"
RMDir "$INSTDIR"
RMDir /r "%TEMP%\gmh_catalyst\*.*"
RMDir /r "%TEMP%\gmh_catalyst\cache"
RMDir /r "%TEMP%\gmh_catalyst\log"
RMDir /r "%TEMP%\gmh_catalyst"
RMDir /r $TEMP\gmh_catalyst
;Delete the appdata directory + files
RMDir /r "${INSTDIR_DATA}\*.*"
RMDir "${INSTDIR_DATA}"
;Delete Start Menu Shortcuts
Delete "$SMPROGRAMS\${INSTALLDIR}\*.*"
RmDir "$SMPROGRAMS\${INSTALLDIR}"
nsExec::Exec 'rmdir /s /q "%TEMP%/gmh_catalyst"'
EnVar::DeleteValue "PATH" "$INSTDIR\bin"
Pop $0
DetailPrint "EnVar::DeleteValue returned=|$0|"
SectionEnd
Function .onInit
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLDIR}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"Catalyst is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller done
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
FunctionEnd
;--------------------------------
;After Installation Function
Function .onInstSuccess
;Open 'Thank you for installing' site or something else
;ExecShell "open" "${AFTER_INSTALLATION_URL}"
Abort
Quit
FunctionEnd