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 2010
31 ; Remove server installs
32 ; Install into single bacula directory
33 ; (i.e. undo a large part of what Robert Nelson did)
36 ; Command line options:
41 ; netsh firewall add portopening protocol=tcp port=9102 name="Bacula-FD"
44 !define PRODUCT "Bacula"
47 ; Include the Modern UI
51 !include "LogicLib.nsh"
52 !include "FileFunc.nsh"
53 !include "Sections.nsh"
54 !include "StrFunc.nsh"
55 !include "WinMessages.nsh"
60 OutFile "${OUT_DIR}\win${WINVER}bacula-${VERSION}.exe"
63 InstallDir "C:\Program Files\Bacula"
64 InstallDirRegKey HKLM "Software\Bacula" "InstallLocation"
70 !insertmacro GetParent
81 !define MUI_COMPONENTSPAGE_SMALLDESC
83 !define MUI_HEADERIMAGE
84 !define MUI_BGCOLOR 739AB9
85 !define MUI_HEADERIMAGE_BITMAP "bacula-logo.bmp"
87 !InsertMacro MUI_PAGE_WELCOME
88 !InsertMacro MUI_PAGE_LICENSE "..\..\..\LICENSE"
89 Page custom EnterInstallType
90 !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageComponentsShow
91 !InsertMacro MUI_PAGE_COMPONENTS
92 !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
93 !InsertMacro MUI_PAGE_DIRECTORY
94 Page custom EnterConfigPage1 LeaveConfigPage1
95 Page custom EnterConfigPage2 LeaveConfigPage2
96 !Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage
97 !InsertMacro MUI_PAGE_INSTFILES
98 Page custom EnterWriteTemplates
99 !Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt
100 !InsertMacro MUI_PAGE_FINISH
102 !InsertMacro MUI_UNPAGE_WELCOME
103 !InsertMacro MUI_UNPAGE_CONFIRM
104 !InsertMacro MUI_UNPAGE_INSTFILES
105 !InsertMacro MUI_UNPAGE_FINISH
107 !define MUI_ABORTWARNING
109 !InsertMacro MUI_LANGUAGE "English"
111 !InsertMacro GetParameters
112 !InsertMacro GetOptions
114 DirText "Setup will install Bacula ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder."
116 !InsertMacro MUI_RESERVEFILE_INSTALLOPTIONS
132 Var ConfigClientMaxJobs
133 Var ConfigClientPassword
134 Var ConfigClientInstallService
135 Var ConfigClientStartService
137 Var ConfigStorageName
138 Var ConfigStoragePort
139 Var ConfigStorageMaxJobs
140 Var ConfigStoragePassword
141 Var ConfigStorageInstallService
142 Var ConfigStorageStartService
144 Var ConfigDirectorName
145 Var ConfigDirectorPort
146 Var ConfigDirectorMaxJobs
147 Var ConfigDirectorPassword
148 Var ConfigDirectorAddress
149 Var ConfigDirectorMailServer
150 Var ConfigDirectorMailAddress
152 Var ConfigDirectorInstallService
153 Var ConfigDirectorStartService
155 Var ConfigMonitorName
156 Var ConfigMonitorPassword
158 Var LocalDirectorPassword
164 Var PostgreSQLVersion
170 !define UpgradeInstall 1
171 !define MigrateInstall 2
174 Var PreviousComponents
177 ; Bit 0 = File Service
178 ; 1 = Storage Service
179 ; 2 = Director Service
180 ; 3 = Command Console
182 ; 5 = wxWidgits Console
183 ; 6 = Documentation (PDF)
184 ; 7 = Documentation (HTML)
186 !define ComponentFile 1
187 !define ComponentStorage 2
188 !define ComponentDirector 4
189 !define ComponentTextConsole 8
190 !define ComponentBatConsole 16
191 !define ComponentGUIConsole 32
192 !define ComponentPDFDocs 64
193 !define ComponentHTMLDocs 128
195 !define ComponentsRequiringUserConfig 63
196 !define ComponentsFileAndStorage 3
197 !define ComponentsFileAndStorageAndDirector 7
198 !define ComponentsDirectorAndTextGuiConsoles 60
199 !define ComponentsTextAndGuiConsoles 56
208 ; Process Command Line Options
212 StrCpy $CommonFilesDone 0
214 StrCpy $AutomaticInstall 0
215 StrCpy $InstallType ${NewInstall}
216 StrCpy $OldInstallDir ""
217 StrCpy $PreviousComponents 0
218 StrCpy $NewComponents 0
220 StrCpy $MySQLVersion ""
221 StrCpy $PostgreSQLPath ""
222 StrCpy $PostgreSQLVersion ""
223 StrCpy $LocalDirectorPassword ""
228 ${GetOptions} $R0 "/noservice" $R1
233 ${GetOptions} $R0 "/nostart" $R1
240 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
249 Pop $LocalHostAddress
253 ; Configuration Defaults
255 StrCpy $ConfigClientName "$HostName-fd"
256 StrCpy $ConfigClientPort 9102
257 StrCpy $ConfigClientMaxJobs 10
258 ;StrCpy $ConfigClientPassword
259 StrCpy $ConfigClientInstallService "$OptService"
260 StrCpy $ConfigClientStartService "$OptStart"
262 StrCpy $ConfigDirectorPort 9101
264 StrCpy $ConfigMonitorName "$HostName-mon"
265 ;StrCpy $ConfigMonitorPassword
267 ; PLUGINSDIR refers to temporary helper programs and not Bacula plugins!
269 File "/oname=$PLUGINSDIR\openssl.exe" "${SRC_DIR}\openssl.exe"
270 File "/oname=$PLUGINSDIR\libeay32.dll" "${SRC_DIR}\libeay32.dll"
271 File "/oname=$PLUGINSDIR\ssleay32.dll" "${SRC_DIR}\ssleay32.dll"
272 File "/oname=$PLUGINSDIR\sed.exe" "${SRC_DIR}\sed.exe"
274 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini"
275 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini"
277 SetPluginUnload alwaysoff
279 ; Set client password
280 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
283 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
286 ${StrTrimNewLines} $ConfigClientPassword $R0
290 SetPluginUnload manual
292 ; Set monitor password
293 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
296 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
299 ${StrTrimNewLines} $ConfigMonitorPassword $R0
307 Function .onSelChange
308 Call UpdateComponentUI
311 Function InstallCommonFiles
312 ${If} $CommonFilesDone = 0
313 SetOutPath "$INSTDIR"
316 SetOutPath "$INSTDIR"
317 !if "${BUILD_TOOLS}" == "MinGW32"
318 File "${SRC_DIR}\mingwm10.dll"
319 File "${SRC_DIR}\pthreadGCE.dll"
320 File "${SRC_DIR}\zlib1.dll"
321 File "${SRC_DIR}\ssleay32.dll"
322 File "${SRC_DIR}\libeay32.dll"
324 !if "${BUILD_TOOLS}" == "MinGW64"
325 File "${SRC_DIR}\pthreadGCE.dll"
326 File "${SRC_DIR}\cryptoeay32-0.9.8.dll"
327 File "${SRC_DIR}\ssleay32-0.9.8.dll"
328 File "${SRC_DIR}\zlib1.dll"
330 File "${SRC_DIR}\bacula.dll"
332 File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf"
333 File "${SRC_DIR}\openssl.exe"
334 File "${SRC_DIR}\bsleep.exe"
335 File "${SRC_DIR}\bsmtp.exe"
336 File "${SRC_DIR}\expr64.exe"
337 File "${SRC_DIR}\snooze.exe"
339 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"'
341 StrCpy $CommonFilesDone 1
345 Section "-Initialize"
347 WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR"
349 Call GetSelectedComponents
351 WriteRegDWORD HKLM Software\Bacula Components $R2
353 ; remove start menu items
354 SetShellVarContext all
356 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*"
357 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*"
358 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
359 RMDir "$SMPROGRAMS\Bacula\Configuration"
360 RMDir "$SMPROGRAMS\Bacula\Documentation"
361 RMDir "$SMPROGRAMS\Bacula"
362 CreateDirectory "$SMPROGRAMS\Bacula"
363 CreateDirectory "$SMPROGRAMS\Bacula\Configuration"
364 CreateDirectory "$SMPROGRAMS\Bacula\Documentation"
366 CreateDirectory "$INSTDIR"
367 CreateDirectory "$INSTDIR\working"
369 SetOutPath "$INSTDIR"
370 File "..\..\..\LICENSE"
371 Delete /REBOOTOK "$INSTDIR\License.txt"
373 ; Output a series of SED commands to configure the .conf file(s)
374 FileOpen $R1 $PLUGINSDIR\config.sed w
375 FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n"
376 FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n"
377 FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n"
379 StrCpy $R2 ${BUILD_TOOLS}
385 FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n"
387 ${StrRep} $R2 "$INSTDIR\working" "\" "\\\\"
388 FileWrite $R1 's;@working_dir@;$R2;g$\r$\n'
389 ${StrRep} $R2 "$INSTDIR\working" "\" "\\"
390 FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n'
392 ; ${StrRep} $R2 "$INSTDIR" "\" "\\\\"
393 ; FileWrite $R1 's;@bin_dir@;$R2;g$\r$\n'
394 ; ${StrRep} $R2 "$INSTDIR" "\" "\\"
395 ; FileWrite $R1 's;@bin_dir_cmd@;$R2;g$\r$\n'
397 ${StrRep} $R2 "$INSTDIR\plugins" "\" "\\\\"
398 FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n'
400 ${StrRep} $R2 "$INSTDIR" "\" "/"
401 FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n"
403 FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n"
405 ${If} "$ConfigClientName" != ""
406 FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n"
408 ${If} "$ConfigClientPort" != ""
409 FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n"
411 ${If} "$ConfigClientMaxJobs" != ""
412 FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n"
414 ${If} "$ConfigClientPassword" != ""
415 FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n"
417 ${If} "$ConfigDirectorName" != ""
418 FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n"
420 ${If} "$ConfigDirectorPort" != ""
421 FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n"
423 ${If} "$ConfigDirectorPassword" != ""
424 FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n"
426 ${If} "$ConfigDirectorAddress" != ""
427 FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n"
429 ${If} "$ConfigMonitorName" != ""
430 FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n"
432 ${If} "$ConfigMonitorPassword" != ""
433 FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n"
438 ${If} ${FileExists} "$OldInstallDir\bacula-fd.exe"
439 nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
441 nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /remove' ; Remove existing service
447 SectionGroup "Client" SecGroupClient
449 Section "File Service" SecFileDaemon
452 SetOutPath "$INSTDIR\plugins"
453 File "${SRC_DIR}\exchange-fd.dll"
455 SetOutPath "$INSTDIR"
457 File "${SRC_DIR}\bacula-fd.exe"
459 File "/oname=$PLUGINSDIR\bacula-fd.conf" "bacula-fd.conf.in"
462 StrCpy $1 bacula-fd.conf
463 Call ConfigEditAndCopy
466 StrCpy $1 "File Service"
467 StrCpy $2 $ConfigClientInstallService
468 StrCpy $3 $ConfigClientStartService
472 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$INSTDIR\bacula-fd.conf"'
477 SectionGroup "Consoles" SecGroupConsoles
479 Section "Command Console" SecConsole
482 SetOutPath "$INSTDIR"
484 File "${SRC_DIR}\bconsole.exe"
485 Call InstallCommonFiles
487 File "/oname=$PLUGINSDIR\bconsole.conf" "bconsole.conf.in"
489 StrCpy $1 bconsole.conf
490 Call ConfigEditAndCopy
492 CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bconsole.exe" '-c "$INSTDIR\bconsole.conf"' "$INSTDIR\bconsole.exe" 0
493 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$INSTDIR\bconsole.conf"'
497 Section "Bat Console" SecBatConsole
500 SetOutPath "$INSTDIR"
502 !if "${BUILD_BAT}" == "yes"
503 Call InstallCommonFiles
504 File "${SRC_DIR}\QtCore4.dll"
505 File "${SRC_DIR}\QtGui4.dll"
507 File "${SRC_DIR}\bat.exe"
509 File "/oname=$PLUGINSDIR\bat.conf" "bat.conf.in"
512 Call ConfigEditAndCopy
514 SetOutPath "$INSTDIR\help"
515 File "${SRC_DIR}\help\*"
516 SetOutPath "$INSTDIR"
519 ; Create Start Menu entry
520 CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bat.exe" '-c "$INSTDIR\bat.conf"' "$INSTDIR\bat.exe" 0
521 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$INSTDIR\bat.conf"'
527 ; Deleted because wxconsole is deprecated
528 ;Section "Graphical Console" SecWxConsole
531 ; SetOutPath "$INSTDIR"
537 SectionGroup "Documentation" SecGroupDocumentation
539 Section "Documentation (Acrobat Format)" SecDocPdf
542 SetOutPath "$INSTDIR\doc"
543 CreateDirectory "$INSTDIR\doc"
545 File "${SRC_DIR}\docs\manuals\en\console\console.pdf"
546 File "${SRC_DIR}\docs\manuals\en\misc\misc.pdf"
547 File "${SRC_DIR}\docs\manuals\en\main\main.pdf"
548 File "${SRC_DIR}\docs\manuals\en\utility\utility.pdf"
549 File "${SRC_DIR}\docs\manuals\en\problems\problems.pdf"
550 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Console.lnk" '"$INSTDIR\doc\console.pdf"'
551 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Main.lnk" '"$INSTDIR\doc\main.pdf"'
552 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Misc.lnk" '"$INSTDIR\doc\misc.pdf"'
553 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Utility.lnk" '"$INSTDIR\doc\utility.pdf"'
554 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Problems.lnk" '"$INSTDIR\doc\problems.pdf"'
555 SetOutPath "$INSTDIR"
558 ;Section "Documentation (HTML Format)" SecDocHtml
561 ; SetOutPath "$INSTDIR\doc"
562 ; CreateDirectory "$INSTDIR\doc"
564 ; File "${SRC_DIR}\manual\bacula\*.html"
565 ; File "${SRC_DIR}\manual\bacula\*.png"
566 ; File "${SRC_DIR}\manual\bacula\*.css"
567 ; CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual (HTML).lnk" '"$INSTDIR\doc\index.html"'
576 ; nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR" /T /G SYSTEM:F Administrators:F'
579 ; Write the uninstall keys for Windows & create Start Menu entry
580 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula"
581 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR"
582 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}"
583 ${StrTok} $R0 "${VERSION}" "." 0 0
584 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0
585 ${StrTok} $R0 "${VERSION}" "." 1 0
586 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0
587 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1
588 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1
589 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://www.bacula.org"
590 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.bacula.org"
591 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.bacula.org?page=support"
592 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
593 WriteUninstaller "$INSTDIR\Uninstall.exe"
594 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
598 ; Extra Page descriptions
600 LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula File Daemon on this system."
601 LangString DESC_SecConsole ${LANG_ENGLISH} "Install command console program on this system."
602 LangString DESC_SecBatConsole ${LANG_ENGLISH} "Install Bat graphical console program on this system."
604 LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration"
605 LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration."
607 LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)"
608 LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration."
610 LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type"
611 LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type."
613 LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates"
614 LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create a resource template for inclusion in the Director's configuration file."
616 !InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN
617 !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon)
618 !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
619 !InsertMacro MUI_DESCRIPTION_TEXT ${SecBatConsole} $(DESC_SecBatConsole)
620 !InsertMacro MUI_FUNCTION_DESCRIPTION_END
624 UninstallText "This will uninstall Bacula. Click Uninstall to continue."
627 ; Shutdown any baculum that could be running
628 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill'
631 ; ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd"
632 ; Remove bacula service
633 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /remove'
634 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\*"
648 Delete /REBOOTOK "$INSTDIR\help\*"
650 ; Check for existing installation
651 MessageBox MB_YESNO|MB_ICONQUESTION \
652 "Would you like to delete the current configuration files and the working state file?" IDNO NoDel
653 Delete /REBOOTOK "$INSTDIR\*"
654 Delete /REBOOTOK "$INSTDIR\working\*"
655 Delete /REBOOTOK "$INSTDIR\plugins\*"
656 Delete /REBOOTOK "$PLUGINSDIR\bacula-*.conf"
657 Delete /REBOOTOK "$PLUGINSDIR\*console.conf"
658 Delete /REBOOTOK "$PLUGINSDIR\*conf.in"
659 Delete /REBOOTOK "$PLUGINSDIR\openssl.exe"
660 Delete /REBOOTOK "$PLUGINSDIR\libeay32.dll"
661 Delete /REBOOTOK "$PLUGINSDIR\ssleay32.dll"
662 Delete /REBOOTOK "$PLUGINSDIR\sed.exe"
663 Delete /REBOOTOK "$PLUGINSDIR\pw.txt"
664 Delete /REBOOTOK "$PLUGINSDIR\*.sed"
665 Delete /REBOOTOK "$PLUGINSDIR\*.cmd"
666 Delete /REBOOTOK "$PLUGINSDIR\*.sql"
667 RMDir "$INSTDIR\plugins"
668 RMDir "$INSTDIR\working"
672 ; remove directories used
674 RMDir "$INSTDIR\help"
679 ; $0 - Service Name (ie Bacula-FD)
680 ; $1 - Service Description (ie Bacula File Daemon)
681 ; $2 - Install as Service
682 ; $3 - Start Service now
684 Function InstallDaemon
685 Call InstallCommonFiles
687 WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2
690 nsExec::ExecToLog '"$INSTDIR\$0.exe" /kill'
692 nsExec::ExecToLog '"$INSTDIR\$0.exe" /remove'
693 nsExec::ExecToLog '"$INSTDIR\$0.exe" /install -c "$INSTDIR\$0.conf"'
704 nsExec::ExecToLog 'net start $0'
706 Exec '"$INSTDIR\$0.exe" /service -c "$INSTDIR\$0.conf"'
710 CreateShortCut "$SMPROGRAMS\Bacula\Start $1.lnk" "$INSTDIR\$0.exe" '-c "$INSTDIR\$0.conf"' "$INSTDIR\$0.exe" 0
714 Function GetComputerName
719 System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2"
721 ${StrCase} $R0 $R0 "L"
728 !define ComputerNameDnsFullyQualified 3
736 System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
739 DetailPrint "GetComputerNameExA failed - LastError = $R2"
755 !define NameUserPrincipal 8
763 System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
766 DetailPrint "GetUserNameExA failed - LastError = $R2"
777 System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
780 DetailPrint "GetUserNameA failed - LastError = $R2"
792 Function ConfigEditAndCopy
795 ${If} ${FileExists} "$0\$1"
801 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\$1"'
802 CopyFiles "$PLUGINSDIR\$1" "$0\$1$R1"
807 Function GetSelectedComponents
810 ${If} ${SectionIsSelected} ${SecFileDaemon}
811 IntOp $R0 $R0 | ${ComponentFile}
813 ${If} ${SectionIsSelected} ${SecConsole}
814 IntOp $R0 $R0 | ${ComponentTextConsole}
816 ${If} ${SectionIsSelected} ${SecBatConsole}
817 IntOp $R0 $R0 | ${ComponentBatConsole}
819 ${If} ${SectionIsSelected} ${SecDocPdf}
820 IntOp $R0 $R0 | ${ComponentPDFDocs}
825 Function PageComponentsShow
826 Call SelectPreviousComponents
827 Call UpdateComponentUI
830 Function PageDirectoryPre
831 ${If} $AutomaticInstall = 1
832 ${OrIf} $InstallType = ${UpgradeInstall}
837 Function LeaveInstallPage
838 Push "$INSTDIR\install.log"
842 Function EnterWriteTemplates
846 Call GetSelectedComponents
849 IntOp $R0 $R0 & ${ComponentDirector}
850 IntOp $R1 $NewComponents & ${ComponentsFileAndStorage}
859 IntOp $R0 $NewComponents & ${ComponentFile}
861 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0
862 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED
863 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State
864 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
866 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 1
867 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags
868 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "C:\$ConfigClientName.conf"
872 !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)"
873 !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini"
875 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State
877 File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in"
879 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"'
880 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State
882 CopyFiles "$PLUGINSDIR\client.conf.in" "$R0"
891 Function SelectPreviousComponents
892 ${If} $InstallType <> ${NewInstall}
893 IntOp $R1 $PreviousComponents & ${ComponentFile}
895 !InsertMacro SelectSection ${SecFileDaemon}
896 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO}
898 !InsertMacro UnselectSection ${SecFileDaemon}
899 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO}
901 IntOp $R1 $PreviousComponents & ${ComponentTextConsole}
903 !InsertMacro SelectSection ${SecConsole}
904 !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO}
906 !InsertMacro UnselectSection ${SecConsole}
907 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO}
909 IntOp $R1 $PreviousComponents & ${ComponentBatConsole}
911 !InsertMacro SelectSection ${SecBatConsole}
912 !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_RO}
914 !InsertMacro UnselectSection ${SecBatConsole}
915 !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_RO}
918 !InsertMacro SelectSection ${SecDocPdf}
919 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO}
921 !InsertMacro UnselectSection ${SecDocPdf}
922 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO}
927 Function UpdateComponentUI
931 Call GetSelectedComponents
934 IntOp $R1 $R0 ^ $PreviousComponents
935 IntOp $NewComponents $R0 & $R1
937 ${If} $InstallType <> ${NewInstall}
938 IntOp $R1 $NewComponents & ${ComponentFile}
940 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD}
942 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD}
944 IntOp $R1 $NewComponents & ${ComponentTextConsole}
946 !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD}
948 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD}
950 IntOp $R1 $NewComponents & ${ComponentBatConsole}
952 !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_BOLD}
954 !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_BOLD}
956 IntOp $R1 $NewComponents & ${ComponentPDFDocs}
958 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_BOLD}
960 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_BOLD}
964 GetDlgItem $R0 $HWNDPARENT 1
966 IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig}
968 SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install"
970 SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >"
977 !include "InstallType.nsh"
978 !include "ConfigPage1.nsh"
979 !include "ConfigPage2.nsh"
980 !include "DumpLog.nsh"