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}\bacula-win${WINVER}-${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)
187 !define ComponentFile 1
188 !define ComponentStorage 2
189 !define ComponentDirector 4
190 !define ComponentTextConsole 8
191 !define ComponentBatConsole 16
192 !define ComponentGUIConsole 32
193 !define ComponentPDFDocs 64
194 !define ComponentHTMLDocs 128
195 !define ComponentTrayMonitor 1024
197 !define ComponentsRequiringUserConfig 63
198 !define ComponentsFileAndStorage 3
199 !define ComponentsFileAndStorageAndDirector 7
200 !define ComponentsDirectorAndTextGuiConsoles 60
201 !define ComponentsTextAndGuiConsoles 56
210 ; Process Command Line Options
214 StrCpy $CommonFilesDone 0
216 StrCpy $AutomaticInstall 0
217 StrCpy $InstallType ${NewInstall}
218 StrCpy $OldInstallDir ""
219 StrCpy $PreviousComponents 0
220 StrCpy $NewComponents 0
222 StrCpy $MySQLVersion ""
223 StrCpy $PostgreSQLPath ""
224 StrCpy $PostgreSQLVersion ""
225 StrCpy $LocalDirectorPassword ""
230 ${GetOptions} $R0 "/noservice" $R1
235 ${GetOptions} $R0 "/nostart" $R1
242 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
251 Pop $LocalHostAddress
255 ; Configuration Defaults
257 StrCpy $ConfigClientName "$HostName-fd"
258 StrCpy $ConfigClientPort 9102
259 StrCpy $ConfigClientMaxJobs 10
260 ;StrCpy $ConfigClientPassword
261 StrCpy $ConfigClientInstallService "$OptService"
262 StrCpy $ConfigClientStartService "$OptStart"
264 StrCpy $ConfigDirectorPort 9101
266 StrCpy $ConfigMonitorName "$HostName-mon"
267 ;StrCpy $ConfigMonitorPassword
269 ; PLUGINSDIR refers to temporary helper programs and not Bacula plugins!
271 File "/oname=$PLUGINSDIR\openssl.exe" "${SRC_DIR}\openssl.exe"
272 File "/oname=$PLUGINSDIR\libeay32.dll" "${SRC_DIR}\libeay32.dll"
273 File "/oname=$PLUGINSDIR\ssleay32.dll" "${SRC_DIR}\ssleay32.dll"
274 File "/oname=$PLUGINSDIR\sed.exe" "${SRC_DIR}\sed.exe"
276 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini"
277 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini"
279 SetPluginUnload alwaysoff
281 ; Set client password
282 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
285 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
288 ${StrTrimNewLines} $ConfigClientPassword $R0
292 SetPluginUnload manual
294 ; Set monitor password
295 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
298 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
301 ${StrTrimNewLines} $ConfigMonitorPassword $R0
309 Function .onSelChange
310 Call UpdateComponentUI
313 Function InstallCommonFiles
314 ${If} $CommonFilesDone = 0
315 SetOutPath "$INSTDIR"
318 SetOutPath "$INSTDIR"
319 !if "${BUILD_TOOLS}" == "MinGW32"
320 File "${SRC_DIR}\mingwm10.dll"
321 File "${SRC_DIR}\pthreadGCE.dll"
322 File "${SRC_DIR}\zlib1.dll"
323 File "${SRC_DIR}\ssleay32.dll"
324 File "${SRC_DIR}\libeay32.dll"
326 !if "${BUILD_TOOLS}" == "MinGW64"
327 File "${SRC_DIR}\pthreadGCE.dll"
328 File "${SRC_DIR}\cryptoeay32-0.9.8.dll"
329 File "${SRC_DIR}\ssleay32-0.9.8.dll"
330 File "${SRC_DIR}\zlib1.dll"
332 File "${SRC_DIR}\bacula.dll"
334 File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf"
335 File "${SRC_DIR}\openssl.exe"
336 File "${SRC_DIR}\bsleep.exe"
337 File "${SRC_DIR}\bsmtp.exe"
338 File "${SRC_DIR}\expr64.exe"
339 File "${SRC_DIR}\snooze.exe"
341 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"'
343 StrCpy $CommonFilesDone 1
347 Section "-Initialize"
349 WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR"
351 Call GetSelectedComponents
353 WriteRegDWORD HKLM Software\Bacula Components $R2
355 ; remove start menu items
356 SetShellVarContext all
358 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*"
359 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*"
360 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
361 RMDir "$SMPROGRAMS\Bacula\Configuration"
362 RMDir "$SMPROGRAMS\Bacula\Documentation"
363 RMDir "$SMPROGRAMS\Bacula"
364 CreateDirectory "$SMPROGRAMS\Bacula"
365 CreateDirectory "$SMPROGRAMS\Bacula\Configuration"
366 CreateDirectory "$SMPROGRAMS\Bacula\Documentation"
368 CreateDirectory "$INSTDIR"
369 CreateDirectory "$INSTDIR\working"
371 SetOutPath "$INSTDIR"
372 File "..\..\..\LICENSE"
373 Delete /REBOOTOK "$INSTDIR\License.txt"
375 ; Output a series of SED commands to configure the .conf file(s)
376 FileOpen $R1 $PLUGINSDIR\config.sed w
377 FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n"
378 FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n"
379 FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n"
381 StrCpy $R2 ${BUILD_TOOLS}
387 FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n"
389 ${StrRep} $R2 "$INSTDIR\working" "\" "\\\\"
390 FileWrite $R1 's;@working_dir@;$R2;g$\r$\n'
391 ${StrRep} $R2 "$INSTDIR\working" "\" "\\"
392 FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n'
394 ; ${StrRep} $R2 "$INSTDIR" "\" "\\\\"
395 ; FileWrite $R1 's;@bin_dir@;$R2;g$\r$\n'
396 ; ${StrRep} $R2 "$INSTDIR" "\" "\\"
397 ; FileWrite $R1 's;@bin_dir_cmd@;$R2;g$\r$\n'
399 ${StrRep} $R2 "$INSTDIR\plugins" "\" "\\\\"
400 FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n'
402 ${StrRep} $R2 "$INSTDIR" "\" "/"
403 FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n"
405 FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n"
407 ${If} "$ConfigClientName" != ""
408 FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n"
410 ${If} "$ConfigClientPort" != ""
411 FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n"
413 ${If} "$ConfigClientMaxJobs" != ""
414 FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n"
416 ${If} "$ConfigClientPassword" != ""
417 FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n"
419 ${If} "$ConfigDirectorName" != ""
420 FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n"
422 ${If} "$ConfigDirectorPort" != ""
423 FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n"
425 ${If} "$ConfigDirectorPassword" != ""
426 FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n"
428 ${If} "$ConfigDirectorAddress" != ""
429 FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n"
431 ${If} "$ConfigMonitorName" != ""
432 FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n"
434 ${If} "$ConfigMonitorPassword" != ""
435 FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n"
440 ${If} ${FileExists} "$OldInstallDir\bacula-fd.exe"
441 nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
443 nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /remove' ; Remove existing service
449 SectionGroup "Client" SecGroupClient
451 Section "File Service" SecFileDaemon
454 SetOutPath "$INSTDIR\plugins"
455 File "${SRC_DIR}\exchange-fd.dll"
457 SetOutPath "$INSTDIR"
459 File "${SRC_DIR}\bacula-fd.exe"
461 File "/oname=$PLUGINSDIR\bacula-fd.conf" "bacula-fd.conf.in"
464 StrCpy $1 bacula-fd.conf
465 Call ConfigEditAndCopy
468 StrCpy $1 "File Service"
469 StrCpy $2 $ConfigClientInstallService
470 StrCpy $3 $ConfigClientStartService
474 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$INSTDIR\bacula-fd.conf"'
479 SectionGroup "Consoles" SecGroupConsoles
481 Section "Command Console" SecConsole
484 SetOutPath "$INSTDIR"
486 File "${SRC_DIR}\bconsole.exe"
487 Call InstallCommonFiles
489 File "/oname=$PLUGINSDIR\bconsole.conf" "bconsole.conf.in"
491 StrCpy $1 bconsole.conf
492 Call ConfigEditAndCopy
494 CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bconsole.exe" '-c "$INSTDIR\bconsole.conf"' "$INSTDIR\bconsole.exe" 0
495 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$INSTDIR\bconsole.conf"'
499 Section "Bat Console" SecBatConsole
502 SetOutPath "$INSTDIR"
504 !if "${BUILD_BAT}" == "yes"
505 Call InstallCommonFiles
506 File "${SRC_DIR}\QtCore4.dll"
507 File "${SRC_DIR}\QtGui4.dll"
508 File "${SRC_DIR}\libgcc_s_dw2-1.dll"
510 File "${SRC_DIR}\bat.exe"
512 File "/oname=$PLUGINSDIR\bat.conf" "bat.conf.in"
515 Call ConfigEditAndCopy
517 SetOutPath "$INSTDIR\help"
518 File "${SRC_DIR}\help\*"
519 SetOutPath "$INSTDIR"
522 ; Create Start Menu entry
523 CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bat.exe" '-c "$INSTDIR\bat.conf"' "$INSTDIR\bat.exe" 0
524 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$INSTDIR\bat.conf"'
529 Section "Bacula Tray Monitor" SecTrayMonitor
532 SetOutPath "$INSTDIR"
534 !if "${BUILD_BAT}" == "yes"
535 Call InstallCommonFiles
536 File "${SRC_DIR}\QtCore4.dll"
537 File "${SRC_DIR}\QtGui4.dll"
538 File "${SRC_DIR}\libgcc_s_dw2-1.dll"
540 File "${SRC_DIR}\bacula-tray-monitor.exe"
542 File "/oname=$PLUGINSDIR\tray-monitor.conf" "tray-monitor.conf.in"
544 StrCpy $1 tray-monitor.conf
545 Call ConfigEditAndCopy
547 ; Create Start Menu entry
548 CreateShortCut "$SMPROGRAMS\Bacula\TrayMonitor.lnk" "$INSTDIR\bacula-tray-monitor.exe" '-c "$INSTDIR\tray-monitor.conf"' "$INSTDIR\bacula-tray-monitor.exe" 0
549 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Tray Monitor Configuration.lnk" "write.exe" '"$INSTDIR\tray-monitor.conf"'
554 ; Deleted because wxconsole is deprecated
555 ;Section "Graphical Console" SecWxConsole
558 ; SetOutPath "$INSTDIR"
564 SectionGroup "Documentation" SecGroupDocumentation
566 Section "Documentation (Acrobat Format)" SecDocPdf
569 SetOutPath "$INSTDIR\doc"
570 CreateDirectory "$INSTDIR\doc"
572 File "${SRC_DIR}\docs\manuals\en\console\console.pdf"
573 File "${SRC_DIR}\docs\manuals\en\misc\misc.pdf"
574 File "${SRC_DIR}\docs\manuals\en\main\main.pdf"
575 File "${SRC_DIR}\docs\manuals\en\utility\utility.pdf"
576 File "${SRC_DIR}\docs\manuals\en\problems\problems.pdf"
577 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Console.lnk" '"$INSTDIR\doc\console.pdf"'
578 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Main.lnk" '"$INSTDIR\doc\main.pdf"'
579 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Misc.lnk" '"$INSTDIR\doc\misc.pdf"'
580 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Utility.lnk" '"$INSTDIR\doc\utility.pdf"'
581 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Problems.lnk" '"$INSTDIR\doc\problems.pdf"'
582 SetOutPath "$INSTDIR"
585 ;Section "Documentation (HTML Format)" SecDocHtml
588 ; SetOutPath "$INSTDIR\doc"
589 ; CreateDirectory "$INSTDIR\doc"
591 ; File "${SRC_DIR}\manual\bacula\*.html"
592 ; File "${SRC_DIR}\manual\bacula\*.png"
593 ; File "${SRC_DIR}\manual\bacula\*.css"
594 ; CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual (HTML).lnk" '"$INSTDIR\doc\index.html"'
603 ; nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR" /T /G SYSTEM:F Administrators:F'
606 ; Write the uninstall keys for Windows & create Start Menu entry
607 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula"
608 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR"
609 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}"
610 ${StrTok} $R0 "${VERSION}" "." 0 0
611 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0
612 ${StrTok} $R0 "${VERSION}" "." 1 0
613 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0
614 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1
615 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1
616 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://www.bacula.org"
617 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.bacula.org"
618 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.bacula.org?page=support"
619 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
620 WriteUninstaller "$INSTDIR\Uninstall.exe"
621 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
625 ; Extra Page descriptions
627 LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula File Daemon on this system."
628 LangString DESC_SecConsole ${LANG_ENGLISH} "Install command console program on this system."
629 LangString DESC_SecBatConsole ${LANG_ENGLISH} "Install Bat graphical console program on this system."
630 LangString DESC_SecTrayMonitor ${LANG_ENGLISH} "Install Tray Monitor graphical program on this system."
632 LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration"
633 LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration."
635 LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)"
636 LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration."
638 LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type"
639 LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type."
641 LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates"
642 LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create a resource template for inclusion in the Director's configuration file."
644 !InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN
645 !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon)
646 !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
647 !InsertMacro MUI_DESCRIPTION_TEXT ${SecBatConsole} $(DESC_SecBatConsole)
648 !InsertMacro MUI_DESCRIPTION_TEXT ${SecTrayMonitor} $(DESC_SecTrayMonitor)
649 !InsertMacro MUI_FUNCTION_DESCRIPTION_END
653 UninstallText "This will uninstall Bacula. Click Uninstall to continue."
656 ; Shutdown any baculum that could be running
657 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill'
660 ; ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd"
661 ; Remove bacula service
662 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /remove'
663 nsExec::ExecToLog '"$INSTDIR\plugins\exchange-fd.dll" /remove'
665 ; remove registry keys
666 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
667 DeleteRegKey HKLM "Software\Bacula"
669 ; remove start menu items
670 SetShellVarContext all
671 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
672 RMDir "$SMPROGRAMS\Bacula"
674 ; remove files and uninstaller (preserving config for now)
675 Delete /REBOOTOK "$INSTDIR\doc\*"
676 Delete /REBOOTOK "$INSTDIR\*"
677 Delete /REBOOTOK "$INSTDIR\help\*"
679 ; Check for existing installation
681 MessageBox MB_YESNO|MB_ICONQUESTION \
682 "Would you like to delete the current configuration files and the working state file?" IDNO NoDel
685 Delete /REBOOTOK "$INSTDIR\*"
686 Delete /REBOOTOK "$INSTDIR\working\*"
687 Delete /REBOOTOK "$INSTDIR\plugins\*"
688 Delete /REBOOTOK "$PLUGINSDIR\bacula-*.conf"
689 Delete /REBOOTOK "$PLUGINSDIR\*console.conf"
690 Delete /REBOOTOK "$PLUGINSDIR\*conf.in"
691 Delete /REBOOTOK "$PLUGINSDIR\openssl.exe"
692 Delete /REBOOTOK "$PLUGINSDIR\libeay32.dll"
693 Delete /REBOOTOK "$PLUGINSDIR\ssleay32.dll"
694 Delete /REBOOTOK "$PLUGINSDIR\sed.exe"
695 Delete /REBOOTOK "$PLUGINSDIR\pw.txt"
696 Delete /REBOOTOK "$PLUGINSDIR\*.sed"
697 Delete /REBOOTOK "$PLUGINSDIR\*.cmd"
698 Delete /REBOOTOK "$PLUGINSDIR\*.sql"
699 RMDir "$INSTDIR\plugins"
700 RMDir "$INSTDIR\working"
704 ; remove directories used
706 RMDir "$INSTDIR\help"
711 ; $0 - Service Name (ie Bacula-FD)
712 ; $1 - Service Description (ie Bacula File Daemon)
713 ; $2 - Install as Service
714 ; $3 - Start Service now
716 Function InstallDaemon
717 Call InstallCommonFiles
719 WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2
722 nsExec::ExecToLog '"$INSTDIR\$0.exe" /kill'
724 nsExec::ExecToLog '"$INSTDIR\$0.exe" /remove'
725 nsExec::ExecToLog '"$INSTDIR\$0.exe" /install -c "$INSTDIR\$0.conf"'
736 nsExec::ExecToLog 'net start $0'
738 Exec '"$INSTDIR\$0.exe" /service -c "$INSTDIR\$0.conf"'
742 CreateShortCut "$SMPROGRAMS\Bacula\Start $1.lnk" "$INSTDIR\$0.exe" '-c "$INSTDIR\$0.conf"' "$INSTDIR\$0.exe" 0
746 Function GetComputerName
751 System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2"
753 ${StrCase} $R0 $R0 "L"
760 !define ComputerNameDnsFullyQualified 3
768 System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
771 DetailPrint "GetComputerNameExA failed - LastError = $R2"
787 !define NameUserPrincipal 8
795 System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
798 DetailPrint "GetUserNameExA failed - LastError = $R2"
809 System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
812 DetailPrint "GetUserNameA failed - LastError = $R2"
824 Function ConfigEditAndCopy
827 ${If} ${FileExists} "$0\$1"
833 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\$1"'
834 CopyFiles "$PLUGINSDIR\$1" "$0\$1$R1"
839 Function GetSelectedComponents
842 ${If} ${SectionIsSelected} ${SecFileDaemon}
843 IntOp $R0 $R0 | ${ComponentFile}
845 ${If} ${SectionIsSelected} ${SecConsole}
846 IntOp $R0 $R0 | ${ComponentTextConsole}
848 ${If} ${SectionIsSelected} ${SecBatConsole}
849 IntOp $R0 $R0 | ${ComponentBatConsole}
851 ${If} ${SectionIsSelected} ${SecTrayMonitor}
852 IntOp $R0 $R0 | ${ComponentTrayMonitor}
854 ${If} ${SectionIsSelected} ${SecDocPdf}
855 IntOp $R0 $R0 | ${ComponentPDFDocs}
860 Function PageComponentsShow
861 Call SelectPreviousComponents
862 Call UpdateComponentUI
865 Function PageDirectoryPre
866 ${If} $AutomaticInstall = 1
867 ${OrIf} $InstallType = ${UpgradeInstall}
872 Function LeaveInstallPage
873 Push "$INSTDIR\install.log"
877 Function EnterWriteTemplates
881 Call GetSelectedComponents
884 IntOp $R0 $R0 & ${ComponentDirector}
885 IntOp $R1 $NewComponents & ${ComponentsFileAndStorage}
894 IntOp $R0 $NewComponents & ${ComponentFile}
896 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0
897 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED
898 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State
899 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
901 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 1
902 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags
903 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "C:\$ConfigClientName.conf"
907 !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)"
908 !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini"
910 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State
912 File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in"
914 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"'
915 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State
917 CopyFiles "$PLUGINSDIR\client.conf.in" "$R0"
926 Function SelectPreviousComponents
927 ${If} $InstallType <> ${NewInstall}
928 IntOp $R1 $PreviousComponents & ${ComponentFile}
930 !InsertMacro SelectSection ${SecFileDaemon}
931 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO}
933 !InsertMacro UnselectSection ${SecFileDaemon}
934 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO}
936 IntOp $R1 $PreviousComponents & ${ComponentTextConsole}
938 !InsertMacro SelectSection ${SecConsole}
939 !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO}
941 !InsertMacro UnselectSection ${SecConsole}
942 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO}
944 IntOp $R1 $PreviousComponents & ${ComponentBatConsole}
946 !InsertMacro SelectSection ${SecBatConsole}
947 !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_RO}
949 !InsertMacro UnselectSection ${SecBatConsole}
950 !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_RO}
952 IntOp $R1 $PreviousComponents & ${ComponentTrayMonitor}
954 !InsertMacro SelectSection ${SecTrayMonitor}
955 !InsertMacro SetSectionFlag ${SecTrayMonitor} ${SF_RO}
957 !InsertMacro UnselectSection ${SecTrayMonitor}
958 !InsertMacro ClearSectionFlag ${SecTrayMonitor} ${SF_RO}
961 !InsertMacro SelectSection ${SecDocPdf}
962 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO}
964 !InsertMacro UnselectSection ${SecDocPdf}
965 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO}
970 Function UpdateComponentUI
974 Call GetSelectedComponents
977 IntOp $R1 $R0 ^ $PreviousComponents
978 IntOp $NewComponents $R0 & $R1
980 ${If} $InstallType <> ${NewInstall}
981 IntOp $R1 $NewComponents & ${ComponentFile}
983 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD}
985 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD}
987 IntOp $R1 $NewComponents & ${ComponentTextConsole}
989 !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD}
991 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD}
993 IntOp $R1 $NewComponents & ${ComponentBatConsole}
995 !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_BOLD}
997 !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_BOLD}
999 IntOp $R1 $NewComponents & ${ComponentTrayMonitor}
1001 !InsertMacro SetSectionFlag ${SecTrayMonitor} ${SF_BOLD}
1003 !InsertMacro ClearSectionFlag ${SecTrayMonitor} ${SF_BOLD}
1005 IntOp $R1 $NewComponents & ${ComponentPDFDocs}
1007 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_BOLD}
1009 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_BOLD}
1013 GetDlgItem $R0 $HWNDPARENT 1
1015 IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig}
1017 SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install"
1019 SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >"
1026 !include "InstallType.nsh"
1027 !include "ConfigPage1.nsh"
1028 !include "ConfigPage2.nsh"
1029 !include "DumpLog.nsh"