2 # Copyright (C) 2000-2018 Kern Sibbald
3 # License: BSD 2-Clause; see file LICENSE-FOSS
5 ##{{NSIS_PLUS_BEGIN_PROJECT_SETTINGS}}##
7 # CMD -DSRC_DIR=release32 -DSRC32_DIR=..\win32_installer\release32 -DSRC64_DIR=..\win64_installer\release64 -DOUT_DIR=release32 -DWINVER=32 -DVERSION=6.7.9 -DBUILD_TOOLS=NSIS-3.0b0
8 # EXE C:\Program Files (x86)\NSIS\makensis.exe
10 ##{{NSIS_PLUS_END_PROJECT_SETTINGS}}##
14 ; Began as a version written by Michel Meyers (michel@tcnnet.dyndns.org)
16 ; Adapted by Kern Sibbald for native Win32 Bacula
17 ; added a number of elements from Christopher Hull's installer
19 ; D. Scott Barninger Nov 13 2004
20 ; D. Scott Barninger Dec 05 2004
21 ; D. Scott Barninger Apr 17 2005
22 ; Robert Nelson May 15 2006
24 ; Kern Sibbald October 2010
25 ; Remove server installs and
26 ; install into a single bacula directory
29 ; Command line options:
34 ; netsh firewall add portopening protocol=tcp port=9102 name="Bacula-FD"
37 !define PRODUCT "Bacula"
40 ; Include the Modern UI
44 !include "LogicLib.nsh"
45 !include "FileFunc.nsh"
46 !include "Sections.nsh"
47 !include "StrFunc.nsh"
48 !include "WinMessages.nsh"
54 ; Name in Welcome screen
56 OutFile "${OUT_DIR}\bacula-win${WINVER}-${VERSION}.exe"
58 Caption "Bacula 32 bit Edition ${VERSION}"
59 VIProductVersion ${VERSION}.1
60 VIAddVersionKey CompanyName "Bacula Project"
61 VIAddVersionKey LegalCopyright "Kern Sibbald"
62 VIAddVersionKey FileDescription "Bacula network backup and restore"
63 VIAddVersionKey FileVersion win${WINVER}-${VERSION}
64 VIAddVersionKey ProductVersion win${WINVER}-${VERSION}
65 VIAddVersionKey ProductName "Bacula"
66 VIAddVersionKey InternalName "Bacula"
67 VIAddVersionKey LegalTrademarks "Bacula is a registered trademark of Kern Sibbald"
68 VIAddVersionKey OriginalFilename "bacula.exe"
70 InstallDir "C:\Program Files\Bacula"
71 InstallDirRegKey HKLM "Software\Bacula" "InstallLocation"
77 !insertmacro GetParent
88 !define MUI_COMPONENTSPAGE_SMALLDESC
90 !define MUI_HEADERIMAGE
91 !define MUI_BGCOLOR 739AB9
92 !define MUI_HEADERIMAGE_BITMAP "bacula-logo.bmp"
93 !define MUI_HEADERIMAGE_LEFT
94 !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
96 !InsertMacro MUI_PAGE_WELCOME
97 !InsertMacro MUI_PAGE_LICENSE "${SRC_DIR}\LICENSE"
98 Page custom EnterInstallType
99 !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageComponentsShow
100 !InsertMacro MUI_PAGE_COMPONENTS
101 !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
102 !InsertMacro MUI_PAGE_DIRECTORY
103 Page custom EnterConfigPage1 LeaveConfigPage1
104 Page custom EnterConfigPage2 LeaveConfigPage2
105 !Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage
106 !InsertMacro MUI_PAGE_INSTFILES
107 Page custom EnterWriteTemplates
108 !Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt
109 !InsertMacro MUI_PAGE_FINISH
111 !InsertMacro MUI_UNPAGE_WELCOME
112 !InsertMacro MUI_UNPAGE_CONFIRM
113 !InsertMacro MUI_UNPAGE_INSTFILES
114 !InsertMacro MUI_UNPAGE_FINISH
116 !define MUI_ABORTWARNING
118 !InsertMacro MUI_LANGUAGE "English"
120 !InsertMacro GetParameters
121 !InsertMacro GetOptions
123 DirText "Setup will install Bacula 32 bit ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder."
125 !InsertMacro MUI_RESERVEFILE_INSTALLOPTIONS
141 Var ConfigClientMaxJobs
142 Var ConfigClientPassword
143 Var ConfigClientInstallService
144 Var ConfigClientStartService
146 Var ConfigStorageName
147 Var ConfigStoragePort
148 Var ConfigStorageMaxJobs
149 Var ConfigStoragePassword
150 Var ConfigStorageInstallService
151 Var ConfigStorageStartService
153 Var ConfigDirectorName
154 Var ConfigDirectorPort
155 Var ConfigDirectorMaxJobs
156 Var ConfigDirectorPassword
157 Var ConfigDirectorAddress
158 Var ConfigDirectorMailServer
159 Var ConfigDirectorMailAddress
161 Var ConfigDirectorInstallService
162 Var ConfigDirectorStartService
164 Var ConfigMonitorName
165 Var ConfigMonitorPassword
167 Var LocalDirectorPassword
173 Var PostgreSQLVersion
179 !define UpgradeInstall 1
180 !define MigrateInstall 2
183 Var PreviousComponents
186 ; Bit 0 = File Service
187 ; 1 = Storage Service
188 ; 2 = Director Service
189 ; 3 = Command Console
191 ; 5 = wxWidgits Console
192 ; 6 = Documentation (PDF)
193 ; 7 = Documentation (HTML)
194 ; 8 = alldrives Plugin
195 ; 9 = Old Exchange Plugin
199 !define ComponentFile 1
200 !define ComponentStorage 2
201 !define ComponentDirector 4
202 !define ComponentTextConsole 8
203 !define ComponentBatConsole 16
204 !define ComponentGUIConsole 32
205 !define ComponentPDFDocs 64
206 !define ComponentHTMLDocs 128
207 !define MUI_PAGE_LICENSE "${SRC_DIR}\INSTALL"
208 !define ComponentAllDrivesPlugin 256
209 !define ComponentOldExchangePlugin 512
210 !define ComponentTrayMonitor 1024
211 ; !define ComponentWinBMRPlugin 2048
213 !define ComponentsRequiringUserConfig 63
214 !define ComponentsFileAndStorage 3
215 !define ComponentsFileAndStorageAndDirector 7
216 !define ComponentsDirectorAndTextGuiConsoles 60
217 !define ComponentsTextAndGuiConsoles 56
226 ; Process Command Line Options
230 StrCpy $CommonFilesDone 0
232 StrCpy $AutomaticInstall 0
233 StrCpy $InstallType ${NewInstall}
234 StrCpy $OldInstallDir ""
235 StrCpy $PreviousComponents 0
236 StrCpy $NewComponents 0
238 StrCpy $MySQLVersion ""
239 StrCpy $PostgreSQLPath ""
240 StrCpy $PostgreSQLVersion ""
241 StrCpy $LocalDirectorPassword ""
247 MessageBox MB_OK "This is a 32 bit program, but the OS is an x64. Aborting ..." /SD IDOK
252 ${GetOptions} $R0 "/noservice" $R1
257 ${GetOptions} $R0 "/nostart" $R1
264 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
273 Pop $LocalHostAddress
277 ; Configuration Defaults
279 StrCpy $ConfigClientName "$HostName-fd"
280 StrCpy $ConfigClientPort 9102
281 StrCpy $ConfigClientMaxJobs 10
282 ;StrCpy $ConfigClientPassword
283 StrCpy $ConfigClientInstallService "$OptService"
284 StrCpy $ConfigClientStartService "$OptStart"
286 StrCpy $ConfigStorageName "$HostName-sd"
287 StrCpy $ConfigStoragePort 9103
288 StrCpy $ConfigStorageMaxJobs 10
289 ;StrCpy $ConfigStoragePassword
290 StrCpy $ConfigStorageInstallService "$OptService"
291 StrCpy $ConfigStorageStartService "$OptStart"
293 StrCpy $ConfigDirectorPort 9101
295 StrCpy $ConfigMonitorName "$HostName-mon"
296 ;StrCpy $ConfigMonitorPassword
298 ; PLUGINSDIR refers to temporary helper programs and not Bacula plugins!
300 File "/oname=$PLUGINSDIR\openssl.exe" "${SRC_DIR}\openssl.exe"
301 File "/oname=$PLUGINSDIR\libeay32.dll" "${SRC_DIR}\libeay32.dll"
302 File "/oname=$PLUGINSDIR\ssleay32.dll" "${SRC_DIR}\ssleay32.dll"
303 File "/oname=$PLUGINSDIR\sed.exe" "${SRC_DIR}\sed.exe"
305 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini"
306 !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini"
308 SetPluginUnload alwaysoff
310 ; Generate random client password
311 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
314 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
317 ${StrTrimNewLines} $ConfigClientPassword $R0
321 SetPluginUnload manual
323 ; Generate random Storage daemon password
324 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
327 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
330 ${StrTrimNewLines} $ConfigStoragePassword $R0
334 ; Generate random monitor password
335 nsExec::Exec '"$PLUGINSDIR\openssl.exe" rand -base64 -out $PLUGINSDIR\pw.txt 33'
338 FileOpen $R1 "$PLUGINSDIR\pw.txt" r
341 ${StrTrimNewLines} $ConfigMonitorPassword $R0
349 Function .onSelChange
350 Call UpdateComponentUI
353 Function InstallCommonFiles
354 ${If} $CommonFilesDone = 0
355 SetOutPath "$INSTDIR"
358 SetOutPath "$INSTDIR"
359 !if "${BUILD_TOOLS}" == "MinGW32"
360 File "${SRC_DIR}\pthreadGCE2.dll"
361 File "${SRC_DIR}\ssleay32.dll"
362 File "${SRC_DIR}\libeay32.dll"
363 File "${SRC_DIR}\libwinpthread-1.dll"
364 File "${SRC_DIR}\libgcc_s_sjlj-1.dll"
365 File "${SRC_DIR}\libstdc++-6.dll"
367 !if "${BUILD_TOOLS}" == "MinGW64"
368 File "${SRC_DIR}\pthreadGCE.dll"
369 File "${SRC_DIR}\cryptoeay32-0.9.8.dll"
370 File "${SRC_DIR}\ssleay32-0.9.8.dll"
372 File "${SRC_DIR}\zlib1.dll"
373 File "${SRC_DIR}\bacula.dll"
375 File "/oname=$INSTDIR\openssl.cnf" "${SRC_DIR}\openssl.cnf"
376 File "${SRC_DIR}\openssl.exe"
377 File "${SRC_DIR}\bsleep.exe"
378 File "${SRC_DIR}\bsmtp.exe"
379 File "${SRC_DIR}\expr64.exe"
380 File "${SRC_DIR}\snooze.exe"
382 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\View Readme.lnk" "write.exe" '"$INSTDIR\Readme.txt"'
384 StrCpy $CommonFilesDone 1
388 Section "-Initialize"
390 WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR"
392 Call GetSelectedComponents
394 WriteRegDWORD HKLM Software\Bacula Components $R2
396 ; remove start menu items
397 SetShellVarContext all
399 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Configuration\*"
400 Delete /REBOOTOK "$SMPROGRAMS\Bacula\Documentation\*"
401 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
402 RMDir "$SMPROGRAMS\Bacula\Configuration"
403 RMDir "$SMPROGRAMS\Bacula\Documentation"
404 RMDir "$SMPROGRAMS\Bacula"
405 CreateDirectory "$SMPROGRAMS\Bacula"
406 CreateDirectory "$SMPROGRAMS\Bacula\Configuration"
407 CreateDirectory "$SMPROGRAMS\Bacula\Documentation"
409 CreateDirectory "$INSTDIR"
410 CreateDirectory "$INSTDIR\working"
411 CreateDirectory "$INSTDIR\plugins"
413 SetOutPath "$INSTDIR"
414 File "${SRC_DIR}\LICENSE"
415 Delete /REBOOTOK "$INSTDIR\License.txt"
417 ; Output a series of SED commands to configure the .conf file(s)
418 FileOpen $R1 $PLUGINSDIR\config.sed w
419 FileWrite $R1 "s;@VERSION@;${VERSION};g$\r$\n"
420 FileWrite $R1 "s;@DATE@;${__DATE__};g$\r$\n"
421 FileWrite $R1 "s;@DISTNAME@;Windows;g$\r$\n"
423 StrCpy $R2 ${BUILD_TOOLS}
429 FileWrite $R1 "s;@DISTVER@;$R2;g$\r$\n"
431 ${StrRep} $R2 "$INSTDIR\working" "\" "\\\\"
432 FileWrite $R1 's;@working_dir@;$R2;g$\r$\n'
433 ; ${StrRep} $R2 "$INSTDIR\working" "\" "\\"
434 ; FileWrite $R1 's;@working_dir_cmd@;$R2;g$\r$\n'
436 ${StrRep} $R2 "$INSTDIR\plugins" "\" "\\\\"
437 FileWrite $R1 's;@fdplugins_dir@;$R2;g$\r$\n'
439 ${StrRep} $R2 "$INSTDIR" "\" "/"
440 FileWrite $R1 "s;@BUILD_DIR@;$R2;g$\r$\n"
442 FileWrite $R1 "s;@client_address@;$LocalHostAddress;g$\r$\n"
443 FileWrite $R1 "s;@client_name@;$ConfigClientName;g$\r$\n"
444 FileWrite $R1 "s;@client_port@;$ConfigClientPort;g$\r$\n"
445 FileWrite $R1 "s;@client_maxjobs@;$ConfigClientMaxJobs;g$\r$\n"
446 FileWrite $R1 "s;@client_password@;$ConfigClientPassword;g$\r$\n"
447 FileWrite $R1 "s;@storage_address@;$LocalHostAddress;g$\r$\n"
448 FileWrite $R1 "s;@storage_name@;$ConfigStorageName;g$\r$\n"
449 FileWrite $R1 "s;@storage_port@;$ConfigStoragePort;g$\r$\n"
450 FileWrite $R1 "s;@storage_maxjobs@;$ConfigStorageMaxJobs;g$\r$\n"
451 FileWrite $R1 "s;@storage_password@;$ConfigStoragePassword;g$\r$\n"
452 FileWrite $R1 "s;@director_name@;$ConfigDirectorName;g$\r$\n"
453 FileWrite $R1 "s;@director_port@;$ConfigDirectorPort;g$\r$\n"
454 FileWrite $R1 "s;@director_password@;$ConfigDirectorPassword;g$\r$\n"
455 FileWrite $R1 "s;@director_address@;$ConfigDirectorAddress;g$\r$\n"
456 FileWrite $R1 "s;@monitor_name@;$ConfigMonitorName;g$\r$\n"
457 FileWrite $R1 "s;@monitor_password@;$ConfigMonitorPassword;g$\r$\n"
461 ${If} ${FileExists} "$OldInstallDir\bacula-fd.exe"
462 nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
463 nsExec::Exec /TIMEOUT=200 'net stop bacula-fd'
465 nsExec::ExecToLog '"$OldInstallDir\bacula-fd.exe" /remove' ; Remove existing service
468 ${If} ${FileExists} "$INSTDIR\bacula-fd.exe"
469 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill' ; Shutdown any bacula that could be running
470 nsExec::Exec /TIMEOUT=200 'net stop bacula-fd'
473 ${If} ${FileExists} "$OldInstallDir\bin\bacula-sd.exe"
474 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running
475 nsExec::Exec /TIMEOUT=200 'net stop bacula-sd'
477 nsExec::ExecToLog '"$OldInstallDir\bin\bacula-sd.exe" /remove' ; Remove existing service
480 ${If} ${FileExists} "$INSTDIR\bacula-sd.exe"
481 nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /kill' ; Shutdown any bacula that could be running
482 nsExec::Exec /TIMEOUT=200 'net stop bacula-sd'
489 SectionGroup "Client" SecGroupClient
491 Section "File Service" SecFileDaemon
494 SetOutPath "$INSTDIR"
496 File "${SRC_DIR}\bacula-fd.exe"
497 File "/oname=$PLUGINSDIR\bacula-fd.conf" "bacula-fd.conf.in"
500 StrCpy $1 bacula-fd.conf
501 Call ConfigEditAndCopy
504 StrCpy $1 "File Service"
505 StrCpy $2 $ConfigClientInstallService
506 StrCpy $3 $ConfigClientStartService
510 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Client Configuration.lnk" "write.exe" '"$INSTDIR\bacula-fd.conf"'
515 SectionGroup "Server" SecGroupServer
517 Section "Storage Service" SecStorageDaemon
520 SetOutPath "$INSTDIR"
522 File "${SRC_DIR}\bacula-sd.exe"
523 File "${SRC_DIR}\bcopy.exe"
524 File "${SRC_DIR}\bextract.exe"
525 File "${SRC_DIR}\bls.exe"
527 File "/oname=$PLUGINSDIR\bacula-sd.conf" "bacula-sd.conf.in"
530 StrCpy $1 bacula-sd.conf
531 Call ConfigEditAndCopy
534 StrCpy $1 "Storage Service"
535 StrCpy $2 $ConfigStorageInstallService
536 StrCpy $3 $ConfigStorageStartService
539 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Storage Configuration.lnk" "write.exe" '"$INSTDIR\bacula-sd.conf"'
545 SectionGroup "Consoles" SecGroupConsoles
547 Section "Command Console" SecConsole
550 SetOutPath "$INSTDIR"
552 File "${SRC_DIR}\bconsole.exe"
553 Call InstallCommonFiles
555 File "/oname=$PLUGINSDIR\bconsole.conf" "bconsole.conf.in"
557 StrCpy $1 bconsole.conf
558 Call ConfigEditAndCopy
560 CreateShortCut "$SMPROGRAMS\Bacula\bconsole.lnk" "$INSTDIR\bconsole.exe" '-c "$INSTDIR\bconsole.conf"' "$INSTDIR\bconsole.exe" 0
561 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Command Console Configuration.lnk" "write.exe" '"$INSTDIR\bconsole.conf"'
565 Section "Bat Console" SecBatConsole
568 SetOutPath "$INSTDIR"
570 !if "${BUILD_BAT}" == "yes"
571 Call InstallCommonFiles
572 File "${SRC_DIR}\QtCore4.dll"
573 File "${SRC_DIR}\QtGui4.dll"
574 File "${SRC_DIR}\libgcc_s_sjlj-1.dll"
576 File "${SRC_DIR}\bat.exe"
578 File "/oname=$PLUGINSDIR\bat.conf" "bat.conf.in"
581 Call ConfigEditAndCopy
583 SetOutPath "$INSTDIR\help"
584 File "${SRC_DIR}\help\*"
585 SetOutPath "$INSTDIR"
587 ; Create Start Menu entry
588 CreateShortCut "$SMPROGRAMS\Bacula\Bat.lnk" "$INSTDIR\bat.exe" '-c "$INSTDIR\bat.conf"' "$INSTDIR\bat.exe" 0
589 CreateShortCut "$SMPROGRAMS\Bacula\Configuration\Edit Bat Configuration.lnk" "write.exe" '"$INSTDIR\bat.conf"'
594 Section "Bacula Tray Monitor" SecTrayMonitor
597 SetOutPath "$INSTDIR"
599 !if "${BUILD_BAT}" == "yes"
600 Call InstallCommonFiles
601 File "${SRC_DIR}\QtCore4.dll"
602 File "${SRC_DIR}\QtGui4.dll"
603 File "${SRC_DIR}\libgcc_s_sjlj-1.dll"
604 ; File "${SRC_DIR}\bacula-tray-monitor.exe"
606 ; File "/oname=$PLUGINSDIR\bacula-tray-monitor.conf" "bacula-tray-monitor.conf.in"
607 ; StrCpy $0 "$INSTDIR"
608 ; StrCpy $1 bacula-tray-monitor.conf
609 ; Call ConfigEditAndCopy
611 ; Create Start Menu entry
612 ; CreateShortCut "$SMPROGRAMS\Bacula\TrayMonitor.lnk" "$INSTDIR\bacula-tray-monitor.exe" "" "$INSTDIR\bacula-tray-monitor.exe" 0
618 ; Deleted because wxconsole is deprecated
619 ;Section "Graphical Console" SecWxConsole
622 ; SetOutPath "$INSTDIR"
629 SectionGroup "Plugins" SecGroupPlugins
631 Section "alldrives Plugin" SecAllDrivesPlugin
634 SetOutPath "$INSTDIR\plugins"
635 File "${SRC_DIR}\alldrives-fd.dll"
636 SetOutPath "$INSTDIR"
640 ;Section "winbmr Plugin" SecWinBMRPlugin
643 ; SetOutPath "$INSTDIR\plugins"
644 ; File "${SRC_DIR}\winbmr-fd.dll"
645 ; SetOutPath "$INSTDIR"
649 Section "Old (deprecated) Exchange Plugin" SecOldExchangePlugin
652 SetOutPath "$INSTDIR\plugins"
653 File "${SRC_DIR}\exchange-fd.dll"
654 SetOutPath "$INSTDIR"
662 SectionGroup "Documentation" SecGroupDocumentation
664 Section "Documentation (Acrobat Format)" SecDocPdf
667 SetOutPath "$INSTDIR\doc"
668 CreateDirectory "$INSTDIR\doc"
670 File "${SRC_DIR}\docs\manuals\en\console\console.pdf"
671 File "${SRC_DIR}\docs\manuals\en\misc\misc.pdf"
672 File "${SRC_DIR}\docs\manuals\en\main\main.pdf"
673 File "${SRC_DIR}\docs\manuals\en\utility\utility.pdf"
674 File "${SRC_DIR}\docs\manuals\en\problems\problems.pdf"
675 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Console.lnk" '"$INSTDIR\doc\console.pdf"'
676 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Main.lnk" '"$INSTDIR\doc\main.pdf"'
677 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Misc.lnk" '"$INSTDIR\doc\misc.pdf"'
678 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Utility.lnk" '"$INSTDIR\doc\utility.pdf"'
679 CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Problems.lnk" '"$INSTDIR\doc\problems.pdf"'
680 SetOutPath "$INSTDIR"
683 ;Section "Documentation (HTML Format)" SecDocHtml
686 ; SetOutPath "$INSTDIR\doc"
687 ; CreateDirectory "$INSTDIR\doc"
689 ; File "${SRC_DIR}\manual\bacula\*.html"
690 ; File "${SRC_DIR}\manual\bacula\*.png"
691 ; File "${SRC_DIR}\manual\bacula\*.css"
692 ; CreateShortCut "$SMPROGRAMS\Bacula\Documentation\Manual (HTML).lnk" '"$INSTDIR\doc\index.html"'
701 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bacula-fd.conf" /G SYSTEM:F Administrators:F'
702 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bacula-sd.conf" /G SYSTEM:F Administrators:F'
703 nsExec::ExecToLog 'cmd.exe /C echo Y|cacls "$INSTDIR\bat.conf" /G SYSTEM:F Administrators:F'
706 ; Write the uninstall keys for Windows & create Start Menu entry
707 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Systems(R) Enterprise"
708 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "InstallLocation" "$INSTDIR"
709 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayVersion" "${VERSION}"
710 ${StrTok} $R0 "${VERSION}" "." 0 0
711 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMajor" $R0
712 ${StrTok} $R0 "${VERSION}" "." 1 0
713 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "VersionMinor" $R0
714 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoModify" 1
715 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "NoRepair" 1
716 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLUpdateInfo" "http://www.baculasystems.com"
717 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "URLInfoAbout" "http://www.baculasystems.com"
718 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "HelpLink" "http://www.baculasystems.com"
719 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
720 WriteUninstaller "$INSTDIR\Uninstall.exe"
721 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
724 nsExec::ExecToLog 'net start bacula-fd'
725 nsExec::ExecToLog 'net start bacula-sd'
727 Exec '"$INSTDIR\bacula-fd.exe" /service -c "$INSTDIR\bacula-fd.conf"'
728 Exec '"$INSTDIR\bacula-sd.exe" /service -c "$INSTDIR\bacula-sd.conf"'
734 ; Extra Page descriptions
736 LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula 32 bit File Daemon on this system."
737 LangString DESC_SecStorageDaemon ${LANG_ENGLISH} "Install Bacula 32 bit Storage Daemon on this system."
738 LangString DESC_SecConsole ${LANG_ENGLISH} "Install bconsole program on this system."
739 LangString DESC_SecBatConsole ${LANG_ENGLISH} "Install Bat graphical console program on this system."
740 ; LangString DESC_SecTrayMonitor ${LANG_ENGLISH} "Install Tray Monitor graphical program on this system."
741 LangString DESC_SecAllDrivesPlugin ${LANG_ENGLISH} "Install alldrives Plugin on this system."
742 ; LangString DESC_SecWinBMRPlugin ${LANG_ENGLISH} "Install winbmr Plugin on this system."
743 LangString DESC_SecOldExchangePlugin ${LANG_ENGLISH} "Install old (deprecated) Exchange Plugin on this system."
746 LangString TITLE_ConfigPage1 ${LANG_ENGLISH} "Configuration"
747 LangString SUBTITLE_ConfigPage1 ${LANG_ENGLISH} "Set installation configuration."
749 LangString TITLE_ConfigPage2 ${LANG_ENGLISH} "Configuration (continued)"
750 LangString SUBTITLE_ConfigPage2 ${LANG_ENGLISH} "Set installation configuration."
752 LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type"
753 LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type."
755 LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates"
756 LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create a resource template for inclusion in the Director's configuration file."
758 !InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN
759 !InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon)
760 !InsertMacro MUI_DESCRIPTION_TEXT ${SecStorageDaemon} $(DESC_SecStorageDaemon)
761 !InsertMacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
762 !InsertMacro MUI_DESCRIPTION_TEXT ${SecBatConsole} $(DESC_SecBatConsole)
763 ; !InsertMacro MUI_DESCRIPTION_TEXT ${SecTrayMonitor} $(DESC_SecTrayMonitor)
764 !InsertMacro MUI_DESCRIPTION_TEXT ${SecAllDrivesPlugin} $(DESC_SecAllDrivesPlugin)
765 ; !InsertMacro MUI_DESCRIPTION_TEXT ${SecWinBMRPlugin} $(DESC_SecWinBMRPlugin)
766 !InsertMacro MUI_DESCRIPTION_TEXT ${SecOldExchangePlugin} $(DESC_SecOldExchangePlugin)
767 !InsertMacro MUI_FUNCTION_DESCRIPTION_END
771 UninstallText "This will uninstall Bacula. Click Uninstall to continue."
774 ; Shutdown any baculum that could be running
775 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill'
776 nsExec::Exec /TIMEOUT=200 'net stop bacula-fd'
779 ; ReadRegDWORD $R0 HKLM "Software\Bacula" "Service_Bacula-fd"
780 ; Remove Bacula File Daemon service
781 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /remove'
783 ; Remove Bacula Storage Daemon service
784 nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /remove'
786 ; remove registry keys
787 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
788 DeleteRegKey HKLM "Software\Bacula"
790 ; remove start menu items
791 SetShellVarContext all
792 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
793 RMDir "$SMPROGRAMS\Bacula"
795 ; remove files and uninstaller (preserving config for now)
796 Delete /REBOOTOK "$INSTDIR\doc\*"
797 Delete /REBOOTOK "$INSTDIR\openssl.exe"
798 Delete /REBOOTOK "$INSTDIR\bacula-fd.exe"
799 Delete /REBOOTOK "$INSTDIR\bsleep.exe"
800 Delete /REBOOTOK "$INSTDIR\bsmtp.exe"
801 Delete /REBOOTOK "$INSTDIR\bconsole.exe"
802 Delete /REBOOTOK "$INSTDIR\expr64.exe"
803 Delete /REBOOTOK "$INSTDIR\snooze.exe"
804 Delete /REBOOTOK "$INSTDIR\LICENSE"
805 Delete /REBOOTOK "$INSTDIR\Readme.txt"
806 Delete /REBOOTOK "$INSTDIR\*.dll"
807 Delete /REBOOTOK "$INSTDIR\*.cnf"
808 Delete /REBOOTOK "$INSTDIR\*.sed"
809 Delete /REBOOTOK "$INSTDIR\*.cmd"
810 Delete /REBOOTOK "$INSTDIR\*.sql"
811 Delete /REBOOTOK "$INSTDIR\help\*"
812 Delete /REBOOTOK "$INSTDIR\plugins\alldrives-fd.dll"
813 Delete /REBOOTOK "$INSTDIR\plugins\exchange-fd.dll"
814 ; Delete /REBOOTOK "$INSTDIR\plugins\winbmr-fd.dll"
816 ; Check for existing installation
818 MessageBox MB_YESNO|MB_ICONQUESTION \
819 "Would you like to delete the current configuration files and the working state file?" /SD IDNO IDNO NoDel
822 Delete /REBOOTOK "$INSTDIR\*"
823 Delete /REBOOTOK "$INSTDIR\working\*"
824 Delete /REBOOTOK "$PLUGINSDIR\bacula-*.conf"
825 Delete /REBOOTOK "$PLUGINSDIR\*console.conf"
826 Delete /REBOOTOK "$PLUGINSDIR\*conf.in"
827 RMDir /REBOOTOK "$INSTDIR\plugins"
828 RMDir /REBOOTOK "$INSTDIR\working"
829 RMDir /REBOOTOK "$INSTDIR"
831 ; remove directories used
833 RMDir "$INSTDIR\plugins"
834 RMDir "$INSTDIR\working"
836 RMDir "$INSTDIR\help"
841 ; $0 - Service Name (ie Bacula-FD)
842 ; $1 - Service Description (ie Bacula File Daemon)
843 ; $2 - Install as Service
844 ; $3 - Start Service now
846 Function InstallDaemon
847 Call InstallCommonFiles
849 WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2
852 nsExec::ExecToLog '"$INSTDIR\bacula-fd.exe" /kill'
853 nsExec::Exec /TIMEOUT=200 'net stop bacula-fd'
854 nsExec::ExecToLog '"$INSTDIR\bacula-sd.exe" /kill'
855 nsExec::Exec /TIMEOUT=200 'net stop bacula-sd'
856 nsExec::ExecToLog '"$INSTDIR\$0.exe" /remove'
857 nsExec::ExecToLog '"$INSTDIR\$0.exe" /install -c "$INSTDIR\$0.conf"'
868 Function GetComputerName
873 System::Call "kernel32::GetComputerNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2"
875 ${StrCase} $R0 $R0 "L"
882 !define ComputerNameDnsFullyQualified 3
890 System::Call "kernel32::GetComputerNameExA(i ${ComputerNameDnsFullyQualified}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
893 DetailPrint "GetComputerNameExA failed - LastError = $R2"
909 !define NameUserPrincipal 8
917 System::Call "secur32::GetUserNameExA(i ${NameUserPrincipal}, t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
920 DetailPrint "GetUserNameExA failed - LastError = $R2"
931 System::Call "advapi32::GetUserNameA(t .R0, *i ${NSIS_MAX_STRLEN} R1) i.R2 ?e"
934 DetailPrint "GetUserNameA failed - LastError = $R2"
946 Function ConfigEditAndCopy
949 ${If} ${FileExists} "$0\$1"
955 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\$1"'
956 CopyFiles "$PLUGINSDIR\$1" "$0\$1$R1"
961 Function GetSelectedComponents
964 ${If} ${SectionIsSelected} ${SecFileDaemon}
965 IntOp $R0 $R0 | ${ComponentFile}
967 ${If} ${SectionIsSelected} ${SecStorageDaemon}
968 IntOp $R0 $R0 | ${ComponentStorage}
970 ${If} ${SectionIsSelected} ${SecConsole}
971 IntOp $R0 $R0 | ${ComponentTextConsole}
973 ${If} ${SectionIsSelected} ${SecBatConsole}
974 IntOp $R0 $R0 | ${ComponentBatConsole}
976 ; ${If} ${SectionIsSelected} ${SecTrayMonitor}
977 ; IntOp $R0 $R0 | ${ComponentTrayMonitor}
979 ${If} ${SectionIsSelected} ${SecAllDrivesPlugin}
980 IntOp $R0 $R0 | ${ComponentAllDrivesPlugin}
982 ; ${If} ${SectionIsSelected} ${SecWinBMRPlugin}
983 ; IntOp $R0 $R0 | ${ComponentWinBMRPlugin}
985 ${If} ${SectionIsSelected} ${SecOldExchangePlugin}
986 IntOp $R0 $R0 | ${ComponentOldExchangePlugin}
988 ${If} ${SectionIsSelected} ${SecDocPdf}
989 IntOp $R0 $R0 | ${ComponentPDFDocs}
994 Function PageComponentsShow
995 Call SelectPreviousComponents
996 Call UpdateComponentUI
999 Function PageDirectoryPre
1000 ${If} $AutomaticInstall = 1
1001 ${OrIf} $InstallType = ${UpgradeInstall}
1006 Function LeaveInstallPage
1007 Push "$INSTDIR\install.log"
1011 Function EnterWriteTemplates
1015 Call GetSelectedComponents
1018 IntOp $R0 $R0 & ${ComponentDirector}
1019 IntOp $R1 $NewComponents & ${ComponentsFileAndStorage}
1028 IntOp $R0 $NewComponents & ${ComponentFile}
1030 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0
1031 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED
1032 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State
1033 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
1035 ;; TODO: See why this procedure causes a problem on Windows 2012
1036 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0
1037 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags
1038 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "$INSTDIR\$ConfigClientName.conf"
1039 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
1043 IntOp $R0 $NewComponents & ${ComponentStorage}
1045 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 0
1046 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags DISABLED
1047 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State
1048 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
1050 ;; TODO: See why this procedure causes a problem on Windows 2012
1051 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 0
1052 DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags
1053 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State "$INSTDIR\$ConfigStorageName.conf"
1054 WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
1057 !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)"
1058 !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini"
1060 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State
1062 File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in"
1064 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"'
1065 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State
1067 CopyFiles "$PLUGINSDIR\client.conf.in" "$R0"
1072 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 4" State
1074 File "/oname=$PLUGINSDIR\storage.conf.in" "storage.conf.in"
1076 nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\storage.conf.in"'
1077 !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 5" State
1079 CopyFiles "$PLUGINSDIR\storage.conf.in" "$R0"
1087 Function SelectPreviousComponents
1088 ${If} $InstallType <> ${NewInstall}
1089 IntOp $R1 $PreviousComponents & ${ComponentFile}
1091 !InsertMacro SelectSection ${SecFileDaemon}
1092 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO}
1094 !InsertMacro UnselectSection ${SecFileDaemon}
1095 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO}
1097 IntOp $R1 $PreviousComponents & ${ComponentStorage}
1099 !InsertMacro SelectSection ${SecStorageDaemon}
1100 !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO}
1102 !InsertMacro UnselectSection ${SecStorageDaemon}
1103 !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_RO}
1105 IntOp $R1 $PreviousComponents & ${ComponentTextConsole}
1107 !InsertMacro SelectSection ${SecConsole}
1108 !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO}
1110 !InsertMacro UnselectSection ${SecConsole}
1111 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO}
1113 IntOp $R1 $PreviousComponents & ${ComponentBatConsole}
1115 !InsertMacro SelectSection ${SecBatConsole}
1116 !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_RO}
1118 !InsertMacro UnselectSection ${SecBatConsole}
1119 !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_RO}
1121 ; IntOp $R1 $PreviousComponents & ${ComponentTrayMonitor}
1123 ; !InsertMacro SelectSection ${SecTrayMonitor}
1124 ; !InsertMacro SetSectionFlag ${SecTrayMonitor} ${SF_RO}
1126 ; !InsertMacro UnselectSection ${SecTrayMonitor}
1127 ; !InsertMacro ClearSectionFlag ${SecTrayMonitor} ${SF_RO}
1129 IntOp $R1 $PreviousComponents & ${ComponentAllDrivesPlugin}
1131 !InsertMacro SelectSection ${SecAllDrivesPlugin}
1132 !InsertMacro SetSectionFlag ${SecAllDrivesPlugin} ${SF_RO}
1134 !InsertMacro UnselectSection ${SecAllDrivesPlugin}
1135 !InsertMacro ClearSectionFlag ${SecAllDrivesPlugin} ${SF_RO}
1137 ; IntOp $R1 $PreviousComponents & ${ComponentWinBMRPlugin}
1139 ; !InsertMacro SelectSection ${SecWinBMRPlugin}
1140 ; !InsertMacro SetSectionFlag ${SecWinBMRPlugin} ${SF_RO}
1142 ; !InsertMacro UnselectSection ${SecWinBMRPlugin}
1143 ; !InsertMacro ClearSectionFlag ${SecWinBMRPlugin} ${SF_RO}
1145 IntOp $R1 $PreviousComponents & ${ComponentOldExchangePlugin}
1147 !InsertMacro SelectSection ${SecOldExchangePlugin}
1148 !InsertMacro SetSectionFlag ${SecOldExchangePlugin} ${SF_RO}
1150 !InsertMacro UnselectSection ${SecOldExchangePlugin}
1151 !InsertMacro ClearSectionFlag ${SecOldExchangePlugin} ${SF_RO}
1153 IntOp $R1 $PreviousComponents & ${ComponentPDFDocs}
1155 !InsertMacro SelectSection ${SecDocPdf}
1156 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO}
1158 !InsertMacro UnselectSection ${SecDocPdf}
1159 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO}
1164 Function UpdateComponentUI
1168 Call GetSelectedComponents
1171 IntOp $R1 $R0 ^ $PreviousComponents
1172 IntOp $NewComponents $R0 & $R1
1174 ${If} $InstallType <> ${NewInstall}
1175 IntOp $R1 $NewComponents & ${ComponentFile}
1177 !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_BOLD}
1179 !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_BOLD}
1181 IntOp $R1 $NewComponents & ${ComponentStorage}
1183 !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_BOLD}
1185 !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_BOLD}
1187 IntOp $R1 $NewComponents & ${ComponentTextConsole}
1189 !InsertMacro SetSectionFlag ${SecConsole} ${SF_BOLD}
1191 !InsertMacro ClearSectionFlag ${SecConsole} ${SF_BOLD}
1193 IntOp $R1 $NewComponents & ${ComponentBatConsole}
1195 !InsertMacro SetSectionFlag ${SecBatConsole} ${SF_BOLD}
1197 !InsertMacro ClearSectionFlag ${SecBatConsole} ${SF_BOLD}
1199 ; IntOp $R1 $NewComponents & ${ComponentTrayMonitor}
1201 ; !InsertMacro SetSectionFlag ${SecTrayMonitor} ${SF_BOLD}
1203 ; !InsertMacro ClearSectionFlag ${SecTrayMonitor} ${SF_BOLD}
1205 IntOp $R1 $NewComponents & ${ComponentAllDrivesPlugin}
1207 !InsertMacro SetSectionFlag ${SecAllDrivesPlugin} ${SF_BOLD}
1209 !InsertMacro ClearSectionFlag ${SecAllDrivesPlugin} ${SF_BOLD}
1211 IntOp $R1 $NewComponents & ${ComponentOldExchangePlugin}
1213 !InsertMacro SetSectionFlag ${SecOldExchangePlugin} ${SF_BOLD}
1215 !InsertMacro ClearSectionFlag ${SecOldExchangePlugin} ${SF_BOLD}
1217 IntOp $R1 $NewComponents & ${ComponentPDFDocs}
1219 !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_BOLD}
1221 !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_BOLD}
1225 GetDlgItem $R0 $HWNDPARENT 1
1227 IntOp $R1 $NewComponents & ${ComponentsRequiringUserConfig}
1229 SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install"
1231 SendMessage $R0 ${WM_SETTEXT} 0 "STR:&Next >"
1238 !include "InstallType.nsh"
1239 !include "ConfigPage1.nsh"
1240 !include "ConfigPage2.nsh"
1241 !include "DumpLog.nsh"