3 ; Began as a version written by Michel Meyers (michel@tcnnet.dyndns.org)
5 ; Adapted by Kern Sibbald for native Win32 Bacula
6 ; added a number of elements from Christopher Hull's installer
8 ; D. Scott Barninger Nov 13 2004
9 ; added configuration editing for bconsole.conf and bwx-console.conf
10 ; better explanation in dialog boxes for editing config files
11 ; added Start Menu items
12 ; fix uninstall of config files to do all not just bacula-fd.conf
14 ; D. Scott Barninger Dec 05 2004
15 ; added specification of default permissions for bacula-fd.conf
16 ; - thanks to Jamie Ffolliott for pointing me at cacls
17 ; added removal of working-dir files if user selects to remove config
18 ; uninstall is now 100% clean
20 ; D. Scott Barninger Apr 17 2005
21 ; 1.36.3 release docs update
22 ; add pdf manual and menu shortcut
24 ; Robert Nelson May 15 2006
25 ; Added server installs and implemented Microsoft install locations
27 ; Added Bacula-SD and Bacula-DIR
28 ; Replaced ParameterGiven with standard GetOptions
30 ; Kern Sibbald October 2008
31 ; Remove server installs
32 ; Install into single bacula directory
33 ; (i.e. undo a large part of what Robert Nelson did)
35 ; Version $Id: winbacula.nsi 7074 2008-05-31 18:43:21Z kerns $
37 ; Command line options:
42 ; netsh firewall add portopening protocol=tcp port=9102 name="Bacula-FD"
45 !define PRODUCT "Bacula"
48 ; Include the Modern UI
52 !include "LogicLib.nsh"
53 !include "FileFunc.nsh"
54 !include "Sections.nsh"
55 !include "StrFunc.nsh"
56 !include "WinMessages.nsh"
61 OutFile "${OUT_DIR}\winbaculasystems-${VERSION}.exe"
63 InstallDir "$PROGRAMFILES\bacula"
65 InstallDirRegKey HKLM "Software\Bacula" "InstallLocation"
69 !insertmacro GetParent
80 !define MUI_COMPONENTSPAGE_SMALLDESC
82 !define MUI_HEADERIMAGE
83 !define MUI_BGCOLOR 739AB9
84 !define MUI_HEADERIMAGE_BITMAP "bacula-logo.bmp"
86 !InsertMacro MUI_PAGE_WELCOME
87 !InsertMacro MUI_PAGE_LICENSE "..\..\..\LICENSE"
88 Page custom EnterInstallType
89 !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageComponentsShow
90 !InsertMacro MUI_PAGE_COMPONENTS
91 !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
92 !InsertMacro MUI_PAGE_DIRECTORY
93 Page custom EnterConfigPage1 LeaveConfigPage1
94 Page custom EnterConfigPage2 LeaveConfigPage2
95 !Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage
96 !InsertMacro MUI_PAGE_INSTFILES
97 Page custom EnterWriteTemplates
98 !Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt
99 !InsertMacro MUI_PAGE_FINISH
101 !InsertMacro MUI_UNPAGE_WELCOME
102 !InsertMacro MUI_UNPAGE_CONFIRM
103 !InsertMacro MUI_UNPAGE_INSTFILES
104 !InsertMacro MUI_UNPAGE_FINISH
106 !define MUI_ABORTWARNING
108 !InsertMacro MUI_LANGUAGE "English"
110 !InsertMacro GetParameters
111 !InsertMacro GetOptions
113 DirText "Setup will install Bacula Systems ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder."
115 !InsertMacro MUI_RESERVEFILE_INSTALLOPTIONS
131 Var ConfigClientMaxJobs
132 Var ConfigClientPassword
133 Var ConfigClientInstallService
134 Var ConfigClientStartService
136 Var ConfigStorageName
137 Var ConfigStoragePort
138 Var ConfigStorageMaxJobs
139 Var ConfigStoragePassword
140 Var ConfigStorageInstallService
141 Var ConfigStorageStartService
143 Var ConfigDirectorName
144 Var ConfigDirectorPort
145 Var ConfigDirectorMaxJobs
146 Var ConfigDirectorPassword
147 Var ConfigDirectorAddress
148 Var ConfigDirectorMailServer
149 Var ConfigDirectorMailAddress
151 Var ConfigDirectorInstallService
152 Var ConfigDirectorStartService
154 Var ConfigMonitorName
155 Var ConfigMonitorPassword
157 Var LocalDirectorPassword
163 Var PostgreSQLVersion
169 !define UpgradeInstall 1
170 !define MigrateInstall 2
173 Var PreviousComponents
176 ; Bit 0 = File Service
177 ; 1 = Storage Service
178 ; 2 = Director Service
179 ; 3 = Command Console
180 ; 4 = Graphical Console
181 ; 5 = Documentation (PDF)
182 ; 6 = Documentation (HTML)
184 !define ComponentFile 1
185 !define ComponentStorage 2
186 !define ComponentDirector 4
187 !define ComponentTextConsole 8
188 !define ComponentGUIConsole 16
189 !define ComponentPDFDocs 32
190 !define ComponentHTMLDocs 64
192 !define ComponentsRequiringUserConfig 31
193 !define ComponentsFileAndStorage 3
194 !define ComponentsFileAndStorageAndDirector 7
195 !define ComponentsDirectorAndTextGuiConsoles 28
196 !define ComponentsTextAndGuiConsoles 24
205 ; Process Command Line Options
209 StrCpy $CommonFilesDone 0
211 StrCpy $AutomaticInstall 0
212 StrCpy $InstallType ${NewInstall}
213 StrCpy $OldInstallDir ""
214 StrCpy $PreviousComponents 0
215 StrCpy $NewComponents 0
217 StrCpy $MySQLVersion ""
218 StrCpy $PostgreSQLPath ""
219 StrCpy $PostgreSQLVersion ""
220 StrCpy $LocalDirectorPassword ""
225 ${GetOptions} $R0 "/noservice" $R1
230 ${GetOptions} $R0 "/nostart" $R1
237 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
246 Pop $LocalHostAddress
250 ; Configuration Defaults
252 StrCpy $ConfigClientName "$HostName-fd"
253 StrCpy $ConfigClientPort 9102
254 StrCpy $ConfigClientMaxJobs 2
255 ;StrCpy $ConfigClientPassword
256 StrCpy $ConfigClientInstallService "$OptService"
257 StrCpy $ConfigClientStartService "$OptStart"
260 StrCpy $ConfigMonitorName "$HostName-mon"
261 ;StrCpy $ConfigMonitorPassword
264 File "/oname=$PLUGINSDIR\openssl.exe" "${SRC_DIR}\openssl.exe"
265 File "/oname=$PLUGINSDIR\libeay32.dll" "${SRC_DIR}\libeay32.dll"
266 File "/oname=$PLUGINSDIR\ssleay32.dll" "${SRC_DIR}\ssleay32.dll"
267 File "/oname=$PLUGINSDIR\sed.exe" "${SRC_DIR}\sed.exe"
269 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini"
270 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini"
272 SetPluginUnload alwaysoff
274 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
277 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
280 ${StrTrimNewLines} $ConfigClientPassword $R0
284 SetPluginUnload manual
286 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
289 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
292 ${StrTrimNewLines} $ConfigMonitorPassword $R0
300 Function .onSelChange
301 Call UpdateComponentUI
304 Function InstallCommonFiles
305 ${If} $CommonFilesDone = 0
306 SetOutPath "$INSTDIR"
309 SetOutPath "$INSTDIR"
310 !if "${BUILD_TOOLS}" == "VC8"
311 File "${SRC_DIR}\msvcm80.dll"
312 File "${SRC_DIR}\msvcp80.dll"
313 File "${SRC_DIR}\msvcr80.dll"
314 File "${SRC_DIR}\Microsoft.VC80.CRT.manifest"
315 File "${SRC_DIR}\pthreadVCE.dll"
317 !if "${BUILD_TOOLS}" == "VC8_DEBUG"
318 File "${SRC_DIR}\msvcm80.dll"
319 File "${SRC_DIR}\msvcp80.dll"
320 File "${SRC_DIR}\msvcr80.dll"
321 File "${SRC_DIR}\Microsoft.VC80.CRT.manifest"
322 File "${SRC_DIR}\msvcm80d.dll"
323 File "${SRC_DIR}\msvcp80d.dll"
324 File "${SRC_DIR}\msvcr80d.dll"
325 File "${SRC_DIR}\Microsoft.VC80.DebugCRT.manifest"
326 File "${SRC_DIR}\pthreadVCE.dll"
328 !if "${BUILD_TOOLS}" == "MinGW"
329 File "${SRC_DIR}\mingwm10.dll"
330 File "${SRC_DIR}\pthreadGCE.dll"
332 File "${SRC_DIR}\libeay32.dll"
333 File "${SRC_DIR}\ssleay32.dll"
334 File "${SRC_DIR}\zlib1.dll"
335 !if "${BUILD_TOOLS}" == "VC8"
336 File "${SRC_DIR}\zlib1.dll.manifest"
338 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
339 File "${SRC_DIR}\zlib1.dll.manifest"
341 File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf"
342 File "${SRC_DIR}\openssl.exe"
343 File "${SRC_DIR}\bsleep.exe"
344 File "${SRC_DIR}\bsmtp.exe"
345 File "${SRC_DIR}\bacula.dll"
346 File "${SRC_DIR}\expr64.exe"
347 File "${SRC_DIR}\snooze.exe"
349 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"'
351 StrCpy $CommonFilesDone 1
355 Section "-Initialize"
357 WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR"
359 Call GetSelectedComponents
361 WriteRegDWORD HKLM Software\Bacula Components $R2
363 ; remove start menu items
364 SetShellVarContext all
366 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*"
367 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*"
368 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
369 RMDir "$SMPROGRAMS\Bacula\Configuration"
370 RMDir "$SMPROGRAMS\Bacula\Documentation"
371 RMDir "$SMPROGRAMS\Bacula"
372 CreateDirectory "$SMPROGRAMS\Bacula"
373 CreateDirectory "$SMPROGRAMS\Bacula\Configuration"
374 CreateDirectory "$SMPROGRAMS\Bacula\Documentation"
376 CreateDirectory "$INSTDIR"
377 CreateDirectory "$INSTDIR\working"
379 SetOutPath "$INSTDIR"
380 File "..\..\..\LICENSE"
381 Delete /REBOOTOK "$INSTDIR\License.txt"
383 FileOpen $R1 $PLUGINSDIR\config.sed w
384 FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n"
385 FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n"
386 FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n"
388 !If "$BUILD_TOOLS" == "MinGW"
398 FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n"
400 ${StrRep} $R2 "$INSTDIR\working" "\" "\\\\"
401 FileWrite $R1 's;@working_dir@;$R2;g$\r$\n'
402 ${StrRep} $R2 "$INSTDIR\working" "\" "\\"
403 FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n'
405 ${StrRep} $R2 "$INSTDIR" "\" "\\\\"
406 FileWrite $R1 's;@bin_dir@;$R2;g$\r$\n'
407 ${StrRep} $R2 "$INSTDIR" "\" "\\"
408 FileWrite $R1 's;@bin_dir_cmd@;$R2;g$\r$\n'
410 ${StrRep} $R2 "$INSTDIR\plugins" "\" "\\\\"
411 FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n'
413 ${StrRep} $R2 "$INSTDIR" "\" "/"
414 FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n"
416 FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n"
418 ${If} "$ConfigClientName" != ""
419 FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n"
421 ${If} "$ConfigClientPort" != ""
422 FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n"
424 ${If} "$ConfigClientMaxJobs" != ""
425 FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n"
427 ${If} "$ConfigClientPassword" != ""
428 FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n"
430 ${If} "$ConfigMonitorName" != ""
431 FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n"
433 ${If} "$ConfigMonitorPassword" != ""
434 FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n"
440 ${If} ${FileExists} "$OldInstallDir\bin\bacula-fd.exe"
441 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
443 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-fd.exe" /remove' ; Remove existing service
446 ${If} ${FileExists} "$OldInstallDir\bin\bacula-sd.exe"
447 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running
449 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /remove' ; Remove existing service
452 ${If} ${FileExists} "$OldInstallDir\bin\bacula-dir.exe"
453 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /kill' ; Shutdown any bacula that could be running
455 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-dir.exe" /remove' ; Remove existing service
460 SectionGroup "Client" SecGroupClient
462 Section "File Service" SecFileDaemon
465 SetOutPath "$INSTDIR\plugins"
466 File "${SRC_DIR}\exchange-fd.dll"
468 SetOutPath "$INSTDIR"
470 File "${SRC_DIR}\bacula-fd.exe"
472 File "/oname=$PLUGINSDIR\bacula-fd.conf" "bacula-fd.conf.in"
475 StrCpy $1 bacula-fd.conf
476 Call ConfigEditAndCopy
479 StrCpy $1 "File Service"
480 StrCpy $2 $ConfigClientInstallService
481 StrCpy $3 $ConfigClientStartService
485 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$INSTDIR\bacula-fd.conf"'
491 SectionGroup "Consoles" SecGroupConsoles
493 Section "Command Console" SecConsole
496 SetOutPath "$INSTDIR"
498 File "${SRC_DIR}\bconsole.exe"
499 Call InstallCommonFiles
501 CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bconsole.exe" '-c "$INSTDIR\bconsole.conf"' "$INSTDIR\bconsole.exe" 0
502 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$INSTDIR\bconsole.conf"'
506 Section "Graphical Console" SecWxConsole
509 SetOutPath "$INSTDIR"
511 Call InstallCommonFiles
512 !if "${BUILD_TOOLS}" == "VC8"
513 File "${SRC_DIR}\wxbase28_vc_bacula.dll"
514 File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll"
516 !If "${BUILD_TOOLS}" == "VC8_DEBUG"
517 File "${SRC_DIR}\wxbase28_vc_bacula.dll"
518 File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll"
520 !if "${BUILD_TOOLS}" == "MinGW"
521 File "${SRC_DIR}\wxbase28_gcc_bacula.dll"
522 File "${SRC_DIR}\wxmsw28_core_gcc_bacula.dll"
525 File "${SRC_DIR}\bwx-console.exe"
527 File "/oname=$PLUGINSDIR\bwx-console.conf" "bwx-console.conf.in"
529 StrCpy $1 bwx-console.conf
530 Call ConfigEditAndCopy
532 ; Create Start Menu entry
533 CreateShortCut "$SMPROGRAMS\Bacula\bwx-console.lnk" "$INSTDIR\bwx-console.exe" '-c "$INSTDIR\bwx-console.conf"' "$INSTDIR\bwx-console.exe" 0
534 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Graphical Console Configuration.lnk" "write.exe" '"$INSTDIR\bwx-console.conf"'
539 SectionGroup "Documentation" SecGroupDocumentation
541 Section "Documentation (Acrobat Format)" SecDocPdf
544 SetOutPath "$INSTDIR\doc"
545 CreateDirectory "$INSTDIR\doc"
547 File "${SRC_DIR}\manual\bacula.pdf"
548 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual.lnk" '"$INSTDIR\doc\bacula.pdf"'
551 Section "Documentation (HTML Format)" SecDocHtml
554 SetOutPath "$INSTDIR\doc"
555 CreateDirectory "$INSTDIR\doc"
557 File "${SRC_DIR}\manual\bacula\*.html"
558 File "${SRC_DIR}\manual\bacula\*.png"
559 File "${SRC_DIR}\manual\bacula\*.css"
560 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual (HTML).lnk" '"$INSTDIR\doc\index.html"'
569 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR" /T /G SYSTEM:F Administrators:F'
570 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR" /T /G SYSTEM:F Administrators:F'
573 ; Write the uninstall keys for Windows & create Start Menu entry
574 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula"
575 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR"
576 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}"
577 ${StrTok} $R0 "${VERSION}" "." 0 0
578 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0
579 ${StrTok} $R0 "${VERSION}" "." 1 0
580 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0
581 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1
582 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1
583 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://sourceforge.net/project/showfiles.php?group_id=50727"
584 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.bacula.org"
585 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.bacula.org/?page=support"
586 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
587 WriteUninstaller "$INSTDIR\Uninstall.exe"
588 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
592 ; Extra Page descriptions
594 LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula File Daemon on this system."
595 LangString DESC_SecConsole ${LANG_ENGLISH} "Install command console program on this system."
596 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install graphical console program on this system."
597 LangString DESC_SecDocPdf ${LANG_ENGLISH} "Install documentation in Acrobat format on this system."
598 LangString DESC_SecDocHtml ${LANG_ENGLISH} "Install documentation in HTML format on this system."
600 LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration"
601 LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration."
603 LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)"
604 LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration."
606 LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type"
607 LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type."
609 LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates"
610 LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create resource templates for inclusion in the Director's configuration file."
612 !InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN
613 !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon)
614 !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
615 !InsertMacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
616 !InsertMacro MUI_DESCRIPTION_TEXT ${SecDocPdf} $(DESC_SecDocPdf)
617 !InsertMacro MUI_DESCRIPTION_TEXT ${SecDocHtml} $(DESC_SecDocHtml)
618 !InsertMacro MUI_FUNCTION_DESCRIPTION_END
622 UninstallText "This will uninstall Bacula. Hit next to continue."
625 ; Shutdown any baculum that could be running
626 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill'
629 ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd"
631 ; Remove bacula service
632 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /remove'
633 nsExec::ExecToLog '"$INSTDIR\plugins\exchange-fd.dll" /remove'
636 ; remove registry keys
637 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
638 DeleteRegKey HKLM "Software\Bacula"
640 ; remove start menu items
641 SetShellVarContext all
642 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
643 RMDir "$SMPROGRAMS\Bacula"
645 ; remove files and uninstaller (preserving config for now)
646 Delete /REBOOTOK "$INSTDIR\doc\*"
647 Delete /REBOOTOK "$INSTDIR\*"
649 ; Check for existing installation
650 MessageBox MB_YESNO|MB_ICONQUESTION \
651 "Would you like to delete the current configuration files and the working state file?" IDNO NoDel
652 Delete /REBOOTOK "$INSTDIR\*"
653 Delete /REBOOTOK "$INSTDIR\working\*"
654 Delete /REBOOTOK "$PLUGINSDIR\bacula-*.conf"
655 Delete /REBOOTOK "$PLUGINSDIR\*console.conf"
656 Delete /REBOOTOK "$PLUGINSDIR\*conf.in"
657 Delete /REBOOTOK "$PLUGINSDIR\openssl.exe"
658 Delete /REBOOTOK "$PLUGINSDIR\libeay32.dll"
659 Delete /REBOOTOK "$PLUGINSDIR\ssleay32.dll"
660 Delete /REBOOTOK "$PLUGINSDIR\sed.exe"
661 Delete /REBOOTOK "$PLUGINSDIR\pw.txt"
662 Delete /REBOOTOK "$PLUGINSDIR\*.sed"
663 Delete /REBOOTOK "$PLUGINSDIR\*.cmd"
664 Delete /REBOOTOK "$PLUGINSDIR\*.sql"
665 RMDir "$INSTDIR\working"
669 ; remove directories used
675 ; $0 - Service Name (ie Bacula-FD)
676 ; $1 - Service Description (ie Bacula File Daemon)
677 ; $2 - Install as Service
678 ; $3 - Start Service now
680 Function InstallDaemon
681 Call InstallCommonFiles
683 WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2
686 nsExec::ExecToLog '"$INSTDIR\$0.exe" /install -c "$INSTDIR\$0.conf"'
697 nsExec::ExecToLog 'net start $0'
699 Exec '"$INSTDIR\$0.exe" -c "$INSTDIR\$0.conf"'
703 CreateShortCut "$SMPROGRAMS\Bacula\Start $1.lnk" "$INSTDIR\$0.exe" '-c "$INSTDIR\$0.conf"' "$INSTDIR\$0.exe" 0
707 Function GetComputerName
712 System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2"
714 ${StrCase} $R0 $R0 "L"
721 !define ComputerNameDnsFullyQualified 3
729 System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
732 DetailPrint "GetComputerNameExA failed - LastError = $R2"
748 !define NameUserPrincipal 8
756 System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
759 DetailPrint "GetUserNameExA failed - LastError = $R2"
770 System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
773 DetailPrint "GetUserNameA failed - LastError = $R2"
785 Function ConfigEditAndCopy
788 ${If} ${FileExists} "$0\$1"
794 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\$1"'
795 CopyFiles "$PLUGINSDIR\$1" "$0\$1$R1"
800 Function GetSelectedComponents
803 ${If} ${SectionIsSelected} ${SecFileDaemon}
804 IntOp $R0 $R0 | ${ComponentFile}
806 ${If} ${SectionIsSelected} ${SecConsole}
807 IntOp $R0 $R0 | ${ComponentTextConsole}
809 ${If} ${SectionIsSelected} ${SecWxConsole}
810 IntOp $R0 $R0 | ${ComponentGUIConsole}
812 ${If} ${SectionIsSelected} ${SecDocPdf}
813 IntOp $R0 $R0 | ${ComponentPDFDocs}
815 ${If} ${SectionIsSelected} ${SecDocHtml}
816 IntOp $R0 $R0 | ${ComponentHTMLDocs}
821 Function PageComponentsShow
823 Call SelectPreviousComponents
824 Call UpdateComponentUI
827 Function PageDirectoryPre
828 ${If} $AutomaticInstall = 1
829 ${OrIf} $InstallType = ${UpgradeInstall}
834 Function LeaveInstallPage
835 Push "$INSTDIR\install.log"
839 Function EnterWriteTemplates
843 Call GetSelectedComponents
846 IntOp $R0 $R0 & ${ComponentDirector}
847 IntOp $R1 $NewComponents & ${ComponentsFileAndStorage}
856 IntOp $R0 $NewComponents & ${ComponentFile}
858 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0
859 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED
860 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State
861 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
863 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 1
864 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags
865 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "C:\$ConfigClientName.conf"
866 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
870 !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)"
871 !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini"
873 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State
875 File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in"
877 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"'
878 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State
880 CopyFiles "$PLUGINSDIR\client.conf.in" "$R0"
889 Function SelectPreviousComponents
890 ${If} $InstallType <> ${NewInstall}
891 IntOp $R1 $PreviousComponents & ${ComponentFile}
893 !InsertMacro SelectSection ${SecFileDaemon}
894 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO}
896 !InsertMacro UnselectSection ${SecFileDaemon}
897 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO}
899 IntOp $R1 $PreviousComponents & ${ComponentTextConsole}
901 !InsertMacro SelectSection ${SecConsole}
902 !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO}
904 !InsertMacro UnselectSection ${SecConsole}
905 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO}
907 IntOp $R1 $PreviousComponents & ${ComponentGUIConsole}
909 !InsertMacro SelectSection ${SecWxConsole}
910 !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_RO}
912 !InsertMacro UnselectSection ${SecWxConsole}
913 !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_RO}
915 IntOp $R1 $PreviousComponents & ${ComponentPDFDocs}
917 !InsertMacro SelectSection ${SecDocPdf}
918 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO}
920 !InsertMacro UnselectSection ${SecDocPdf}
921 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO}
923 IntOp $R1 $PreviousComponents & ${ComponentHTMLDocs}
925 !InsertMacro SelectSection ${SecDocHtml}
926 !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_RO}
928 !InsertMacro UnselectSection ${SecDocHtml}
929 !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_RO}
934 Function UpdateComponentUI
938 Call GetSelectedComponents
941 IntOp $R1 $R0 ^ $PreviousComponents
942 IntOp $NewComponents $R0 & $R1
944 ${If} $InstallType <> ${NewInstall}
945 IntOp $R1 $NewComponents & ${ComponentFile}
947 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD}
949 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD}
951 IntOp $R1 $NewComponents & ${ComponentTextConsole}
953 !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD}
955 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD}
957 IntOp $R1 $NewComponents & ${ComponentGUIConsole}
959 !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_BOLD}
961 !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_BOLD}
963 IntOp $R1 $NewComponents & ${ComponentPDFDocs}
965 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_BOLD}
967 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_BOLD}
969 IntOp $R1 $NewComponents & ${ComponentHTMLDocs}
971 !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_BOLD}
973 !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_BOLD}
977 GetDlgItem $R0 $HWNDPARENT 1
979 IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig}
981 SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install"
983 SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >"
991 !include "InstallType.nsh"
992 !include "ConfigPage1.nsh"
993 !include "ConfigPage2.nsh"
994 !include "DumpLog.nsh"