-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstaller.nsi
365 lines (301 loc) · 13.3 KB
/
installer.nsi
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
!include "MUI2.nsh"
!include "FileAssociation.nsh"
!include "ProtocolAssociation.nsh"
!include "x64.nsh"
!ifndef NOBUILD
;Rebuild Release
!system "%Windir%\Microsoft.NET\Framework\v3.5\MSBuild.exe /nologo /verbosity:m /t:Rebuild /p:Configuration=Release"
!endif
!system 'GetVersion.exe "TransmissionClientNew\bin\Release\Transmission Remote.exe" > verinclude.nsh' = 0
!define /file REV verinclude.nsh
;--------------------------------
; The name of the installer
Name "Transmission Remote"
; The file to write
!ifndef REV
OutFile "transmission-remote-dotnet-3.24-installer.exe"
!else
OutFile "transmission-remote-dotnet-${REV}-installer.exe"
!endif
; The default installation directory
!define ProgramFilesDir "Transmission Remote"
!ifndef PORTABLE
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\TransmissionRemote" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
!else
RequestExecutionLevel user
!endif
;--------------------------------
XPStyle on
Var StartMenuFolder
!define MUI_ICON "TransmissionClientNew\transmission_large.ico"
!define MUI_UNICON "TransmissionClientNew\transmission_large.ico"
!define MUI_HEADERIMAGE
;!define MUI_HEADERIMAGE_BITMAP "logo.bmp"
;!define MUI_WELCOMEFINISHPAGE_BITMAP "nsis_wizard.bmp"
;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "nsis_wizard.bmp"
;!define MUI_COMPONENTSPAGE_CHECKBITMAP "${NSISDIR}\Contrib\Graphics\Checks\colorful.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show ReadMe"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENCE.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
;!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
;!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\TransmissionRemote"
;!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
; English
LangString NAME_SecTransmissionRemote ${LANG_ENGLISH} "Transmission Remote (required)"
LangString DESC_SecTransmissionRemote ${LANG_ENGLISH} "If set, a shortcut for Transmission Remote will be created on the desktop."
LangString NAME_SecFiletypeAssociations ${LANG_ENGLISH} "Register Filetype Associations"
LangString DESC_SecFiletypeAssociations ${LANG_ENGLISH} "Register Associations to Transmission Remote"
LangString NAME_SecRegiterTorrent ${LANG_ENGLISH} "Register .torrent"
LangString DESC_SecRegiterTorrent ${LANG_ENGLISH} "Register .torrent to Transmission Remote"
LangString NAME_SecRegiterMagnet ${LANG_ENGLISH} "Register Magnet URI"
LangString DESC_SecRegiterMagnet ${LANG_ENGLISH} "Register Magnet URI to Transmission Remote"
LangString NAME_SecDesktopIcon ${LANG_ENGLISH} "Create icon on desktop"
LangString DESC_SecDesktopIcon ${LANG_ENGLISH} "If set, a shortcut for Transmission Remote will be created on the desktop."
LangString DESC_SecGeoIPDatabase ${LANG_ENGLISH} "GeoIP database"
LangString NAME_SecLanguages ${LANG_ENGLISH} "Languages"
LangString DESC_SecLanguages ${LANG_ENGLISH} "Languages for Transmission Remote"
;--------------------------------
; The stuff to install
Section $(NAME_SecTransmissionRemote) SecTransmissionRemote
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "TransmissionClientNew\bin\Release\Transmission Remote.exe"
File "TransmissionClientNew\Jayrock\Release\Jayrock.dll"
File "TransmissionClientNew\Jayrock\Release\Jayrock.Json.dll"
File "TransmissionClientNew\bin\Release\Raccoom.Xml.dll"
File "README.txt"
File "LICENCE.txt"
!ifndef PORTABLE
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\TransmissionRemote" "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Transmission Remote" "DisplayName" "Transmission Remote"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Transmission Remote" "Publisher" "Alan F"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Transmission Remote" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Transmission Remote" "DisplayIcon" "$INSTDIR\Transmission Remote.exe,0"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Transmission Remote" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Transmission Remote" "NoRepair" 1
WriteUninstaller "uninstall.exe"
!endif
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetShellVarContext current
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Transmission Remote.lnk" "$INSTDIR\Transmission Remote.exe" "" "$INSTDIR\Transmission Remote.exe" 0
!ifndef PORTABLE
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
; CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Transmission Remote.lnk" "$INSTDIR\Transmission Remote.exe" "" "$INSTDIR\Transmission Remote.exe" 0
!endif
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
; Optional section (can be disabled by the user)
Section /o $(NAME_SecDesktopIcon) SecDesktopIcon
SetShellVarContext current
SetOutPath "$INSTDIR\bin"
CreateShortCut "$DESKTOP\Transmission Remote.lnk" "$INSTDIR\Transmission Remote.exe" "" "$INSTDIR\Transmission Remote.exe" 0
SectionEnd
Section "GeoIP Database" SecGeoIPDatabase
SetOutPath "$INSTDIR"
File "GeoIP.dat"
SectionEnd
!ifndef PORTABLE
SubSection $(NAME_SecFiletypeAssociations) SecFiletypeAssociations
Section $(NAME_SecRegiterTorrent) SecRegiterTorrent
${registerExtension} "$INSTDIR\Transmission Remote.exe" ".torrent" "Transmission Remote Torrent"
SectionEnd
Section $(NAME_SecRegiterMagnet) SecRegiterMagnet
${registerProtocol} "$INSTDIR\Transmission Remote.exe" "magnet" "Magnet URI"
SectionEnd
SubSectionEnd
!endif
; Translation
SectionGroup $(NAME_SecLanguages) SecLanguages
Section /o "Brazilian Portuguese" SecLanguagesBrazilianPortuguese
CreateDirectory "$INSTDIR\pt-BR"
SetOutPath "$INSTDIR\pt-BR"
File "TransmissionClientNew\bin\Release\pt-BR\Transmission Remote.resources.dll"
SectionEnd
Section /o "Chinese" SecLanguagesChinese
CreateDirectory "$INSTDIR\zh-CN"
SetOutPath "$INSTDIR\zh-CN"
File "TransmissionClientNew\bin\Release\zh-CN\Transmission Remote.resources.dll"
SectionEnd
Section /o "Czech" SecLanguagesCzech
CreateDirectory "$INSTDIR\cs-CZ"
SetOutPath "$INSTDIR\cs-CZ"
File "TransmissionClientNew\bin\Release\cs-CZ\Transmission Remote.resources.dll"
SectionEnd
Section /o "Danish" SecLanguagesDanish
CreateDirectory "$INSTDIR\da-DK"
SetOutPath "$INSTDIR\da-DK"
File "TransmissionClientNew\bin\Release\da-DK\Transmission Remote.resources.dll"
SectionEnd
Section /o "Dutch" SecLanguagesDutch
CreateDirectory "$INSTDIR\nl-NL"
SetOutPath "$INSTDIR\nl-NL"
File "TransmissionClientNew\bin\Release\nl-NL\Transmission Remote.resources.dll"
SectionEnd
Section /o "French" SecLanguagesFrench
CreateDirectory "$INSTDIR\fr-FR"
SetOutPath "$INSTDIR\fr-FR"
File "TransmissionClientNew\bin\Release\fr-FR\Transmission Remote.resources.dll"
SectionEnd
Section /o "German" SecLanguagesGerman
CreateDirectory "$INSTDIR\de-DE"
SetOutPath "$INSTDIR\de-DE"
File "TransmissionClientNew\bin\Release\de-DE\Transmission Remote.resources.dll"
SectionEnd
Section /o "Hungarian" SecLanguagesHungarian
CreateDirectory "$INSTDIR\hu-HU"
SetOutPath "$INSTDIR\hu-HU"
File "TransmissionClientNew\bin\Release\hu-HU\Transmission Remote.resources.dll"
SectionEnd
Section /o "Korean" SecLanguagesKorean
CreateDirectory "$INSTDIR\ko-KR"
SetOutPath "$INSTDIR\ko-KR"
File "TransmissionClientNew\bin\Release\ko-KR\Transmission Remote.resources.dll"
SectionEnd
Section /o "Polish" SecLanguagesPolish
CreateDirectory "$INSTDIR\pl-PL"
SetOutPath "$INSTDIR\pl-PL"
File "TransmissionClientNew\bin\Release\pl-PL\Transmission Remote.resources.dll"
SectionEnd
Section /o "Russian" SecLanguagesRussian
CreateDirectory "$INSTDIR\ru-RU"
SetOutPath "$INSTDIR\ru-RU"
File "TransmissionClientNew\bin\Release\ru-RU\Transmission Remote.resources.dll"
SectionEnd
Section /o "Spanish" SecLanguagesSpanish
CreateDirectory "$INSTDIR\es-ES"
SetOutPath "$INSTDIR\es-ES"
File "TransmissionClientNew\bin\Release\es-ES\Transmission Remote.resources.dll"
SectionEnd
Section /o "Taiwanese" SecLanguagesTaiwanese
CreateDirectory "$INSTDIR\zh-TW"
SetOutPath "$INSTDIR\zh-TW"
File "TransmissionClientNew\bin\Release\zh-TW\Transmission Remote.resources.dll"
SectionEnd
Section /o "Turkish" SecLanguagesTurkish
CreateDirectory "$INSTDIR\tr-TR"
SetOutPath "$INSTDIR\tr-TR"
File "TransmissionClientNew\bin\Release\tr-TR\Transmission Remote.resources.dll"
SectionEnd
SectionGroupEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
!ifndef PORTABLE
; Unregister File Association
${unregisterExtension} ".torrent" "Transmission Remote Torrent"
${unregisterProtocol} "magnet" "Magnet URI"
; Remove registry keys
DeleteRegKey HKLM SOFTWARE\TransmissionRemote
!endif
; Remove files and uninstaller
Delete "$INSTDIR\Transmission Remote.exe"
Delete "$INSTDIR\Raccoom.Xml.dll"
Delete "$INSTDIR\Jayrock.dll"
Delete "$INSTDIR\Jayrock.Json.dll"
Delete "$INSTDIR\uninstall.exe"
Delete "$INSTDIR\GeoIP.dat"
Delete "$INSTDIR\README.txt"
Delete "$INSTDIR\LICENCE.txt"
Delete "$INSTDIR\cs-CZ\Transmission Remote.resources.dll"
Delete "$INSTDIR\da-DK\Transmission Remote.resources.dll"
Delete "$INSTDIR\de-DE\Transmission Remote.resources.dll"
Delete "$INSTDIR\es-ES\Transmission Remote.resources.dll"
Delete "$INSTDIR\fr-FR\Transmission Remote.resources.dll"
Delete "$INSTDIR\hu-HU\Transmission Remote.resources.dll"
Delete "$INSTDIR\ko-KR\Transmission Remote.resources.dll"
Delete "$INSTDIR\nl-NL\Transmission Remote.resources.dll"
Delete "$INSTDIR\pl-PL\Transmission Remote.resources.dll"
Delete "$INSTDIR\pt-BR\Transmission Remote.resources.dll"
Delete "$INSTDIR\ru-RU\Transmission Remote.resources.dll"
Delete "$INSTDIR\tr-TR\Transmission Remote.resources.dll"
Delete "$INSTDIR\zh-CN\Transmission Remote.resources.dll"
Delete "$INSTDIR\zh-TW\Transmission Remote.resources.dll"
; Remove shortcuts, if any
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
SetShellVarContext current
Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
RMDir "$SMPROGRAMS\$StartMenuFolder"
!ifndef PORTABLE
SetShellVarContext all
Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
RMDir "$SMPROGRAMS\$StartMenuFolder"
!endif
; Remove directories used
RMDir "$INSTDIR\cs-CZ"
RMDir "$INSTDIR\da-DK"
RMDir "$INSTDIR\de-DE"
RMDir "$INSTDIR\es-ES"
RMDir "$INSTDIR\fr-FR"
RMDir "$INSTDIR\hu-HU"
RMDir "$INSTDIR\ko-KR"
RMDir "$INSTDIR\nl-NL"
RMDir "$INSTDIR\pl-PL"
RMDir "$INSTDIR\pt-BR"
RMDir "$INSTDIR\ru-RU"
RMDir "$INSTDIR\tr-TR"
RMDir "$INSTDIR\zh-CN"
RMDir "$INSTDIR\zh-TW"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\TransmissionRemote"
!ifndef PORTABLE
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Transmission Remote"
!endif
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecTransmissionRemote} $(DESC_SecTransmissionRemote)
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} $(DESC_SecDesktopIcon)
!ifndef PORTABLE
!insertmacro MUI_DESCRIPTION_TEXT ${SecFiletypeAssociations} $(DESC_SecFiletypeAssociations)
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SecGeoIPDatabase} $(DESC_SecGeoIPDatabase)
!insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(DESC_SecLanguages)
!ifndef PORTABLE
!insertmacro MUI_DESCRIPTION_TEXT ${SecRegiterTorrent} $(DESC_SecRegiterTorrent)
!insertmacro MUI_DESCRIPTION_TEXT ${SecRegiterMagnet} $(DESC_SecRegiterMagnet)
!endif
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function .onInit
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "Transmission Remote") ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort
!insertmacro MUI_LANGDLL_DISPLAY
!ifdef PORTABLE
StrCpy $INSTDIR "\${ProgramFilesDir}"
!else
${If} ${RunningX64}
StrCpy $INSTDIR "$PROGRAMFILES64\${ProgramFilesDir}"
${Else}
StrCpy $INSTDIR "$PROGRAMFILES\${ProgramFilesDir}"
${Endif}
!endif
FunctionEnd