2 # Copyright (C) 2000-2018 Kern Sibbald
3 # License: BSD 2-Clause; see file LICENSE-FOSS
7 ; Began as a version written by Michel Meyers (michel@tcnnet.dyndns.org)
9 ; Adapted by Kern Sibbald for native Win32 Bacula
10 ; added a number of elements from Christopher Hull's installer
12 ; D. Scott Barninger Nov 13 2004
13 ; added configuration editing for bconsole.conf and bwx-console.conf
14 ; better explanation in dialog boxes for editing config files
15 ; added Start Menu items
16 ; fix uninstall of config files to do all not just bacula-fd.conf
18 ; D. Scott Barninger Dec 05 2004
19 ; added specification of default permissions for bacula-fd.conf
20 ; - thanks to Jamie Ffolliott for pointing me at cacls
21 ; added removal of working-dir files if user selects to remove config
22 ; uninstall is now 100% clean
24 ; D. Scott Barninger Apr 17 2005
25 ; 1.36.3 release docs update
26 ; add pdf manual and menu shortcut
28 ; Robert Nelson May 15 2006
29 ; Added server installs and implemented Microsoft install locations
31 ; Added Bacula-SD and Bacula-DIR
32 ; Replaced ParameterGiven with standard GetOptions
34 ; Command line options:
39 ; netsh firewall add portopening protocol=tcp port=9102 name="Bacula-FD"
42 !define PRODUCT "Bacula"
45 ; Include the Modern UI
49 !include "LogicLib.nsh"
50 !include "FileFunc.nsh"
51 !include "Sections.nsh"
52 !include "StrFunc.nsh"
53 !include "WinMessages.nsh"
58 OutFile "${OUT_DIR}\winbacula-${VERSION}.exe"
60 InstallDir "$PROGRAMFILES\Bacula"
61 InstallDirRegKey HKLM "Software\Bacula" "InstallLocation"
67 !insertmacro GetParent
78 !define MUI_COMPONENTSPAGE_SMALLDESC
80 !define MUI_HEADERIMAGE
81 !define MUI_BGCOLOR 739AB9
82 !define MUI_HEADERIMAGE_BITMAP "bacula-logo.bmp"
84 !InsertMacro MUI_PAGE_WELCOME
85 !InsertMacro MUI_PAGE_LICENSE "..\..\..\LICENSE"
86 Page custom EnterInstallType
87 !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageComponentsShow
88 !InsertMacro MUI_PAGE_COMPONENTS
89 !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
90 !InsertMacro MUI_PAGE_DIRECTORY
91 Page custom EnterConfigPage1 LeaveConfigPage1
92 Page custom EnterConfigPage2 LeaveConfigPage2
93 !Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage
94 !InsertMacro MUI_PAGE_INSTFILES
95 Page custom EnterWriteTemplates
96 !Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt
97 !InsertMacro MUI_PAGE_FINISH
99 !InsertMacro MUI_UNPAGE_WELCOME
100 !InsertMacro MUI_UNPAGE_CONFIRM
101 !InsertMacro MUI_UNPAGE_INSTFILES
102 !InsertMacro MUI_UNPAGE_FINISH
104 !define MUI_ABORTWARNING
106 !InsertMacro MUI_LANGUAGE "English"
108 !InsertMacro GetParameters
109 !InsertMacro GetOptions
111 DirText "Setup will install Bacula ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder."
113 !InsertMacro MUI_RESERVEFILE_INSTALLOPTIONS
129 Var ConfigClientMaxJobs
130 Var ConfigClientPassword
131 Var ConfigClientInstallService
132 Var ConfigClientStartService
134 Var ConfigStorageName
135 Var ConfigStoragePort
136 Var ConfigStorageMaxJobs
137 Var ConfigStoragePassword
138 Var ConfigStorageInstallService
139 Var ConfigStorageStartService
141 Var ConfigDirectorName
142 Var ConfigDirectorPort
143 Var ConfigDirectorMaxJobs
144 Var ConfigDirectorPassword
145 Var ConfigDirectorAddress
146 Var ConfigDirectorMailServer
147 Var ConfigDirectorMailAddress
149 Var ConfigDirectorInstallService
150 Var ConfigDirectorStartService
152 Var ConfigMonitorName
153 Var ConfigMonitorPassword
155 Var LocalDirectorPassword
161 Var PostgreSQLVersion
166 !define UpgradeInstall 1
167 !define MigrateInstall 2
170 Var PreviousComponents
173 ; Bit 0 = File Service
174 ; 1 = Storage Service
175 ; 2 = Director Service
176 ; 3 = Command Console
178 ; 5 = wxWidgets Console
179 ; 7 = Documentation (PDF)
180 ; 7 = Documentation (HTML)
182 !define ComponentFile 1
183 !define ComponentStorage 2
184 !define ComponentDirector 4
185 !define ComponentTextConsole 8
186 !define ComponentBatConsole 16
187 !define ComponentGUIConsole 32
188 !define ComponentPDFDocs 64
189 !define ComponentHTMLDocs 128
191 !define ComponentsRequiringUserConfig 63
192 !define ComponentsFileAndStorage 3
193 !define ComponentsFileAndStorageAndDirector 7
194 !define ComponentsDirectorAndTextGuiConsoles 60
195 !define ComponentsTextAndGuiConsoles 56
204 ; Process Command Line Options
208 StrCpy $CommonFilesDone 0
210 StrCpy $AutomaticInstall 0
211 StrCpy $InstallType ${NewInstall}
212 StrCpy $OldInstallDir ""
213 StrCpy $PreviousComponents 0
214 StrCpy $NewComponents 0
216 StrCpy $MySQLVersion ""
217 StrCpy $PostgreSQLPath ""
218 StrCpy $PostgreSQLVersion ""
223 ${GetOptions} $R0 "/noservice" $R1
228 ${GetOptions} $R0 "/nostart" $R1
235 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
244 Pop $LocalHostAddress
247 Pop $ConfigDirectorMailAddress
249 Call FindDatabaseApps
251 ; Configuration Defaults
253 StrCpy $ConfigClientName "$HostName-fd"
254 StrCpy $ConfigClientPort 9102
255 StrCpy $ConfigClientMaxJobs 5
256 ;StrCpy $ConfigClientPassword
257 StrCpy $ConfigClientInstallService "$OptService"
258 StrCpy $ConfigClientStartService "$OptStart"
260 StrCpy $ConfigStorageName "$HostName-sd"
261 StrCpy $ConfigStoragePort 9103
262 StrCpy $ConfigStorageMaxJobs 10
263 ;StrCpy $ConfigStoragePassword
264 StrCpy $ConfigStorageInstallService "$OptService"
265 StrCpy $ConfigStorageStartService "$OptStart"
267 ;StrCpy $ConfigDirectorName "$HostName-dir"
268 StrCpy $ConfigDirectorPort 9101
269 StrCpy $ConfigDirectorMaxJobs 1
270 ;StrCpy $ConfigDirectorPassword
271 StrCpy $ConfigDirectorDB 0
272 StrCpy $ConfigDirectorInstallService "$OptService"
273 StrCpy $ConfigDirectorStartService "$OptStart"
275 StrCpy $ConfigMonitorName "$HostName-mon"
276 ;StrCpy $ConfigMonitorPassword
279 File "/oname=$PLUGINSDIR\openssl.exe" "${SRC_DIR}\openssl.exe"
280 File "/oname=$PLUGINSDIR\libeay32.dll" "${SRC_DIR}\libeay32.dll"
281 File "/oname=$PLUGINSDIR\ssleay32.dll" "${SRC_DIR}\ssleay32.dll"
282 File "/oname=$PLUGINSDIR\sed.exe" "${SRC_DIR}\sed.exe"
284 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini"
285 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini"
287 SetPluginUnload alwaysoff
289 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
292 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
295 ${StrTrimNewLines} $ConfigClientPassword $R0
299 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
302 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
305 ${StrTrimNewLines} $ConfigStoragePassword $R0
309 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
312 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
315 ${StrTrimNewLines} $LocalDirectorPassword $R0
319 SetPluginUnload manual
321 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
324 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
327 ${StrTrimNewLines} $ConfigMonitorPassword $R0
335 Function .onSelChange
336 Call UpdateComponentUI
339 Function InstallCommonFiles
340 ${If} $CommonFilesDone = 0
341 SetOutPath "$INSTDIR"
344 SetOutPath "$INSTDIR\bin"
345 !if "${BUILD_TOOLS}" == "VC8"
346 File "${SRC_DIR}\msvcm80.dll"
347 File "${SRC_DIR}\msvcp80.dll"
348 File "${SRC_DIR}\msvcr80.dll"
349 File "${SRC_DIR}\Microsoft.VC80.CRT.manifest"
350 File "${SRC_DIR}\pthreadVCE.dll"
352 !if "${BUILD_TOOLS}" == "VC8_DEBUG"
353 File "${SRC_DIR}\msvcm80.dll"
354 File "${SRC_DIR}\msvcp80.dll"
355 File "${SRC_DIR}\msvcr80.dll"
356 File "${SRC_DIR}\Microsoft.VC80.CRT.manifest"
357 File "${SRC_DIR}\msvcm80d.dll"
358 File "${SRC_DIR}\msvcp80d.dll"
359 File "${SRC_DIR}\msvcr80d.dll"
360 File "${SRC_DIR}\Microsoft.VC80.DebugCRT.manifest"
361 File "${SRC_DIR}\pthreadVCE.dll"
363 !if "${BUILD_TOOLS}" == "MinGW"
364 File "${SRC_DIR}\mingwm10.dll"
365 File "${SRC_DIR}\pthreadGCE.dll"
367 File "${SRC_DIR}\libeay32.dll"
368 File "${SRC_DIR}\ssleay32.dll"
369 File "${SRC_DIR}\zlib1.dll"
370 !if "${BUILD_TOOLS}" == "VC8"
371 File "${SRC_DIR}\zlib1.dll.manifest"
373 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
374 File "${SRC_DIR}\zlib1.dll.manifest"
376 File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf"
377 File "${SRC_DIR}\openssl.exe"
378 File "${SRC_DIR}\bsleep.exe"
379 File "${SRC_DIR}\bsmtp.exe"
380 File "${SRC_DIR}\bacula.dll"
381 File "${SRC_DIR}\expr64.exe"
382 File "${SRC_DIR}\snooze.exe"
384 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"'
386 StrCpy $CommonFilesDone 1
390 Section "-Initialize"
391 ${If} $MySQLPath != ""
392 DetailPrint "Found MySQL (version $MySQLVersion)"
394 ${If} $PostgreSQLPath != ""
395 DetailPrint "Found PostgreSQL (version $PostgreSQLVersion)"
398 WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR"
400 Call GetSelectedComponents
402 WriteRegDWORD HKLM Software\Bacula Components $R2
404 WriteRegDWORD HKLM Software\Bacula Database $ConfigDirectorDB
406 ; remove start menu items
407 SetShellVarContext all
409 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*"
410 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*"
411 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
412 RMDir "$SMPROGRAMS\Bacula\Configuration"
413 RMDir "$SMPROGRAMS\Bacula\Documentation"
414 RMDir "$SMPROGRAMS\Bacula"
415 CreateDirectory "$SMPROGRAMS\Bacula"
416 CreateDirectory "$SMPROGRAMS\Bacula\Configuration"
417 CreateDirectory "$SMPROGRAMS\Bacula\Documentation"
419 CreateDirectory "$INSTDIR"
420 CreateDirectory "$INSTDIR\bin"
421 CreateDirectory "$APPDATA\Bacula"
422 CreateDirectory "$APPDATA\Bacula\Work"
423 CreateDirectory "$APPDATA\Bacula\Spool"
425 SetOutPath "$INSTDIR"
426 File "..\..\..\LICENSE"
427 Delete /REBOOTOK "$INSTDIR\bin\License.txt"
429 FileOpen $R1 $PLUGINSDIR\config.sed w
430 FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n"
431 FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n"
432 FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n"
434 !If "$BUILD_TOOLS" == "MinGW"
444 FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n"
446 ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\\\"
447 FileWrite $R1 's;@working_dir@;$R2;g$\r$\n'
448 ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\"
449 FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n'
451 ${StrRep} $R2 "$INSTDIR\bin" "\" "\\\\"
452 FileWrite $R1 's;@bin_dir@;$R2;g$\r$\n'
453 ${StrRep} $R2 "$INSTDIR\bin" "\" "\\"
454 FileWrite $R1 's;@bin_dir_cmd@;$R2;g$\r$\n'
456 ${StrRep} $R2 "$INSTDIR\bin\fdplugins" "\" "\\\\"
457 FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n'
459 ${StrRep} $R2 "$INSTDIR" "\" "/"
460 FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n"
462 Call IsDirectorSelected
465 FileWrite $R1 "s;@director_address@;$LocalHostAddress;g$\r$\n"
467 ${If} "$ConfigDirectorAddress" != ""
468 FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n"
472 FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n"
473 FileWrite $R1 "s;@storage_address@;$LocalHostAddress;g$\r$\n"
475 ${If} "$ConfigClientName" != ""
476 FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n"
478 ${If} "$ConfigClientPort" != ""
479 FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n"
481 ${If} "$ConfigClientMaxJobs" != ""
482 FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n"
484 ${If} "$ConfigClientPassword" != ""
485 FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n"
487 ${If} "$ConfigStorageName" != ""
488 FileWrite $R1 "s;@storage_name@;$ConfigStorageName;g$\r$\n"
490 ${If} "$ConfigStoragePort" != ""
491 FileWrite $R1 "s;@storage_port@;$ConfigStoragePort;g$\r$\n"
493 ${If} "$ConfigStorageMaxJobs" != ""
494 FileWrite $R1 "s;@storage_maxjobs@;$ConfigStorageMaxJobs;g$\r$\n"
496 ${If} "$ConfigStoragePassword" != ""
497 FileWrite $R1 "s;@storage_password@;$ConfigStoragePassword;g$\r$\n"
499 ${If} "$ConfigDirectorName" != ""
500 FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n"
502 ${If} "$ConfigDirectorPort" != ""
503 FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n"
505 ${If} "$ConfigDirectorMaxJobs" != ""
506 FileWrite $R1 "s;@director_maxjobs@;$ConfigDirectorMaxJobs;g$\r$\n"
508 ${If} "$ConfigDirectorPassword" != ""
509 FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n"
511 ${If} "$ConfigDirectorMailServer" != ""
512 FileWrite $R1 "s;@smtp_host@;$ConfigDirectorMailServer;g$\r$\n"
514 ${If} "$ConfigDirectorMailAddress" != ""
515 FileWrite $R1 "s;@job_email@;$ConfigDirectorMailAddress;g$\r$\n"
517 ${If} "$ConfigMonitorName" != ""
518 FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n"
520 ${If} "$ConfigMonitorPassword" != ""
521 FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n"
524 ${If} $ConfigDirectorDB = 1
525 ${If} $MySQLPath != ""
526 ${StrRep} $R2 "$MySQLPath\bin" "\" "\\"
527 FileWrite $R1 "s;@SQL_BINDIR@;$R2;g$\r$\n"
529 ${ElseIf} $ConfigDirectorDB = 2
530 ${If} $PostgreSQLPath != ""
531 ${StrRep} $R2 "$PostgreSQLPath\bin" "\" "\\"
532 FileWrite $R1 "s;@SQL_BINDIR@;$R2;g$\r$\n"
538 ${If} $InstallType = ${MigrateInstall}
539 FileOpen $R1 $PLUGINSDIR\migrate.sed w
540 ${StrRep} $R2 "$APPDATA\Bacula\Work" "\" "\\\\"
541 FileWrite $R1 's;\(Working *Directory *= *\)[^ ][^ ]*.*$$;\1"$R2";$\r$\n'
542 FileWrite $R1 's;\(Pid *Directory *= *\)[^ ][^ ]*.*$$;\1"$R2";$\r$\n'
546 ${If} ${FileExists} "$OldInstallDir\bin\bacula-fd.exe"
547 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
549 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /remove' ; Remove existing service
552 ${If} ${FileExists} "$OldInstallDir\bin\bacula-sd.exe"
553 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running
555 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /remove' ; Remove existing service
558 ${If} ${FileExists} "$OldInstallDir\bin\bacula-dir.exe"
559 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /kill' ; Shutdown any bacula that could be running
561 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /remove' ; Remove existing service
566 SectionGroup "Client" SecGroupClient
568 Section "File Service" SecFileDaemon
571 SetOutPath "$INSTDIR\bin\fdplugins"
572 File "${SRC_DIR}\exchange-fd.dll"
574 SetOutPath "$INSTDIR\bin"
576 File "${SRC_DIR}\bacula-fd.exe"
578 ${If} $InstallType = ${MigrateInstall}
579 ${AndIf} ${FileExists} "$OldInstallDir\bin\bacula-fd.conf"
580 CopyFiles "$OldInstallDir\bin\bacula-fd.conf" "$APPDATA\Bacula"
581 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\migrate.sed" -i.bak "$APPDATA\Bacula\bacula-fd.conf"'
583 File "/oname=$PLUGINSDIR\bacula-fd.conf" "bacula-fd.conf.in"
585 StrCpy $0 "$APPDATA\Bacula"
586 StrCpy $1 bacula-fd.conf
587 Call ConfigEditAndCopy
591 StrCpy $1 "File Service"
592 StrCpy $2 $ConfigClientInstallService
593 StrCpy $3 $ConfigClientStartService
597 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-fd.conf"'
602 SectionGroup "Server" SecGroupServer
604 Section "Storage Service" SecStorageDaemon
607 SetOutPath "$INSTDIR\bin"
609 File "${SRC_DIR}\loaderinfo.exe"
610 File "${SRC_DIR}\mt.exe"
611 File "${SRC_DIR}\mtx.exe"
612 File "${SRC_DIR}\scsitape.exe"
613 File "${SRC_DIR}\tapeinfo.exe"
614 File "${SRC_DIR}\bacula-sd.exe"
615 File "${SRC_DIR}\bcopy.exe"
616 File "${SRC_DIR}\bextract.exe"
617 File "${SRC_DIR}\bls.exe"
618 File "${SRC_DIR}\bscan.exe"
619 File "${SRC_DIR}\btape.exe"
620 File "${SRC_DIR}\scsilist.exe"
621 File "${SRC_DIR}\mkisofs.exe"
622 File "${SRC_DIR}\growisofs.exe"
623 File "${SRC_DIR}\dvd-ram-control.exe"
624 File "${SRC_DIR}\dvd+rw-booktype.exe"
625 File "${SRC_DIR}\dvd+rw-format.exe"
626 File "${SRC_DIR}\dvd+rw-mediainfo.exe"
628 File "/oname=$PLUGINSDIR\mtx-changer.cmd" "${SRC_DIR}\mtx-changer.cmd"
630 StrCpy $0 "$INSTDIR\bin"
631 StrCpy $1 mtx-changer.cmd
632 Call ConfigEditAndCopy
634 File "/oname=$PLUGINSDIR\disk-changer.cmd" "${SRC_DIR}\disk-changer.cmd"
636 StrCpy $0 "$INSTDIR\bin"
637 StrCpy $1 disk-changer.cmd
638 Call ConfigEditAndCopy
640 File "/oname=$PLUGINSDIR\dvd-handler.cmd" "${SRC_DIR}\dvd-handler.cmd"
642 StrCpy $0 "$INSTDIR\bin"
643 StrCpy $1 dvd-handler.cmd
644 Call ConfigEditAndCopy
646 File "/oname=$PLUGINSDIR\bacula-sd.conf" "bacula-sd.conf.in"
648 StrCpy $0 "$APPDATA\Bacula"
649 StrCpy $1 bacula-sd.conf
650 Call ConfigEditAndCopy
653 StrCpy $1 "Storage Service"
654 StrCpy $2 $ConfigStorageInstallService
655 StrCpy $3 $ConfigStorageStartService
658 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\List Devices.lnk" "$INSTDIR\bin\scsilist.exe" "/pause"
659 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Storage Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-sd.conf"'
662 Section "Director Service" SecDirectorDaemon
665 SetOutPath "$INSTDIR\bin"
667 ${If} $ConfigDirectorDB = 1
668 File /oname=bacula_cats.dll "${SRC_DIR}\cats_mysql.dll"
669 File "${SRC_DIR}\libmysql.dll"
670 File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_mysql_database.cmd
671 File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_mysql_database.cmd
672 File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_mysql_tables.cmd
673 File ${SRC_DIR}\make_mysql_tables.sql
674 File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_mysql_tables.cmd
675 File ${SRC_DIR}\drop_mysql_tables.sql
676 File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_mysql_privileges.cmd
677 File ${SRC_DIR}\grant_mysql_privileges.sql
678 File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_mysql_catalog_backup.cmd
679 ${ElseIf} $ConfigDirectorDB = 2
680 File /oname=bacula_cats.dll "${SRC_DIR}\cats_postgresql.dll"
681 File "${SRC_DIR}\libpq.dll"
682 !if "${BUILD_TOOLS}" == "VC8"
683 File "${SRC_DIR}\comerr32.dll"
684 File "${SRC_DIR}\libintl-2.dll"
685 File "${SRC_DIR}\libiconv-2.dll"
686 File "${SRC_DIR}\krb5_32.dll"
688 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
689 File "${SRC_DIR}\comerr32.dll"
690 File "${SRC_DIR}\libintl-2.dll"
691 File "${SRC_DIR}\libiconv-2.dll"
692 File "${SRC_DIR}\krb5_32.dll"
694 File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_postgresql_database.cmd
695 File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_postgresql_database.cmd
696 File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_postgresql_tables.cmd
697 File ${SRC_DIR}\create_postgresql_database.sql
698 File ${SRC_DIR}\make_postgresql_tables.sql
699 File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_postgresql_tables.cmd
700 File ${SRC_DIR}\drop_postgresql_tables.sql
701 File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_postgresql_privileges.cmd
702 File ${SRC_DIR}\grant_postgresql_privileges.sql
703 File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_postgresql_catalog_backup.cmd
704 ${ElseIf} $ConfigDirectorDB = 3
705 File "${SRC_DIR}\sqlite3.exe"
706 !if "${BUILD_TOOLS}" == "VC8"
707 File "${SRC_DIR}\sqlite3.exe.manifest"
709 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
710 File "${SRC_DIR}\sqlite3.exe.manifest"
712 File /oname=bacula_cats.dll "${SRC_DIR}\cats_sqlite3.dll"
713 File /oname=$PLUGINSDIR\create_database.cmd ${SRC_DIR}\create_sqlite3_database.cmd
714 File /oname=$PLUGINSDIR\drop_database.cmd ${SRC_DIR}\drop_sqlite3_database.cmd
715 File /oname=$PLUGINSDIR\make_tables.cmd ${SRC_DIR}\make_sqlite3_tables.cmd
716 File ${SRC_DIR}\make_sqlite3_tables.sql
717 File /oname=$PLUGINSDIR\drop_tables.cmd ${SRC_DIR}\drop_sqlite3_tables.cmd
718 File /oname=$PLUGINSDIR\grant_privileges.cmd ${SRC_DIR}\grant_sqlite3_privileges.cmd
719 File /oname=$PLUGINSDIR\make_catalog_backup.cmd ${SRC_DIR}\make_sqlite3_catalog_backup.cmd
722 File "${SRC_DIR}\bacula-dir.exe"
723 File "${SRC_DIR}\dbcheck.exe"
725 File "/oname=$PLUGINSDIR\delete_catalog_backup.cmd" "${SRC_DIR}\delete_catalog_backup.cmd"
727 StrCpy $0 "$INSTDIR\bin"
729 StrCpy $1 create_database.cmd
730 Call ConfigEditAndCopy
732 StrCpy $1 drop_database.cmd
733 Call ConfigEditAndCopy
735 StrCpy $1 make_tables.cmd
736 Call ConfigEditAndCopy
738 StrCpy $1 drop_tables.cmd
739 Call ConfigEditAndCopy
741 StrCpy $1 grant_privileges.cmd
742 Call ConfigEditAndCopy
744 StrCpy $1 make_catalog_backup.cmd
745 Call ConfigEditAndCopy
747 StrCpy $1 delete_catalog_backup.cmd
748 Call ConfigEditAndCopy
750 File "${SRC_DIR}\query.sql"
752 File "/oname=$PLUGINSDIR\bacula-dir.conf" "bacula-dir.conf.in"
754 StrCpy $0 "$APPDATA\Bacula"
755 StrCpy $1 bacula-dir.conf
756 Call ConfigEditAndCopy
759 StrCpy $1 "Director Service"
760 StrCpy $2 $ConfigDirectorInstallService
761 StrCpy $3 $ConfigDirectorStartService
764 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Director Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-dir.conf"'
769 SectionGroup "Consoles" SecGroupConsoles
771 Section "Command Console" SecConsole
774 SetOutPath "$INSTDIR\bin"
776 File "${SRC_DIR}\bconsole.exe"
777 Call InstallCommonFiles
779 ${If} $InstallType = ${MigrateInstall}
780 ${AndIf} ${FileExists} "$OldInstallDir\bin\bconsole.conf"
781 CopyFiles "$OldInstallDir\bin\bconsole.conf" "$APPDATA\Bacula"
783 File "/oname=$PLUGINSDIR\bconsole.conf" "bconsole.conf.in"
784 StrCpy $0 "$APPDATA\Bacula"
785 StrCpy $1 bconsole.conf
786 Call ConfigEditAndCopy
789 CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bin\bconsole.exe" '-c "$APPDATA\Bacula\bconsole.conf"' "$INSTDIR\bin\bconsole.exe" 0
790 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bconsole.conf"'
794 Section "Bat Console" SecBatConsole
797 SetOutPath "$INSTDIR\bin"
799 Call InstallCommonFiles
800 File "${SRC_DIR}\QtCore4.dll"
801 File "${SRC_DIR}\QtGui4.dll"
803 File "${SRC_DIR}\bat.exe"
805 ${If} $InstallType = ${MigrateInstall}
806 ${AndIf} ${FileExists} "$OldInstallDir\bin\bat.conf"
807 CopyFiles "$OldInstallDir\bin\bat.conf" "$APPDATA\Bacula"
809 File "/oname=$PLUGINSDIR\bat.conf" "bat.conf.in"
810 StrCpy $0 "$APPDATA\Bacula"
812 Call ConfigEditAndCopy
815 ; Create Start Menu entry
816 CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bin\bat.exe" '-c "$APPDATA\Bacula\bat.conf"' "$INSTDIR\bin\bat.exe" 0
817 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bat.conf"'
821 Section "Graphical Console" SecWxConsole
824 SetOutPath "$INSTDIR\bin"
826 Call InstallCommonFiles
827 !if "${BUILD_TOOLS}" == "VC8"
828 File "${SRC_DIR}\wxbase28_vc_bacula.dll"
829 File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll"
831 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
832 File "${SRC_DIR}\wxbase28_vc_bacula.dll"
833 File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll"
835 !if "${BUILD_TOOLS}" == "MinGW"
836 File "${SRC_DIR}\wxbase28_gcc_bacula.dll"
837 File "${SRC_DIR}\wxmsw28_core_gcc_bacula.dll"
840 File "${SRC_DIR}\bwx-console.exe"
842 ${If} $InstallType = ${MigrateInstall}
843 ${AndIf} ${FileExists} "$OldInstallDir\bin\bwx-console.conf"
844 CopyFiles "$OldInstallDir\bin\bwx-console.conf" "$APPDATA\Bacula"
846 File "/oname=$PLUGINSDIR\bwx-console.conf" "bwx-console.conf.in"
847 StrCpy $0 "$APPDATA\Bacula"
848 StrCpy $1 bwx-console.conf
849 Call ConfigEditAndCopy
852 ; Create Start Menu entry
853 CreateShortCut "$SMPROGRAMS\Bacula\bwx-console.lnk" "$INSTDIR\bin\bwx-console.exe" '-c "$APPDATA\Bacula\bwx-console.conf"' "$INSTDIR\bin\bwx-console.exe" 0
854 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Graphical Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bwx-console.conf"'
859 SectionGroup "Documentation" SecGroupDocumentation
861 Section "Documentation (Acrobat Format)" SecDocPdf
864 SetOutPath "$INSTDIR\doc"
865 CreateDirectory "$INSTDIR\doc"
867 File "${SRC_DIR}\docs\manuals\en\console\console.pdf"
868 File "${SRC_DIR}\docs\manuals\en\misc\misc.pdf"
869 File "${SRC_DIR}\docs\manuals\en\main\main.pdf"
870 File "${SRC_DIR}\docs\manuals\en\utility\utility.pdf"
871 File "${SRC_DIR}\docs\manuals\en\problems\problems.pdf"
872 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Console.lnk" '"$INSTDIR\doc\console.pdf"'
873 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Main.lnk" '"$INSTDIR\doc\main.pdf"'
874 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Misc.lnk" '"$INSTDIR\doc\misc.pdf"'
875 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Utility.lnk" '"$INSTDIR\doc\utility.pdf"'
876 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Problems.lnk" '"$INSTDIR\doc\problems.pdf"'
879 Section "Documentation (HTML Format)" SecDocHtml
882 SetOutPath "$INSTDIR\doc"
883 CreateDirectory "$INSTDIR\doc"
885 ; File "${SRC_DIR}\manual\bacula\*.html"
886 ; File "${SRC_DIR}\manual\bacula\*.png"
887 ; File "${SRC_DIR}\manual\bacula\*.css"
888 ; CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual (HTML).lnk" '"$INSTDIR\doc\index.html"'
897 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR" /T /G SYSTEM:F Administrators:F'
898 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$APPDATA\Bacula" /T /G SYSTEM:F Administrators:F'
901 ; Write the uninstall keys for Windows & create Start Menu entry
902 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula"
903 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR"
904 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}"
905 ${StrTok} $R0 "${VERSION}" "." 0 0
906 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0
907 ${StrTok} $R0 "${VERSION}" "." 1 0
908 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0
909 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1
910 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1
911 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://sourceforge.net/project/showfiles.php?group_id=50727"
912 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.bacula.org"
913 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.bacula.org/?page=support"
914 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
915 WriteUninstaller "$INSTDIR\Uninstall.exe"
916 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
920 ; Extra Page descriptions
922 LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula File Daemon on this system."
923 LangString DESC_SecStorageDaemon ${LANG_ENGLISH} "Install Bacula Storage Daemon on this system."
924 LangString DESC_SecDirectorDaemon ${LANG_ENGLISH} "Install Bacula Director Daemon on this system."
925 LangString DESC_SecConsole ${LANG_ENGLISH} "Install command console program on this system."
926 LangString DESC_SecBatConsole ${LANG_ENGLISH} "Install Bat graphical console program on this system."
927 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install wxWidgets graphical console program on this system."
928 LangString DESC_SecDocPdf ${LANG_ENGLISH} "Install documentation in Acrobat format on this system."
929 LangString DESC_SecDocHtml ${LANG_ENGLISH} "Install documentation in HTML format on this system."
931 LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration"
932 LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration."
934 LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)"
935 LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration."
937 LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type"
938 LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type."
940 LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates"
941 LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create resource templates for inclusion in the Director's configuration file."
943 !InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN
944 !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon)
945 !InsertMacro MUI_DESCRIPTION_TEXT ${SecStorageDaemon} $(DESC_SecStorageDaemon)
946 !InsertMacro MUI_DESCRIPTION_TEXT ${SecDirectorDaemon} $(DESC_SecDirectorDaemon)
947 !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
948 !InsertMacro MUI_DESCRIPTION_TEXT ${SecBatConsole} $(DESC_SecBatConsole)
949 !InsertMacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
950 !InsertMacro MUI_DESCRIPTION_TEXT ${SecDocPdf} $(DESC_SecDocPdf)
951 !InsertMacro MUI_DESCRIPTION_TEXT ${SecDocHtml} $(DESC_SecDocHtml)
952 !InsertMacro MUI_FUNCTION_DESCRIPTION_END
956 UninstallText "This will uninstall Bacula. Hit next to continue."
959 ; Shutdown any baculum that could be running
960 nsExec::ExecToLog '"$INSTDIR\bin\bacula-fd.exe" /kill'
961 nsExec::ExecToLog '"$INSTDIR\bin\bacula-sd.exe" /kill'
962 nsExec::ExecToLog '"$INSTDIR\bin\bacula-dir.exe" /kill'
965 ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd"
967 ; Remove bacula service
968 nsExec::ExecToLog '"$INSTDIR\bin\bacula-fd.exe" /remove'
969 nsExec::ExecToLog '"$INSTDIR\bin\exchange-fd.dll" /remove'
972 ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-sd"
974 ; Remove bacula service
975 nsExec::ExecToLog '"$INSTDIR\bin\bacula-sd.exe" /remove'
978 ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-dir"
980 ; Remove bacula service
981 nsExec::ExecToLog '"$INSTDIR\bin\bacula-dir.exe" /remove'
984 ; remove registry keys
985 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
986 DeleteRegKey HKLM "Software\Bacula"
988 ; remove start menu items
989 SetShellVarContext all
990 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
991 RMDir "$SMPROGRAMS\Bacula"
993 ; remove files and uninstaller (preserving config for now)
994 Delete /REBOOTOK "$INSTDIR\bin\*"
995 Delete /REBOOTOK "$INSTDIR\doc\*"
996 Delete /REBOOTOK "$INSTDIR\*"
998 ; Check for existing installation
999 MessageBox MB_YESNO|MB_ICONQUESTION \
1000 "Would you like to delete the current configuration files and the working state file?" IDNO NoDel
1001 Delete /REBOOTOK "$APPDATA\Bacula\*"
1002 Delete /REBOOTOK "$APPDATA\Bacula\Work\*"
1003 Delete /REBOOTOK "$APPDATA\Bacula\Spool\*"
1004 Delete /REBOOTOK "$PLUGINSDIR\bacula-*.conf"
1005 Delete /REBOOTOK "$PLUGINSDIR\*console.conf"
1006 Delete /REBOOTOK "$PLUGINSDIR\*conf.in"
1007 Delete /REBOOTOK "$PLUGINSDIR\openssl.exe"
1008 Delete /REBOOTOK "$PLUGINSDIR\libeay32.dll"
1009 Delete /REBOOTOK "$PLUGINSDIR\ssleay32.dll"
1010 Delete /REBOOTOK "$PLUGINSDIR\sed.exe"
1011 Delete /REBOOTOK "$PLUGINSDIR\pw.txt"
1012 Delete /REBOOTOK "$PLUGINSDIR\*.sed"
1013 Delete /REBOOTOK "$PLUGINSDIR\*.cmd"
1014 Delete /REBOOTOK "$PLUGINSDIR\*.sql"
1015 RMDir "$APPDATA\Bacula\Work"
1016 RMDir "$APPDATA\Bacula\Spool"
1017 RMDir "$APPDATA\Bacula"
1020 ; remove directories used
1021 RMDir "$INSTDIR\bin"
1022 RMDir "$INSTDIR\doc"
1027 ; $0 - Service Name (ie Bacula-FD)
1028 ; $1 - Service Description (ie Bacula File Daemon)
1029 ; $2 - Install as Service
1030 ; $3 - Start Service now
1032 Function InstallDaemon
1033 Call InstallCommonFiles
1035 WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2
1038 nsExec::ExecToLog '"$INSTDIR\bin\$0.exe" /install -c "$APPDATA\Bacula\$0.conf"'
1045 ; Start the service?
1049 nsExec::ExecToLog 'net start $0'
1051 Exec '"$INSTDIR\bin\$0.exe" -c "$APPDATA\Bacula\$0.conf"'
1055 CreateShortCut "$SMPROGRAMS\Bacula\Start $1.lnk" "$INSTDIR\bin\$0.exe" '-c "$APPDATA\Bacula\$0.conf"' "$INSTDIR\bin\$0.exe" 0
1059 Function GetComputerName
1064 System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2"
1066 ${StrCase} $R0 $R0 "L"
1073 !define ComputerNameDnsFullyQualified 3
1075 Function GetHostName
1081 System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
1084 DetailPrint "GetComputerNameExA failed - LastError = $R2"
1085 Call GetComputerName
1091 Call GetComputerName
1100 !define NameUserPrincipal 8
1102 Function GetUserName
1108 System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
1111 DetailPrint "GetUserNameExA failed - LastError = $R2"
1122 System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
1125 DetailPrint "GetUserNameA failed - LastError = $R2"
1137 Function ConfigEditAndCopy
1140 ${If} ${FileExists} "$0\$1"
1146 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\$1"'
1147 CopyFiles "$PLUGINSDIR\$1" "$0\$1$R1"
1152 Function FindDatabaseApps
1155 ReadRegStr $0 HKLM "Software\MySQL AB\MySQL Server 5.0" "Location"
1158 Call RemoveTrailingSlash
1159 StrCpy $MySQLPath $0
1160 ReadRegStr $0 HKLM "Software\MySQL AB\MySQL Server 5.0" "Version"
1161 StrCpy $MySQLVersion $0
1164 EnumRegKey $R1 HKLM "Software\PostgreSQL\Installations" 0
1166 ReadRegStr $0 HKLM "Software\PostgreSQL\Installations\$R1" "Base Directory"
1167 Call RemoveTrailingSlash
1168 StrCpy $PostgreSQLPath $0
1169 ReadRegStr $0 HKLM "Software\PostgreSQL\Installations\$R1" "Version"
1170 StrCpy $PostgreSQLVersion $0
1176 Function RemoveTrailingSlash
1185 Function IsDirectorSelected
1187 SectionGetFlags ${SecDirectorDaemon} $R0
1188 IntOp $R0 $R0 & ${SF_SELECTED}
1192 Function GetSelectedComponents
1195 ${If} ${SectionIsSelected} ${SecFileDaemon}
1196 IntOp $R0 $R0 | ${ComponentFile}
1198 ${If} ${SectionIsSelected} ${SecStorageDaemon}
1199 IntOp $R0 $R0 | ${ComponentStorage}
1201 ${If} ${SectionIsSelected} ${SecDirectorDaemon}
1202 IntOp $R0 $R0 | ${ComponentDirector}
1204 ${If} ${SectionIsSelected} ${SecConsole}
1205 IntOp $R0 $R0 | ${ComponentTextConsole}
1207 ${If} ${SectionIsSelected} ${SecBatConsole}
1208 IntOp $R0 $R0 | ${ComponentBatConsole}
1210 ${If} ${SectionIsSelected} ${SecWxConsole}
1211 IntOp $R0 $R0 | ${ComponentGUIConsole}
1213 ${If} ${SectionIsSelected} ${SecDocPdf}
1214 IntOp $R0 $R0 | ${ComponentPDFDocs}
1216 ${If} ${SectionIsSelected} ${SecDocHtml}
1217 IntOp $R0 $R0 | ${ComponentHTMLDocs}
1222 Function PageComponentsShow
1224 Call DisableServerSections
1227 Call SelectPreviousComponents
1228 Call UpdateComponentUI
1231 Function PageDirectoryPre
1232 ${If} $AutomaticInstall = 1
1233 ${OrIf} $InstallType = ${UpgradeInstall}
1238 Function LeaveInstallPage
1239 Push "$INSTDIR\install.log"
1243 Function EnterWriteTemplates
1247 Call GetSelectedComponents
1250 IntOp $R0 $R0 & ${ComponentDirector}
1251 IntOp $R1 $NewComponents & ${ComponentsFileAndStorage}
1260 IntOp $R0 $NewComponents & ${ComponentFile}
1262 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0
1263 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED
1264 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State
1265 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
1267 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 1
1268 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags
1269 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "C:\$ConfigClientName.conf"
1270 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
1273 IntOp $R0 $NewComponents & ${ComponentStorage}
1275 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 0
1276 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags DISABLED
1277 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State
1278 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
1280 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 1
1281 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags
1282 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State "C:\$ConfigStorageName.conf"
1283 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
1286 !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)"
1287 !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini"
1289 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State
1291 File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in"
1293 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"'
1294 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State
1296 CopyFiles "$PLUGINSDIR\client.conf.in" "$R0"
1300 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 4" State
1302 File "/oname=$PLUGINSDIR\storage.conf.in" "storage.conf.in"
1304 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\storage.conf.in"'
1305 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 5" State
1307 CopyFiles "$PLUGINSDIR\storage.conf.in" "$R0"
1315 Function SelectPreviousComponents
1316 ${If} $InstallType <> ${NewInstall}
1317 IntOp $R1 $PreviousComponents & ${ComponentFile}
1319 !InsertMacro SelectSection ${SecFileDaemon}
1320 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO}
1322 !InsertMacro UnselectSection ${SecFileDaemon}
1323 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO}
1325 IntOp $R1 $PreviousComponents & ${ComponentStorage}
1327 !InsertMacro SelectSection ${SecStorageDaemon}
1328 !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO}
1330 !InsertMacro UnselectSection ${SecStorageDaemon}
1331 !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_RO}
1333 IntOp $R1 $PreviousComponents & ${ComponentDirector}
1335 !InsertMacro SelectSection ${SecDirectorDaemon}
1336 !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO}
1338 !InsertMacro UnselectSection ${SecDirectorDaemon}
1339 !InsertMacro ClearSectionFlag ${SecDirectorDaemon} ${SF_RO}
1341 IntOp $R1 $PreviousComponents & ${ComponentTextConsole}
1343 !InsertMacro SelectSection ${SecConsole}
1344 !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO}
1346 !InsertMacro UnselectSection ${SecConsole}
1347 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO}
1349 IntOp $R1 $PreviousComponents & ${ComponentBatConsole}
1351 !InsertMacro SelectSection ${SecBatConsole}
1352 !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_RO}
1354 !InsertMacro UnselectSection ${SecBatConsole}
1355 !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_RO}
1357 IntOp $R1 $PreviousComponents & ${ComponentGUIConsole}
1359 !InsertMacro SelectSection ${SecWxConsole}
1360 !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_RO}
1362 !InsertMacro UnselectSection ${SecWxConsole}
1363 !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_RO}
1365 IntOp $R1 $PreviousComponents & ${ComponentPDFDocs}
1367 !InsertMacro SelectSection ${SecDocPdf}
1368 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO}
1370 !InsertMacro UnselectSection ${SecDocPdf}
1371 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO}
1373 IntOp $R1 $PreviousComponents & ${ComponentHTMLDocs}
1375 !InsertMacro SelectSection ${SecDocHtml}
1376 !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_RO}
1378 !InsertMacro UnselectSection ${SecDocHtml}
1379 !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_RO}
1384 Function DisableServerSections
1385 !InsertMacro UnselectSection ${SecGroupServer}
1386 !InsertMacro SetSectionFlag ${SecGroupServer} ${SF_RO}
1387 !InsertMacro UnselectSection ${SecStorageDaemon}
1388 !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO}
1389 !InsertMacro UnselectSection ${SecDirectorDaemon}
1390 !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO}
1393 Function UpdateComponentUI
1397 Call GetSelectedComponents
1400 IntOp $R1 $R0 ^ $PreviousComponents
1401 IntOp $NewComponents $R0 & $R1
1403 ${If} $InstallType <> ${NewInstall}
1404 IntOp $R1 $NewComponents & ${ComponentFile}
1406 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD}
1408 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD}
1410 IntOp $R1 $NewComponents & ${ComponentStorage}
1412 !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_BOLD}
1414 !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_BOLD}
1416 IntOp $R1 $NewComponents & ${ComponentDirector}
1418 !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_BOLD}
1420 !InsertMacro ClearSectionFlag ${SecDirectorDaemon} ${SF_BOLD}
1422 IntOp $R1 $NewComponents & ${ComponentTextConsole}
1424 !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD}
1426 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD}
1428 IntOp $R1 $NewComponents & ${ComponentBatConsole}
1430 !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_BOLD}
1432 !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_BOLD}
1434 IntOp $R1 $NewComponents & ${ComponentGUIConsole}
1436 !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_BOLD}
1438 !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_BOLD}
1440 IntOp $R1 $NewComponents & ${ComponentPDFDocs}
1442 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_BOLD}
1444 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_BOLD}
1446 IntOp $R1 $NewComponents & ${ComponentHTMLDocs}
1448 !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_BOLD}
1450 !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_BOLD}
1454 GetDlgItem $R0 $HWNDPARENT 1
1456 IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig}
1458 SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install"
1460 SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >"
1467 !include "InstallType.nsh"
1468 !include "ConfigPage1.nsh"
1469 !include "ConfigPage2.nsh"
1470 !include "DumpLog.nsh"