3 ; Began as a version written by Michel Meyers (michel@tcnnet.dyndns.org)
\r
5 ; Adapted by Kern Sibbald for native Win32 Bacula
\r
6 ; added a number of elements from Christopher Hull's installer
\r
8 ; D. Scott Barninger Nov 13 2004
\r
9 ; added configuration editing for bconsole.conf and bwx-console.conf
\r
10 ; better explanation in dialog boxes for editing config files
\r
11 ; added Start Menu items
\r
12 ; fix uninstall of config files to do all not just bacula-fd.conf
\r
14 ; D. Scott Barninger Dec 05 2004
\r
15 ; added specification of default permissions for bacula-fd.conf
\r
16 ; - thanks to Jamie Ffolliott for pointing me at cacls
\r
17 ; added removal of working-dir files if user selects to remove config
\r
18 ; uninstall is now 100% clean
\r
20 ; D. Scott Barninger Apr 17 2005
\r
21 ; 1.36.3 release docs update
\r
22 ; add pdf manual and menu shortcut
\r
24 ; Robert Nelson May 15 2006
\r
25 ; Added server installs and implemented Microsoft install locations
\r
27 ; Added Bacula-SD and Bacula-DIR
\r
28 ; Replaced ParameterGiven with standard GetOptions
\r
32 ; Command line options:
\r
37 ; netsh firewall add portopening protocol=tcp port=9102 name="Bacula-FD"
\r
40 !define PRODUCT "Bacula"
\r
43 ; Include the Modern UI
\r
47 !include "LogicLib.nsh"
\r
48 !include "FileFunc.nsh"
\r
49 !include "Sections.nsh"
\r
50 !include "StrFunc.nsh"
\r
51 !include "WinMessages.nsh"
\r
56 OutFile "${OUT_DIR}\winbacula-${VERSION}.exe"
\r
58 InstallDir "$PROGRAMFILES\Bacula"
\r
59 InstallDirRegKey HKLM "Software\Bacula" "InstallLocation"
\r
65 !insertmacro GetParent
\r
76 !define MUI_COMPONENTSPAGE_SMALLDESC
\r
78 !define MUI_HEADERIMAGE
\r
79 !define MUI_BGCOLOR 739AB9
\r
80 !define MUI_HEADERIMAGE_BITMAP "bacula-logo.bmp"
\r
82 !InsertMacro MUI_PAGE_WELCOME
\r
83 !InsertMacro MUI_PAGE_LICENSE "..\..\..\LICENSE"
\r
84 Page custom EnterInstallType
\r
85 !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageComponentsShow
\r
86 !InsertMacro MUI_PAGE_COMPONENTS
\r
87 !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
\r
88 !InsertMacro MUI_PAGE_DIRECTORY
\r
89 Page custom EnterConfigPage1 LeaveConfigPage1
\r
90 Page custom EnterConfigPage2 LeaveConfigPage2
\r
91 !Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage
\r
92 !InsertMacro MUI_PAGE_INSTFILES
\r
93 Page custom EnterWriteTemplates
\r
94 !Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt
\r
95 !InsertMacro MUI_PAGE_FINISH
\r
97 !InsertMacro MUI_UNPAGE_WELCOME
\r
98 !InsertMacro MUI_UNPAGE_CONFIRM
\r
99 !InsertMacro MUI_UNPAGE_INSTFILES
\r
100 !InsertMacro MUI_UNPAGE_FINISH
\r
102 !define MUI_ABORTWARNING
\r
104 !InsertMacro MUI_LANGUAGE "English"
\r
106 !InsertMacro GetParameters
\r
107 !InsertMacro GetOptions
\r
109 DirText "Setup will install Bacula ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder."
\r
111 !InsertMacro MUI_RESERVEFILE_INSTALLOPTIONS
\r
119 Var CommonFilesDone
\r
125 Var ConfigClientName
\r
126 Var ConfigClientPort
\r
127 Var ConfigClientMaxJobs
\r
128 Var ConfigClientPassword
\r
129 Var ConfigClientInstallService
\r
130 Var ConfigClientStartService
\r
132 Var ConfigStorageName
\r
133 Var ConfigStoragePort
\r
134 Var ConfigStorageMaxJobs
\r
135 Var ConfigStoragePassword
\r
136 Var ConfigStorageInstallService
\r
137 Var ConfigStorageStartService
\r
139 Var ConfigDirectorName
\r
140 Var ConfigDirectorPort
\r
141 Var ConfigDirectorMaxJobs
\r
142 Var ConfigDirectorPassword
\r
143 Var ConfigDirectorAddress
\r
144 Var ConfigDirectorMailServer
\r
145 Var ConfigDirectorMailAddress
\r
146 Var ConfigDirectorDB
\r
147 Var ConfigDirectorInstallService
\r
148 Var ConfigDirectorStartService
\r
150 Var ConfigMonitorName
\r
151 Var ConfigMonitorPassword
\r
153 Var LocalDirectorPassword
\r
154 Var LocalHostAddress
\r
159 Var PostgreSQLVersion
\r
161 Var AutomaticInstall
\r
163 !define NewInstall 0
\r
164 !define UpgradeInstall 1
\r
165 !define MigrateInstall 2
\r
168 Var PreviousComponents
\r
171 ; Bit 0 = File Service
\r
172 ; 1 = Storage Service
\r
173 ; 2 = Director Service
\r
174 ; 3 = Command Console
\r
175 ; 4 = Graphical Console
\r
176 ; 5 = Documentation (PDF)
\r
177 ; 6 = Documentation (HTML)
\r
179 !define ComponentFile 1
\r
180 !define ComponentStorage 2
\r
181 !define ComponentDirector 4
\r
182 !define ComponentTextConsole 8
\r
183 !define ComponentGUIConsole 16
\r
184 !define ComponentPDFDocs 32
\r
185 !define ComponentHTMLDocs 64
\r
187 !define ComponentsRequiringUserConfig 31
\r
188 !define ComponentsFileAndStorage 3
\r
189 !define ComponentsFileAndStorageAndDirector 7
\r
190 !define ComponentsDirectorAndTextGuiConsoles 28
\r
191 !define ComponentsTextAndGuiConsoles 24
\r
200 ; Process Command Line Options
\r
201 StrCpy $OptService 1
\r
203 StrCpy $OptSilent 0
\r
204 StrCpy $CommonFilesDone 0
\r
206 StrCpy $AutomaticInstall 0
\r
207 StrCpy $InstallType ${NewInstall}
\r
208 StrCpy $OldInstallDir ""
\r
209 StrCpy $PreviousComponents 0
\r
210 StrCpy $NewComponents 0
\r
211 StrCpy $MySQLPath ""
\r
212 StrCpy $MySQLVersion ""
\r
213 StrCpy $PostgreSQLPath ""
\r
214 StrCpy $PostgreSQLVersion ""
\r
216 ${GetParameters} $R0
\r
219 ${GetOptions} $R0 "/noservice" $R1
\r
221 StrCpy $OptService 0
\r
224 ${GetOptions} $R0 "/nostart" $R1
\r
229 StrCpy $OptSilent 1
\r
231 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
\r
236 Call GetComputerName
\r
240 Pop $LocalHostAddress
\r
243 Pop $ConfigDirectorMailAddress
\r
245 Call FindDatabaseApps
\r
247 ; Configuration Defaults
\r
249 StrCpy $ConfigClientName "$HostName-fd"
\r
250 StrCpy $ConfigClientPort 9102
\r
251 StrCpy $ConfigClientMaxJobs 2
\r
252 ;StrCpy $ConfigClientPassword
\r
253 StrCpy $ConfigClientInstallService "$OptService"
\r
254 StrCpy $ConfigClientStartService "$OptStart"
\r
256 StrCpy $ConfigStorageName "$HostName-sd"
\r
257 StrCpy $ConfigStoragePort 9103
\r
258 StrCpy $ConfigStorageMaxJobs 10
\r
259 ;StrCpy $ConfigStoragePassword
\r
260 StrCpy $ConfigStorageInstallService "$OptService"
\r
261 StrCpy $ConfigStorageStartService "$OptStart"
\r
263 ;StrCpy $ConfigDirectorName "$HostName-dir"
\r
264 StrCpy $ConfigDirectorPort 9101
\r
265 StrCpy $ConfigDirectorMaxJobs 1
\r
266 ;StrCpy $ConfigDirectorPassword
\r
267 StrCpy $ConfigDirectorDB 0
\r
268 StrCpy $ConfigDirectorInstallService "$OptService"
\r
269 StrCpy $ConfigDirectorStartService "$OptStart"
\r
271 StrCpy $ConfigMonitorName "$HostName-mon"
\r
272 ;StrCpy $ConfigMonitorPassword
\r
275 File "/oname=$PLUGINSDIR\openssl.exe" "${SRC_DIR}\openssl.exe"
\r
276 File "/oname=$PLUGINSDIR\libeay32.dll" "${SRC_DIR}\libeay32.dll"
\r
277 File "/oname=$PLUGINSDIR\ssleay32.dll" "${SRC_DIR}\ssleay32.dll"
\r
278 File "/oname=$PLUGINSDIR\sed.exe" "${SRC_DIR}\sed.exe"
\r
280 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini"
\r
281 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini"
\r
283 SetPluginUnload alwaysoff
\r
285 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
\r
288 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
\r
291 ${StrTrimNewLines} $ConfigClientPassword $R0
\r
295 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
\r
298 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
\r
301 ${StrTrimNewLines} $ConfigStoragePassword $R0
\r
305 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
\r
308 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
\r
311 ${StrTrimNewLines} $LocalDirectorPassword $R0
\r
315 SetPluginUnload manual
\r
317 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
\r
320 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
\r
323 ${StrTrimNewLines} $ConfigMonitorPassword $R0
\r
331 Function .onSelChange
\r
332 Call UpdateComponentUI
\r
335 Function InstallCommonFiles
\r
336 ${If} $CommonFilesDone = 0
\r
337 SetOutPath "$INSTDIR"
\r
340 SetOutPath "$INSTDIR\bin"
\r
341 !if "${BUILD_TOOLS}" == "VC8"
\r
342 File "${SRC_DIR}\msvcm80.dll"
\r
343 File "${SRC_DIR}\msvcp80.dll"
\r
344 File "${SRC_DIR}\msvcr80.dll"
\r
345 File "${SRC_DIR}\Microsoft.VC80.CRT.manifest"
\r
346 File "${SRC_DIR}\pthreadVCE.dll"
\r
348 !if "${BUILD_TOOLS}" == "VC8_DEBUG"
\r
349 File "${SRC_DIR}\msvcm80.dll"
\r
350 File "${SRC_DIR}\msvcp80.dll"
\r
351 File "${SRC_DIR}\msvcr80.dll"
\r
352 File "${SRC_DIR}\Microsoft.VC80.CRT.manifest"
\r
353 File "${SRC_DIR}\msvcm80d.dll"
\r
354 File "${SRC_DIR}\msvcp80d.dll"
\r
355 File "${SRC_DIR}\msvcr80d.dll"
\r
356 File "${SRC_DIR}\Microsoft.VC80.DebugCRT.manifest"
\r
357 File "${SRC_DIR}\pthreadVCE.dll"
\r
359 !if "${BUILD_TOOLS}" == "MinGW"
\r
360 File "${SRC_DIR}\mingwm10.dll"
\r
361 File "${SRC_DIR}\pthreadGCE.dll"
\r
363 File "${SRC_DIR}\libeay32.dll"
\r
364 File "${SRC_DIR}\ssleay32.dll"
\r
365 File "${SRC_DIR}\zlib1.dll"
\r
366 !if "${BUILD_TOOLS}" == "VC8"
\r
367 File "${SRC_DIR}\zlib1.dll.manifest"
\r
369 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
\r
370 File "${SRC_DIR}\zlib1.dll.manifest"
\r
372 File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf"
\r
373 File "${SRC_DIR}\openssl.exe"
\r
374 File "${SRC_DIR}\bsleep.exe"
\r
375 File "${SRC_DIR}\bsmtp.exe"
\r
376 File "${SRC_DIR}\bacula.dll"
\r
377 File "${SRC_DIR}\expr64.exe"
\r
378 File "${SRC_DIR}\snooze.exe"
\r
380 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"'
\r
382 StrCpy $CommonFilesDone 1
\r
386 Section "-Initialize"
\r
387 ${If} $MySQLPath != ""
\r
388 DetailPrint "Found MySQL (version $MySQLVersion)"
\r
390 ${If} $PostgreSQLPath != ""
\r
391 DetailPrint "Found PostgreSQL (version $PostgreSQLVersion)"
\r
394 WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR"
\r
396 Call GetSelectedComponents
\r
398 WriteRegDWORD HKLM Software\Bacula Components $R2
\r
400 WriteRegDWORD HKLM Software\Bacula Database $ConfigDirectorDB
\r
402 ; remove start menu items
\r
403 SetShellVarContext all
\r
405 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*"
\r
406 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*"
\r
407 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
\r
408 RMDir "$SMPROGRAMS\Bacula\Configuration"
\r
409 RMDir "$SMPROGRAMS\Bacula\Documentation"
\r
410 RMDir "$SMPROGRAMS\Bacula"
\r
411 CreateDirectory "$SMPROGRAMS\Bacula"
\r
412 CreateDirectory "$SMPROGRAMS\Bacula\Configuration"
\r
413 CreateDirectory "$SMPROGRAMS\Bacula\Documentation"
\r
415 CreateDirectory "$INSTDIR"
\r
416 CreateDirectory "$INSTDIR\bin"
\r
417 CreateDirectory "$APPDATA\Bacula"
\r
418 CreateDirectory "$APPDATA\Bacula\Work"
\r
419 CreateDirectory "$APPDATA\Bacula\Spool"
\r
421 SetOutPath "$INSTDIR"
\r
422 File "..\..\..\LICENSE"
\r
423 Delete /REBOOTOK "$INSTDIR\bin\License.txt"
\r
425 FileOpen $R1 $PLUGINSDIR\config.sed w
\r
426 FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n"
\r
427 FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n"
\r
428 FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n"
\r
430 !If "$BUILD_TOOLS" == "MinGW"
\r
431 StrCpy $R2 "MinGW32"
\r
440 FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n"
\r
442 ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\\\"
\r
443 FileWrite $R1 's;@working_dir@;$R2;g$\r$\n'
\r
444 ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\"
\r
445 FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n'
\r
447 ${StrRep} $R2 "$INSTDIR\bin" "\" "\\\\"
\r
448 FileWrite $R1 's;@bin_dir@;$R2;g$\r$\n'
\r
449 ${StrRep} $R2 "$INSTDIR\bin" "\" "\\"
\r
450 FileWrite $R1 's;@bin_dir_cmd@;$R2;g$\r$\n'
\r
452 ${StrRep} $R2 "$INSTDIR\bin\fdplugins" "\" "\\\\"
\r
453 FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n'
\r
455 ${StrRep} $R2 "$INSTDIR" "\" "/"
\r
456 FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n"
\r
458 Call IsDirectorSelected
\r
461 FileWrite $R1 "s;@director_address@;$LocalHostAddress;g$\r$\n"
\r
463 ${If} "$ConfigDirectorAddress" != ""
\r
464 FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n"
\r
468 FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n"
\r
469 FileWrite $R1 "s;@storage_address@;$LocalHostAddress;g$\r$\n"
\r
471 ${If} "$ConfigClientName" != ""
\r
472 FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n"
\r
474 ${If} "$ConfigClientPort" != ""
\r
475 FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n"
\r
477 ${If} "$ConfigClientMaxJobs" != ""
\r
478 FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n"
\r
480 ${If} "$ConfigClientPassword" != ""
\r
481 FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n"
\r
483 ${If} "$ConfigStorageName" != ""
\r
484 FileWrite $R1 "s;@storage_name@;$ConfigStorageName;g$\r$\n"
\r
486 ${If} "$ConfigStoragePort" != ""
\r
487 FileWrite $R1 "s;@storage_port@;$ConfigStoragePort;g$\r$\n"
\r
489 ${If} "$ConfigStorageMaxJobs" != ""
\r
490 FileWrite $R1 "s;@storage_maxjobs@;$ConfigStorageMaxJobs;g$\r$\n"
\r
492 ${If} "$ConfigStoragePassword" != ""
\r
493 FileWrite $R1 "s;@storage_password@;$ConfigStoragePassword;g$\r$\n"
\r
495 ${If} "$ConfigDirectorName" != ""
\r
496 FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n"
\r
498 ${If} "$ConfigDirectorPort" != ""
\r
499 FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n"
\r
501 ${If} "$ConfigDirectorMaxJobs" != ""
\r
502 FileWrite $R1 "s;@director_maxjobs@;$ConfigDirectorMaxJobs;g$\r$\n"
\r
504 ${If} "$ConfigDirectorPassword" != ""
\r
505 FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n"
\r
507 ${If} "$ConfigDirectorMailServer" != ""
\r
508 FileWrite $R1 "s;@smtp_host@;$ConfigDirectorMailServer;g$\r$\n"
\r
510 ${If} "$ConfigDirectorMailAddress" != ""
\r
511 FileWrite $R1 "s;@job_email@;$ConfigDirectorMailAddress;g$\r$\n"
\r
513 ${If} "$ConfigMonitorName" != ""
\r
514 FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n"
\r
516 ${If} "$ConfigMonitorPassword" != ""
\r
517 FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n"
\r
520 ${If} $ConfigDirectorDB = 1
\r
521 ${If} $MySQLPath != ""
\r
522 ${StrRep} $R2 "$MySQLPath\bin" "\" "\\"
\r
523 FileWrite $R1 "s;@SQL_BINDIR@;$R2;g$\r$\n"
\r
525 ${ElseIf} $ConfigDirectorDB = 2
\r
526 ${If} $PostgreSQLPath != ""
\r
527 ${StrRep} $R2 "$PostgreSQLPath\bin" "\" "\\"
\r
528 FileWrite $R1 "s;@SQL_BINDIR@;$R2;g$\r$\n"
\r
534 ${If} $InstallType = ${MigrateInstall}
\r
535 FileOpen $R1 $PLUGINSDIR\migrate.sed w
\r
536 ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\\\"
\r
537 FileWrite $R1 's;\(Working *Directory *= *\)[^ ][^ ]*.*$$;\1"$R2";$\r$\n'
\r
538 FileWrite $R1 's;\(Pid *Directory *= *\)[^ ][^ ]*.*$$;\1"$R2";$\r$\n'
\r
542 ${If} ${FileExists} "$OldInstallDir\bin\bacula-fd.exe"
\r
543 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
\r
545 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /remove' ; Remove existing service
\r
548 ${If} ${FileExists} "$OldInstallDir\bin\bacula-sd.exe"
\r
549 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running
\r
551 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /remove' ; Remove existing service
\r
554 ${If} ${FileExists} "$OldInstallDir\bin\bacula-dir.exe"
\r
555 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /kill' ; Shutdown any bacula that could be running
\r
557 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /remove' ; Remove existing service
\r
562 SectionGroup "Client" SecGroupClient
\r
564 Section "File Service" SecFileDaemon
\r
567 SetOutPath "$INSTDIR\bin\fdplugins"
\r
568 File "${SRC_DIR}\exchange-fd.dll"
\r
570 SetOutPath "$INSTDIR\bin"
\r
572 File "${SRC_DIR}\bacula-fd.exe"
\r
574 ${If} $InstallType = ${MigrateInstall}
\r
575 ${AndIf} ${FileExists} "$OldInstallDir\bin\bacula-fd.conf"
\r
576 CopyFiles "$OldInstallDir\bin\bacula-fd.conf" "$APPDATA\Bacula"
\r
577 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\migrate.sed" -i.bak "$APPDATA\Bacula\bacula-fd.conf"'
\r
579 File "/oname=$PLUGINSDIR\bacula-fd.conf" "bacula-fd.conf.in"
\r
581 StrCpy $0 "$APPDATA\Bacula"
\r
582 StrCpy $1 bacula-fd.conf
\r
583 Call ConfigEditAndCopy
\r
586 StrCpy $0 bacula-fd
\r
587 StrCpy $1 "File Service"
\r
588 StrCpy $2 $ConfigClientInstallService
\r
589 StrCpy $3 $ConfigClientStartService
\r
593 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-fd.conf"'
\r
598 SectionGroup "Server" SecGroupServer
\r
600 Section "Storage Service" SecStorageDaemon
\r
603 SetOutPath "$INSTDIR\bin"
\r
605 File "${SRC_DIR}\loaderinfo.exe"
\r
606 File "${SRC_DIR}\mt.exe"
\r
607 File "${SRC_DIR}\mtx.exe"
\r
608 File "${SRC_DIR}\scsitape.exe"
\r
609 File "${SRC_DIR}\tapeinfo.exe"
\r
610 File "${SRC_DIR}\bacula-sd.exe"
\r
611 File "${SRC_DIR}\bcopy.exe"
\r
612 File "${SRC_DIR}\bextract.exe"
\r
613 File "${SRC_DIR}\bls.exe"
\r
614 File "${SRC_DIR}\bscan.exe"
\r
615 File "${SRC_DIR}\btape.exe"
\r
616 File "${SRC_DIR}\scsilist.exe"
\r
617 File "${SRC_DIR}\mkisofs.exe"
\r
618 File "${SRC_DIR}\growisofs.exe"
\r
619 File "${SRC_DIR}\dvd-ram-control.exe"
\r
620 File "${SRC_DIR}\dvd+rw-booktype.exe"
\r
621 File "${SRC_DIR}\dvd+rw-format.exe"
\r
622 File "${SRC_DIR}\dvd+rw-mediainfo.exe"
\r
624 File "/oname=$PLUGINSDIR\mtx-changer.cmd" "${SRC_DIR}\mtx-changer.cmd"
\r
626 StrCpy $0 "$INSTDIR\bin"
\r
627 StrCpy $1 mtx-changer.cmd
\r
628 Call ConfigEditAndCopy
\r
630 File "/oname=$PLUGINSDIR\disk-changer.cmd" "${SRC_DIR}\disk-changer.cmd"
\r
632 StrCpy $0 "$INSTDIR\bin"
\r
633 StrCpy $1 disk-changer.cmd
\r
634 Call ConfigEditAndCopy
\r
636 File "/oname=$PLUGINSDIR\dvd-handler.cmd" "${SRC_DIR}\dvd-handler.cmd"
\r
638 StrCpy $0 "$INSTDIR\bin"
\r
639 StrCpy $1 dvd-handler.cmd
\r
640 Call ConfigEditAndCopy
\r
642 File "/oname=$PLUGINSDIR\bacula-sd.conf" "bacula-sd.conf.in"
\r
644 StrCpy $0 "$APPDATA\Bacula"
\r
645 StrCpy $1 bacula-sd.conf
\r
646 Call ConfigEditAndCopy
\r
648 StrCpy $0 bacula-sd
\r
649 StrCpy $1 "Storage Service"
\r
650 StrCpy $2 $ConfigStorageInstallService
\r
651 StrCpy $3 $ConfigStorageStartService
\r
654 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\List Devices.lnk" "$INSTDIR\bin\scsilist.exe" "/pause"
\r
655 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Storage Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-sd.conf"'
\r
658 Section "Director Service" SecDirectorDaemon
\r
661 SetOutPath "$INSTDIR\bin"
\r
663 ${If} $ConfigDirectorDB = 1
\r
664 File /oname=bacula_cats.dll "${SRC_DIR}\cats_mysql.dll"
\r
665 File "${SRC_DIR}\libmysql.dll"
\r
666 File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_mysql_database.cmd
\r
667 File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_mysql_database.cmd
\r
668 File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_mysql_tables.cmd
\r
669 File ${SRC_DIR}\make_mysql_tables.sql
\r
670 File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_mysql_tables.cmd
\r
671 File ${SRC_DIR}\drop_mysql_tables.sql
\r
672 File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_mysql_privileges.cmd
\r
673 File ${SRC_DIR}\grant_mysql_privileges.sql
\r
674 File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_mysql_catalog_backup.cmd
\r
675 ${ElseIf} $ConfigDirectorDB = 2
\r
676 File /oname=bacula_cats.dll "${SRC_DIR}\cats_postgresql.dll"
\r
677 File "${SRC_DIR}\libpq.dll"
\r
678 !if "${BUILD_TOOLS}" == "VC8"
\r
679 File "${SRC_DIR}\comerr32.dll"
\r
680 File "${SRC_DIR}\libintl-2.dll"
\r
681 File "${SRC_DIR}\libiconv-2.dll"
\r
682 File "${SRC_DIR}\krb5_32.dll"
\r
684 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
\r
685 File "${SRC_DIR}\comerr32.dll"
\r
686 File "${SRC_DIR}\libintl-2.dll"
\r
687 File "${SRC_DIR}\libiconv-2.dll"
\r
688 File "${SRC_DIR}\krb5_32.dll"
\r
690 File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_postgresql_database.cmd
\r
691 File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_postgresql_database.cmd
\r
692 File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_postgresql_tables.cmd
\r
693 File ${SRC_DIR}\create_postgresql_database.sql
\r
694 File ${SRC_DIR}\make_postgresql_tables.sql
\r
695 File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_postgresql_tables.cmd
\r
696 File ${SRC_DIR}\drop_postgresql_tables.sql
\r
697 File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_postgresql_privileges.cmd
\r
698 File ${SRC_DIR}\grant_postgresql_privileges.sql
\r
699 File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_postgresql_catalog_backup.cmd
\r
700 ${ElseIf} $ConfigDirectorDB = 3
\r
701 File "${SRC_DIR}\sqlite3.exe"
\r
702 !if "${BUILD_TOOLS}" == "VC8"
\r
703 File "${SRC_DIR}\sqlite3.exe.manifest"
\r
705 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
\r
706 File "${SRC_DIR}\sqlite3.exe.manifest"
\r
708 File /oname=bacula_cats.dll "${SRC_DIR}\cats_sqlite3.dll"
\r
709 File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_sqlite3_database.cmd
\r
710 File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_sqlite3_database.cmd
\r
711 File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_sqlite3_tables.cmd
\r
712 File ${SRC_DIR}\make_sqlite3_tables.sql
\r
713 File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_sqlite3_tables.cmd
\r
714 File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_sqlite3_privileges.cmd
\r
715 File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_sqlite3_catalog_backup.cmd
\r
718 File "${SRC_DIR}\bacula-dir.exe"
\r
719 File "${SRC_DIR}\dbcheck.exe"
\r
721 File "/oname=$PLUGINSDIR\delete_catalog_backup.cmd" "${SRC_DIR}\delete_catalog_backup.cmd"
\r
723 StrCpy $0 "$INSTDIR\bin"
\r
725 StrCpy $1 create_database.cmd
\r
726 Call ConfigEditAndCopy
\r
728 StrCpy $1 drop_database.cmd
\r
729 Call ConfigEditAndCopy
\r
731 StrCpy $1 make_tables.cmd
\r
732 Call ConfigEditAndCopy
\r
734 StrCpy $1 drop_tables.cmd
\r
735 Call ConfigEditAndCopy
\r
737 StrCpy $1 grant_privileges.cmd
\r
738 Call ConfigEditAndCopy
\r
740 StrCpy $1 make_catalog_backup.cmd
\r
741 Call ConfigEditAndCopy
\r
743 StrCpy $1 delete_catalog_backup.cmd
\r
744 Call ConfigEditAndCopy
\r
746 File "${SRC_DIR}\query.sql"
\r
748 File "/oname=$PLUGINSDIR\bacula-dir.conf" "bacula-dir.conf.in"
\r
750 StrCpy $0 "$APPDATA\Bacula"
\r
751 StrCpy $1 bacula-dir.conf
\r
752 Call ConfigEditAndCopy
\r
754 StrCpy $0 bacula-dir
\r
755 StrCpy $1 "Director Service"
\r
756 StrCpy $2 $ConfigDirectorInstallService
\r
757 StrCpy $3 $ConfigDirectorStartService
\r
760 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Director Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-dir.conf"'
\r
765 SectionGroup "Consoles" SecGroupConsoles
\r
767 Section "Command Console" SecConsole
\r
770 SetOutPath "$INSTDIR\bin"
\r
772 File "${SRC_DIR}\bconsole.exe"
\r
773 Call InstallCommonFiles
\r
775 ${If} $InstallType = ${MigrateInstall}
\r
776 ${AndIf} ${FileExists} "$OldInstallDir\bin\bconsole.conf"
\r
777 CopyFiles "$OldInstallDir\bin\bconsole.conf" "$APPDATA\Bacula"
\r
779 File "/oname=$PLUGINSDIR\bconsole.conf" "bconsole.conf.in"
\r
780 StrCpy $0 "$APPDATA\Bacula"
\r
781 StrCpy $1 bconsole.conf
\r
782 Call ConfigEditAndCopy
\r
785 CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bin\bconsole.exe" '-c "$APPDATA\Bacula\bconsole.conf"' "$INSTDIR\bin\bconsole.exe" 0
\r
786 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bconsole.conf"'
\r
790 Section "Graphical Console" SecWxConsole
\r
793 SetOutPath "$INSTDIR\bin"
\r
795 Call InstallCommonFiles
\r
796 !if "${BUILD_TOOLS}" == "VC8"
\r
797 File "${SRC_DIR}\wxbase28_vc_bacula.dll"
\r
798 File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll"
\r
800 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
\r
801 File "${SRC_DIR}\wxbase28_vc_bacula.dll"
\r
802 File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll"
\r
804 !if "${BUILD_TOOLS}" == "MinGW"
\r
805 File "${SRC_DIR}\wxbase28_gcc_bacula.dll"
\r
806 File "${SRC_DIR}\wxmsw28_core_gcc_bacula.dll"
\r
809 File "${SRC_DIR}\bwx-console.exe"
\r
811 ${If} $InstallType = ${MigrateInstall}
\r
812 ${AndIf} ${FileExists} "$OldInstallDir\bin\bwx-console.conf"
\r
813 CopyFiles "$OldInstallDir\bin\bwx-console.conf" "$APPDATA\Bacula"
\r
815 File "/oname=$PLUGINSDIR\bwx-console.conf" "bwx-console.conf.in"
\r
816 StrCpy $0 "$APPDATA\Bacula"
\r
817 StrCpy $1 bwx-console.conf
\r
818 Call ConfigEditAndCopy
\r
821 ; Create Start Menu entry
\r
822 CreateShortCut "$SMPROGRAMS\Bacula\bwx-console.lnk" "$INSTDIR\bin\bwx-console.exe" '-c "$APPDATA\Bacula\bwx-console.conf"' "$INSTDIR\bin\bwx-console.exe" 0
\r
823 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Graphical Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bwx-console.conf"'
\r
828 SectionGroup "Documentation" SecGroupDocumentation
\r
830 Section "Documentation (Acrobat Format)" SecDocPdf
\r
833 SetOutPath "$INSTDIR\doc"
\r
834 CreateDirectory "$INSTDIR\doc"
\r
836 File "${SRC_DIR}\manual\bacula.pdf"
\r
837 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual.lnk" '"$INSTDIR\doc\bacula.pdf"'
\r
840 Section "Documentation (HTML Format)" SecDocHtml
\r
843 SetOutPath "$INSTDIR\doc"
\r
844 CreateDirectory "$INSTDIR\doc"
\r
846 File "${SRC_DIR}\manual\bacula\*.html"
\r
847 File "${SRC_DIR}\manual\bacula\*.png"
\r
848 File "${SRC_DIR}\manual\bacula\*.css"
\r
849 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual (HTML).lnk" '"$INSTDIR\doc\index.html"'
\r
858 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR" /T /G SYSTEM:F Administrators:F'
\r
859 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$APPDATA\Bacula" /T /G SYSTEM:F Administrators:F'
\r
862 ; Write the uninstall keys for Windows & create Start Menu entry
\r
863 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula"
\r
864 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR"
\r
865 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}"
\r
866 ${StrTok} $R0 "${VERSION}" "." 0 0
\r
867 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0
\r
868 ${StrTok} $R0 "${VERSION}" "." 1 0
\r
869 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0
\r
870 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1
\r
871 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1
\r
872 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://sourceforge.net/project/showfiles.php?group_id=50727"
\r
873 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.bacula.org"
\r
874 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.bacula.org/?page=support"
\r
875 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
\r
876 WriteUninstaller "$INSTDIR\Uninstall.exe"
\r
877 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
\r
881 ; Extra Page descriptions
\r
883 LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula File Daemon on this system."
\r
884 LangString DESC_SecStorageDaemon ${LANG_ENGLISH} "Install Bacula Storage Daemon on this system."
\r
885 LangString DESC_SecDirectorDaemon ${LANG_ENGLISH} "Install Bacula Director Daemon on this system."
\r
886 LangString DESC_SecConsole ${LANG_ENGLISH} "Install command console program on this system."
\r
887 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install graphical console program on this system."
\r
888 LangString DESC_SecDocPdf ${LANG_ENGLISH} "Install documentation in Acrobat format on this system."
\r
889 LangString DESC_SecDocHtml ${LANG_ENGLISH} "Install documentation in HTML format on this system."
\r
891 LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration"
\r
892 LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration."
\r
894 LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)"
\r
895 LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration."
\r
897 LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type"
\r
898 LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type."
\r
900 LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates"
\r
901 LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create resource templates for inclusion in the Director's configuration file."
\r
903 !InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN
\r
904 !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon)
\r
905 !InsertMacro MUI_DESCRIPTION_TEXT ${SecStorageDaemon} $(DESC_SecStorageDaemon)
\r
906 !InsertMacro MUI_DESCRIPTION_TEXT ${SecDirectorDaemon} $(DESC_SecDirectorDaemon)
\r
907 !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
\r
908 !InsertMacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
\r
909 !InsertMacro MUI_DESCRIPTION_TEXT ${SecDocPdf} $(DESC_SecDocPdf)
\r
910 !InsertMacro MUI_DESCRIPTION_TEXT ${SecDocHtml} $(DESC_SecDocHtml)
\r
911 !InsertMacro MUI_FUNCTION_DESCRIPTION_END
\r
913 ; Uninstall section
\r
915 UninstallText "This will uninstall Bacula. Hit next to continue."
\r
917 Section "Uninstall"
\r
918 ; Shutdown any baculum that could be running
\r
919 nsExec::ExecToLog '"$INSTDIR\bin\bacula-fd.exe" /kill'
\r
920 nsExec::ExecToLog '"$INSTDIR\bin\bacula-sd.exe" /kill'
\r
921 nsExec::ExecToLog '"$INSTDIR\bin\bacula-dir.exe" /kill'
\r
924 ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd"
\r
926 ; Remove bacula service
\r
927 nsExec::ExecToLog '"$INSTDIR\bin\bacula-fd.exe" /remove'
\r
928 nsExec::ExecToLog '"$INSTDIR\bin\exchange-fd.dll" /remove'
\r
931 ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-sd"
\r
933 ; Remove bacula service
\r
934 nsExec::ExecToLog '"$INSTDIR\bin\bacula-sd.exe" /remove'
\r
937 ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-dir"
\r
939 ; Remove bacula service
\r
940 nsExec::ExecToLog '"$INSTDIR\bin\bacula-dir.exe" /remove'
\r
943 ; remove registry keys
\r
944 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
\r
945 DeleteRegKey HKLM "Software\Bacula"
\r
947 ; remove start menu items
\r
948 SetShellVarContext all
\r
949 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
\r
950 RMDir "$SMPROGRAMS\Bacula"
\r
952 ; remove files and uninstaller (preserving config for now)
\r
953 Delete /REBOOTOK "$INSTDIR\bin\*"
\r
954 Delete /REBOOTOK "$INSTDIR\doc\*"
\r
955 Delete /REBOOTOK "$INSTDIR\*"
\r
957 ; Check for existing installation
\r
958 MessageBox MB_YESNO|MB_ICONQUESTION \
\r
959 "Would you like to delete the current configuration files and the working state file?" IDNO NoDel
\r
960 Delete /REBOOTOK "$APPDATA\Bacula\*"
\r
961 Delete /REBOOTOK "$APPDATA\Bacula\Work\*"
\r
962 Delete /REBOOTOK "$APPDATA\Bacula\Spool\*"
\r
963 Delete /REBOOTOK "$PLUGINSDIR\bacula-*.conf"
\r
964 Delete /REBOOTOK "$PLUGINSDIR\*console.conf"
\r
965 Delete /REBOOTOK "$PLUGINSDIR\*conf.in"
\r
966 Delete /REBOOTOK "$PLUGINSDIR\openssl.exe"
\r
967 Delete /REBOOTOK "$PLUGINSDIR\libeay32.dll"
\r
968 Delete /REBOOTOK "$PLUGINSDIR\ssleay32.dll"
\r
969 Delete /REBOOTOK "$PLUGINSDIR\sed.exe"
\r
970 Delete /REBOOTOK "$PLUGINSDIR\pw.txt"
\r
971 Delete /REBOOTOK "$PLUGINSDIR\*.sed"
\r
972 Delete /REBOOTOK "$PLUGINSDIR\*.cmd"
\r
973 Delete /REBOOTOK "$PLUGINSDIR\*.sql"
\r
974 RMDir "$APPDATA\Bacula\Work"
\r
975 RMDir "$APPDATA\Bacula\Spool"
\r
976 RMDir "$APPDATA\Bacula"
\r
979 ; remove directories used
\r
980 RMDir "$INSTDIR\bin"
\r
981 RMDir "$INSTDIR\doc"
\r
986 ; $0 - Service Name (ie Bacula-FD)
\r
987 ; $1 - Service Description (ie Bacula File Daemon)
\r
988 ; $2 - Install as Service
\r
989 ; $3 - Start Service now
\r
991 Function InstallDaemon
\r
992 Call InstallCommonFiles
\r
994 WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2
\r
997 nsExec::ExecToLog '"$INSTDIR\bin\$0.exe" /install -c "$APPDATA\Bacula\$0.conf"'
\r
1004 ; Start the service?
\r
1008 nsExec::ExecToLog 'net start $0'
\r
1010 Exec '"$INSTDIR\bin\$0.exe" -c "$APPDATA\Bacula\$0.conf"'
\r
1014 CreateShortCut "$SMPROGRAMS\Bacula\Start $1.lnk" "$INSTDIR\bin\$0.exe" '-c "$APPDATA\Bacula\$0.conf"' "$INSTDIR\bin\$0.exe" 0
\r
1018 Function GetComputerName
\r
1023 System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2"
\r
1025 ${StrCase} $R0 $R0 "L"
\r
1032 !define ComputerNameDnsFullyQualified 3
\r
1034 Function GetHostName
\r
1040 System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
\r
1043 DetailPrint "GetComputerNameExA failed - LastError = $R2"
\r
1044 Call GetComputerName
\r
1050 Call GetComputerName
\r
1059 !define NameUserPrincipal 8
\r
1061 Function GetUserName
\r
1067 System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
\r
1070 DetailPrint "GetUserNameExA failed - LastError = $R2"
\r
1081 System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
\r
1084 DetailPrint "GetUserNameA failed - LastError = $R2"
\r
1096 Function ConfigEditAndCopy
\r
1099 ${If} ${FileExists} "$0\$1"
\r
1105 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\$1"'
\r
1106 CopyFiles "$PLUGINSDIR\$1" "$0\$1$R1"
\r
1111 Function FindDatabaseApps
\r
1114 ReadRegStr $0 HKLM "Software\MySQL AB\MySQL Server 5.0" "Location"
\r
1117 Call RemoveTrailingSlash
\r
1118 StrCpy $MySQLPath $0
\r
1119 ReadRegStr $0 HKLM "Software\MySQL AB\MySQL Server 5.0" "Version"
\r
1120 StrCpy $MySQLVersion $0
\r
1123 EnumRegKey $R1 HKLM "Software\PostgreSQL\Installations" 0
\r
1125 ReadRegStr $0 HKLM "Software\PostgreSQL\Installations\$R1" "Base Directory"
\r
1126 Call RemoveTrailingSlash
\r
1127 StrCpy $PostgreSQLPath $0
\r
1128 ReadRegStr $0 HKLM "Software\PostgreSQL\Installations\$R1" "Version"
\r
1129 StrCpy $PostgreSQLVersion $0
\r
1135 Function RemoveTrailingSlash
\r
1137 StrCpy $R1 $0 "" -1
\r
1144 Function IsDirectorSelected
\r
1146 SectionGetFlags ${SecDirectorDaemon} $R0
\r
1147 IntOp $R0 $R0 & ${SF_SELECTED}
\r
1151 Function GetSelectedComponents
\r
1154 ${If} ${SectionIsSelected} ${SecFileDaemon}
\r
1155 IntOp $R0 $R0 | ${ComponentFile}
\r
1157 ${If} ${SectionIsSelected} ${SecStorageDaemon}
\r
1158 IntOp $R0 $R0 | ${ComponentStorage}
\r
1160 ${If} ${SectionIsSelected} ${SecDirectorDaemon}
\r
1161 IntOp $R0 $R0 | ${ComponentDirector}
\r
1163 ${If} ${SectionIsSelected} ${SecConsole}
\r
1164 IntOp $R0 $R0 | ${ComponentTextConsole}
\r
1166 ${If} ${SectionIsSelected} ${SecWxConsole}
\r
1167 IntOp $R0 $R0 | ${ComponentGUIConsole}
\r
1169 ${If} ${SectionIsSelected} ${SecDocPdf}
\r
1170 IntOp $R0 $R0 | ${ComponentPDFDocs}
\r
1172 ${If} ${SectionIsSelected} ${SecDocHtml}
\r
1173 IntOp $R0 $R0 | ${ComponentHTMLDocs}
\r
1178 Function PageComponentsShow
\r
1179 ${If} $OsIsNT <> 1
\r
1180 Call DisableServerSections
\r
1183 Call SelectPreviousComponents
\r
1184 Call UpdateComponentUI
\r
1187 Function PageDirectoryPre
\r
1188 ${If} $AutomaticInstall = 1
\r
1189 ${OrIf} $InstallType = ${UpgradeInstall}
\r
1194 Function LeaveInstallPage
\r
1195 Push "$INSTDIR\install.log"
\r
1199 Function EnterWriteTemplates
\r
1203 Call GetSelectedComponents
\r
1206 IntOp $R0 $R0 & ${ComponentDirector}
\r
1207 IntOp $R1 $NewComponents & ${ComponentsFileAndStorage}
\r
1216 IntOp $R0 $NewComponents & ${ComponentFile}
\r
1218 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0
\r
1219 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED
\r
1220 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State
\r
1221 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
\r
1223 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 1
\r
1224 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags
\r
1225 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "C:\$ConfigClientName.conf"
\r
1226 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
\r
1229 IntOp $R0 $NewComponents & ${ComponentStorage}
\r
1231 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 0
\r
1232 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags DISABLED
\r
1233 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State
\r
1234 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
\r
1236 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 1
\r
1237 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags
\r
1238 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State "C:\$ConfigStorageName.conf"
\r
1239 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
\r
1242 !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)"
\r
1243 !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini"
\r
1245 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State
\r
1247 File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in"
\r
1249 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"'
\r
1250 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State
\r
1252 CopyFiles "$PLUGINSDIR\client.conf.in" "$R0"
\r
1256 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 4" State
\r
1258 File "/oname=$PLUGINSDIR\storage.conf.in" "storage.conf.in"
\r
1260 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\storage.conf.in"'
\r
1261 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 5" State
\r
1263 CopyFiles "$PLUGINSDIR\storage.conf.in" "$R0"
\r
1271 Function SelectPreviousComponents
\r
1272 ${If} $InstallType <> ${NewInstall}
\r
1273 IntOp $R1 $PreviousComponents & ${ComponentFile}
\r
1275 !InsertMacro SelectSection ${SecFileDaemon}
\r
1276 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO}
\r
1278 !InsertMacro UnselectSection ${SecFileDaemon}
\r
1279 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO}
\r
1281 IntOp $R1 $PreviousComponents & ${ComponentStorage}
\r
1283 !InsertMacro SelectSection ${SecStorageDaemon}
\r
1284 !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO}
\r
1286 !InsertMacro UnselectSection ${SecStorageDaemon}
\r
1287 !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_RO}
\r
1289 IntOp $R1 $PreviousComponents & ${ComponentDirector}
\r
1291 !InsertMacro SelectSection ${SecDirectorDaemon}
\r
1292 !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO}
\r
1294 !InsertMacro UnselectSection ${SecDirectorDaemon}
\r
1295 !InsertMacro ClearSectionFlag ${SecDirectorDaemon} ${SF_RO}
\r
1297 IntOp $R1 $PreviousComponents & ${ComponentTextConsole}
\r
1299 !InsertMacro SelectSection ${SecConsole}
\r
1300 !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO}
\r
1302 !InsertMacro UnselectSection ${SecConsole}
\r
1303 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO}
\r
1305 IntOp $R1 $PreviousComponents & ${ComponentGUIConsole}
\r
1307 !InsertMacro SelectSection ${SecWxConsole}
\r
1308 !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_RO}
\r
1310 !InsertMacro UnselectSection ${SecWxConsole}
\r
1311 !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_RO}
\r
1313 IntOp $R1 $PreviousComponents & ${ComponentPDFDocs}
\r
1315 !InsertMacro SelectSection ${SecDocPdf}
\r
1316 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO}
\r
1318 !InsertMacro UnselectSection ${SecDocPdf}
\r
1319 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO}
\r
1321 IntOp $R1 $PreviousComponents & ${ComponentHTMLDocs}
\r
1323 !InsertMacro SelectSection ${SecDocHtml}
\r
1324 !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_RO}
\r
1326 !InsertMacro UnselectSection ${SecDocHtml}
\r
1327 !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_RO}
\r
1332 Function DisableServerSections
\r
1333 !InsertMacro UnselectSection ${SecGroupServer}
\r
1334 !InsertMacro SetSectionFlag ${SecGroupServer} ${SF_RO}
\r
1335 !InsertMacro UnselectSection ${SecStorageDaemon}
\r
1336 !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO}
\r
1337 !InsertMacro UnselectSection ${SecDirectorDaemon}
\r
1338 !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO}
\r
1341 Function UpdateComponentUI
\r
1345 Call GetSelectedComponents
\r
1348 IntOp $R1 $R0 ^ $PreviousComponents
\r
1349 IntOp $NewComponents $R0 & $R1
\r
1351 ${If} $InstallType <> ${NewInstall}
\r
1352 IntOp $R1 $NewComponents & ${ComponentFile}
\r
1354 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD}
\r
1356 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD}
\r
1358 IntOp $R1 $NewComponents & ${ComponentStorage}
\r
1360 !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_BOLD}
\r
1362 !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_BOLD}
\r
1364 IntOp $R1 $NewComponents & ${ComponentDirector}
\r
1366 !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_BOLD}
\r
1368 !InsertMacro ClearSectionFlag ${SecDirectorDaemon} ${SF_BOLD}
\r
1370 IntOp $R1 $NewComponents & ${ComponentTextConsole}
\r
1372 !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD}
\r
1374 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD}
\r
1376 IntOp $R1 $NewComponents & ${ComponentGUIConsole}
\r
1378 !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_BOLD}
\r
1380 !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_BOLD}
\r
1382 IntOp $R1 $NewComponents & ${ComponentPDFDocs}
\r
1384 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_BOLD}
\r
1386 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_BOLD}
\r
1388 IntOp $R1 $NewComponents & ${ComponentHTMLDocs}
\r
1390 !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_BOLD}
\r
1392 !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_BOLD}
\r
1396 GetDlgItem $R0 $HWNDPARENT 1
\r
1398 IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig}
\r
1400 SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install"
\r
1402 SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >"
\r
1409 !include "InstallType.nsh"
\r
1410 !include "ConfigPage1.nsh"
\r
1411 !include "ConfigPage2.nsh"
\r
1412 !include "DumpLog.nsh"
\r