forked from uroni/urbackup_frontend_wx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
urbackup.nsi
407 lines (347 loc) · 12.1 KB
/
urbackup.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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
!define MUI_BRANDINGTEXT "UrBackup Client $version_short$"
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
!include WinVer.nsh
!include "x64.nsh"
!define MUI_ICON "icon3.ico"
SetCompressor /FINAL /SOLID lzma
CRCCheck On
Name "UrBackup Client $version_short$"
OutFile "UrBackup Client $version_short$.exe"
InstallDir "$PROGRAMFILES\UrBackup"
RequestExecutionLevel highest
!include "servicelib.nsh"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "License-Install.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!define MUI_LANGDLL_ALLLANGUAGES
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\UrBackup"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_RESERVEFILE_LANGDLL
Var SITE_LOCAL_RUNTIME
Section "install"
${If} ${RunningX64}
!insertmacro DisableX64FSRedirection
SetRegView 64
${EndIf}
${If} ${IsWinXP}
MessageBox MB_OK "Sorry, installation on Windows XP is not supported."
Quit
${EndIf}
${If} ${IsWin2003}
MessageBox MB_OK "Sorry, installation on Windows Server 2003 is not supported."
Quit
${EndIf}
${If} ${IsWin2000}
MessageBox MB_OK "Sorry, installation on Windows 2000 is not supported."
Quit
${EndIf}
StrCpy $SITE_LOCAL_RUNTIME "0"
SetOutPath "$TEMP"
${If} ${RunningX64}
; Push $R0
; ClearErrors
; ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}" "Version"
; IfErrors 0 VSRedistInstalled64
; inetc::get "http://www.urserver.de/vc10/vcredist_x64.exe" $TEMP\vcredist_x64.exe
; Pop $0
; ExecWait '"$TEMP\vcredist_x64.exe" /q'
; Delete '$TEMP\vcredist_x64.exe'
; VSRedistInstalled64:
File "..\deps\redist\vc_redist_2019.x64.exe"
ExecWait '"$TEMP\vc_redist_2019.x64.exe" /q /norestart' $0
${If} $0 != '0'
${If} $0 != '3010'
${If} $0 != '1638'
${If} $0 != '8192'
${If} $0 != '1641'
${If} $0 != '1046'
ExecWait '"$TEMP\vc_redist_2019.x64.exe" /passive /norestart' $0
${If} $0 != '0'
${If} $0 != '3010'
${If} $0 != '1638'
DetailPrint "Unable to install Visual Studio 2019 runtime. Falling back to site local runtime installation."
StrCpy $SITE_LOCAL_RUNTIME "1"
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${Else}
; ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x86" 'Installed'
; ${If} $0 != '1'
; ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" 'Installed'
; ${If} $0 != '1'
; inetc::get "http://www.urserver.de/vc10/vcredist_x86.exe" $TEMP\vcredist_x86.exe
; Pop $0
; ExecWait '"$TEMP\vcredist_x86.exe" /q'
; Delete '$TEMP\vcredist_x86.exe'
; ${EndIf}
; ${EndIf}
File "..\deps\redist\vc_redist_2019.x86.exe"
ExecWait '"$TEMP\vc_redist_2019.x86.exe" /q /norestart' $0
${If} $0 != '0'
${If} $0 != '3010'
${If} $0 != '1638'
${If} $0 != '8192'
${If} $0 != '1641'
${If} $0 != '1046'
ExecWait '"$TEMP\vc_redist_2019.x86.exe" /passive /norestart' $0
${If} $0 != '0'
${If} $0 != '3010'
${If} $0 != '1638'
MessageBox MB_OK "Unable to install Visual Studio 2019 runtime. UrBackup needs that runtime."
Quit
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
${EndIf}
SetOutPath "$INSTDIR"
${If} ${RunningX64}
File "data_x64\KillProc.exe"
nsExec::Exec '"$INSTDIR\KillProc.exe" UrBackupClient.exe'
${Else}
File "data\KillProc.exe"
nsExec::Exec '"$INSTDIR\KillProc.exe" UrBackupClient.exe'
${EndIf}
!insertmacro SERVICE running "UrBackupClientBackend" ""
Pop $0
${If} $0 == "true"
!insertmacro SERVICE stop "UrBackupClientBackend" ""
!insertmacro SERVICE waitfor "UrBackupClientBackend" "status=stopped"
nsExec::Exec '"$INSTDIR\KillProc.exe" UrBackupClientBackend.exe'
${EndIf}
WriteUninstaller "$INSTDIR\Uninstall.exe"
Sleep 500
CreateDirectory "$SMPROGRAMS\UrBackup"
CreateShortCut "$SMPROGRAMS\UrBackup\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\UrBackup\UrBackup.lnk" "$INSTDIR\UrBackupClient.exe" "" "$INSTDIR\UrBackupClient.exe" 0
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UrBackup" "DisplayName" "UrBackup (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UrBackup" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UrBackup" "Path" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UrBackup" "DisplayVersion" "$version_short$"
ClearErrors
File "data\args.txt"
File "data\prefilebackup_new.bat"
File "data\build_revision.txt"
${IfNot} ${RunningX64}
File "data\fileservplugin.dll"
File "data\fsimageplugin.dll"
File "data\urbackup.dll"
File "data\UrBackupClient.exe"
File "data\UrBackupClientBackend.exe"
File "data\cryptoplugin.dll"
File "data\UrBackupClient_cmd.exe"
File "data\sysvol_test.exe"
File "data\libzstd.dll"
${Else}
File "data_x64\fileservplugin.dll"
File "data_x64\fsimageplugin.dll"
File "data_x64\urbackup.dll"
File "data_x64\UrBackupClient.exe"
File "data_x64\UrBackupClientBackend.exe"
File "data_x64\cryptoplugin.dll"
File "data_x64\UrBackupClient_cmd.exe"
File "data_x64\sysvol_test.exe"
File "data_x64\libzstd.dll"
ExecWait '"$INSTDIR\UrBackupClient_cmd.exe" --version' $0
${If} $0 != '1'
StrCpy $SITE_LOCAL_RUNTIME "1"
File "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.24.28127\x64\Microsoft.VC142.CRT\*"
File "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\*"
${EndIf}
${EndIf}
File "data\backup-bad.ico"
File "data\backup-ok.ico"
File "data\backup-progress.ico"
File "data\backup-no-server.ico"
File "data\backup-indexing.ico"
File "data\backup-no-recent.ico"
File "data\fa-copy.png"
File "data\fa-home.png"
File "data\fa-lock.png"
File "data\fa-road.png"
File "data\logo1.png"
File "data\backup-progress-pause.ico"
File "data\urbackup_ecdsa409k1.pub"
File "data\updates_h.dat"
File "data\license.txt"
File "data\info.txt"
File "data\args_debug.txt"
File "data\enable_debug_logging.bat"
File "data\enable_internet_only.bat"
File "data\scrub_disk.bat"
SetOutPath "$INSTDIR\lang\de"
File "data\lang\de\urbackup.mo"
SetOutPath "$INSTDIR\lang\fr"
File "data\lang\fr\urbackup.mo"
SetOutPath "$INSTDIR\lang\ru"
File "data\lang\ru\urbackup.mo"
SetOutPath "$INSTDIR\lang\es"
File "data\lang\es\urbackup.mo"
SetOutPath "$INSTDIR\lang\zh_TW"
File "data\lang\zh_TW\urbackup.mo"
SetOutPath "$INSTDIR\lang\zh_CN"
File "data\lang\zh_CN\urbackup.mo"
SetOutPath "$INSTDIR\lang\pt_BR"
File "data\lang\pt_BR\urbackup.mo"
SetOutPath "$INSTDIR\lang\it"
File "data\lang\it\urbackup.mo"
SetOutPath "$INSTDIR\lang\sk"
File "data\lang\sk\urbackup.mo"
SetOutPath "$INSTDIR\lang\pl"
File "data\lang\pl\urbackup.mo"
SetOutPath "$INSTDIR\lang\uk"
File "data\lang\uk\urbackup.mo"
SetOutPath "$INSTDIR\lang\da"
File "data\lang\da\urbackup.mo"
SetOutPath "$INSTDIR\lang\nl"
File "data\lang\nl\urbackup.mo"
SetOutPath "$INSTDIR\lang\fa"
File "data\lang\fa\urbackup.mo"
SetOutPath "$INSTDIR\lang\cs"
File "data\lang\cs\urbackup.mo"
SetOutPath "$INSTDIR\lang\tr"
File "data\lang\tr\urbackup.mo"
SetOutPath "$INSTDIR\lang\et"
File "data\lang\et\urbackup.mo"
SetOutPath "$INSTDIR\lang\no_NO"
File "data\lang\no_NO\urbackup.mo"
SetOutPath "$INSTDIR\lang\sv"
File "data\lang\sv\urbackup.mo"
SetOutPath "$INSTDIR\lang\pt"
File "data\lang\pt\urbackup.mo"
SetOutPath "$INSTDIR\lang\ja"
File "data\lang\ja\urbackup.mo"
${If} ${Errors}
Quit
${EndIf}
SetOutPath "$INSTDIR"
File "data\curr_version.txt"
SetOutPath "$INSTDIR\urbackup"
CreateDirectory "$INSTDIR\urbackup\data"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "UrBackupClient" "$INSTDIR\UrBackupClient.exe"
liteFirewallW::RemoveRule "$INSTDIR\UrBackupClientBackend.exe" "UrBackupClientBackend"
Pop $0
liteFirewallW::AddRule "$INSTDIR\UrBackupClientBackend.exe" "UrBackupClientBackend"
Pop $0
IfFileExists "$INSTDIR\prefilebackup.bat" next_s_pfb do_copy_pfb
do_copy_pfb:
StrCpy $0 "$INSTDIR\prefilebackup_new.bat" ;Path of copy file from
StrCpy $1 "$INSTDIR\prefilebackup.bat" ;Path of copy file to
StrCpy $2 0 ; only 0 or 1, set 0 to overwrite file if it already exists
System::Call 'kernel32::CopyFile(t r0, t r1, b r2) l'
Pop $0
next_s_pfb:
Delete "$INSTDIR\prefilebackup_new.bat"
!insertmacro SERVICE installed "UrBackupClientBackend" ""
Pop $0
${If} $0 != "true"
!insertmacro SERVICE create "UrBackupClientBackend" 'path="$INSTDIR\UrBackupClientBackend.exe";autostart=1;interact=0;display=UrBackup Client Service for Backups;description=UrBackup Client Service for Backups;'
${EndIf}
!insertmacro SERVICE start "UrBackupClientBackend" ""
${If} ${RunningX64}
!insertmacro EnableX64FSRedirection
SetRegView 32
${EndIf}
SectionEnd
Section "Uninstall"
${If} ${RunningX64}
!insertmacro DisableX64FSRedirection
SetRegView 64
${EndIf}
KillProcDLL::KillProc "UrBackupClient.exe"
ExecWait '"$INSTDIR\UrBackupClient.exe" deleteshellkeys'
${If} ${RunningX64}
ExecWait '"$INSTDIR\KillProc.exe" UrBackupClient.exe'
${EndIf}
!insertmacro SERVICE stop "UrBackupClientBackend" ""
!insertmacro SERVICE waitfor "UrBackupClientBackend" "status=stopped"
!insertmacro SERVICE delete "UrBackupClientBackend" ""
Sleep 500
RMDir /r "$INSTDIR\*.*"
RMDir "$INSTDIR"
Delete "$SMPROGRAMS\UrBackup\*.*"
RMDir "$SMPROGRAMS\UrBackup"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\UrBackup"
DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "UrBackupClient"
${If} ${RunningX64}
!insertmacro EnableX64FSRedirection
SetRegView 32
${EndIf}
DeleteRegKey /ifempty HKCU "Software\UrBackup"
SectionEnd
Function .onInstSuccess
${If} ${RunningX64}
!insertmacro DisableX64FSRedirection
SetRegView 64
${EndIf}
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsBackup" "DisableMonitoring" 0x1
SetOutPath "$INSTDIR"
Exec '"$INSTDIR\UrBackupClient.exe"'
IfSilent setup_defaults
Exec '"$INSTDIR\UrBackupClient.exe" setupWizard'
Goto after_setup_wizard
setup_defaults:
Exec '"$INSTDIR\UrBackupClient.exe" setupDefault'
after_setup_wizard:
${If} ${RunningX64}
!insertmacro EnableX64FSRedirection
SetRegView 32
${EndIf}
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
Function un.onUninstSuccess
;MessageBox MB_OK "UrBackup wurde erfolgreich deinstalliert."
FunctionEnd
Function myGuiInit
;MessageBox MB_OK "blub"
;${If} ${RunningX64}
; !insertmacro DisableX64FSRedirection
; SetRegView 64
;${EndIf}
FunctionEnd
Function .onInit
${If} ${RunningX64}
strcpy $INSTDIR "$PROGRAMFILES64\UrBackup"
${EndIf}
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd