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 wx-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 ; Pretty much rewritten
27 ; Added Bacula-SD and Bacula-DIR
28 ; Replaced ParameterGiven with standard GetOptions
31 ; Command line options:
33 ; /cygwin - do cygwin install into c:\cygwin\bacula
37 !define PRODUCT "Bacula"
38 !define VERSION "@VERSION@"
40 !define PTHREADS_DIR "..\..\..\depkgs-win32\pthreads\release"
41 !define MINGW_DIR "C:\MinGW\bin"
43 !define BUILD_TOOLS "MinGW"
45 ;!define BUILD_TOOLS "VC8"
46 ;!define VC_REDIST_DIR "C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT"
49 ; Include the Modern UI
52 !include "LogicLib.nsh"
53 !include "FileFunc.nsh"
59 OutFile "winbacula-${VERSION}.exe"
61 InstallDir "$PROGRAMFILES\Bacula"
62 InstallDirRegKey HKLM Software\Bacula InstallLocation
72 !insertmacro MUI_PAGE_WELCOME
73 ; !insertmacro MUI_PAGE_LICENSE "..\..\LICENSE"
74 !insertmacro MUI_PAGE_COMPONENTS
75 !insertmacro MUI_PAGE_DIRECTORY
76 Page custom EnterClientConfig LeaveClientConfig
77 Page custom EnterOptions
78 !insertmacro MUI_PAGE_INSTFILES
79 !insertmacro MUI_PAGE_FINISH
81 !insertmacro MUI_UNPAGE_WELCOME
82 !insertmacro MUI_UNPAGE_CONFIRM
83 !insertmacro MUI_UNPAGE_INSTFILES
84 !insertmacro MUI_UNPAGE_FINISH
86 !define MUI_ABORTWARNING
88 !insertmacro MUI_LANGUAGE "English"
90 !insertmacro GetParameters
91 !insertmacro GetOptions
93 DirText "Setup will install Bacula ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder.$\n$\nNote to CYGWIN users: please choose your CYGWIN root directory."
98 ReserveFile "ClientConfig.ini"
99 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
115 Var ConfigDirectorName
117 Var ConfigMonitorName
120 Var OptionsClientService
121 Var OptionsClientStart
122 Var OptionsStorageService
123 Var OptionsStorageStart
124 Var OptionsDirectorService
125 Var OptionsDirectorStart
126 Var OptionsDirectorDB
135 ; Process Command Line Options
140 StrCpy $DependenciesDone 0
146 ${GetOptions} $R0 "/cygwin" $R1
151 ${GetOptions} $R0 "/service" $R1
156 ${GetOptions} $R0 "/start" $R1
164 StrCpy $INSTDIR "C:\cygwin\bacula"
167 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
172 !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ClientConfig.ini"
178 Function CopyDependencies
179 SetOutPath "$INSTDIR\bin"
181 ${If} $DependenciesDone = 0
182 !if BUILD_TOOLS == "VC8"
183 File "${PTHREADS_DIR}\pthreadVCE.dll"
184 File "${VC_REDIST_DIR}\msvcm80.dll"
185 File "${VC_REDIST_DIR}\msvcp80.dll"
186 File "${VC_REDIST_DIR}\msvcr80.dll"
187 File "${VC_REDIST_DIR}\Microsoft.VC80.CRT.manifest"
189 !if BUILD_TOOLS == "MinGW"
190 File "${PTHREADS_DIR}\pthreadGCE.dll"
191 File "${MINGW_DIR}\mingwm10.dll"
193 StrCpy $DependenciesDone 1
197 Section "-Initialize"
198 ; Create Start Menu Directory
200 WriteRegStr HKLM Software\Bacula InstallLocation "$INSTDIR"
202 SetShellVarContext all
203 CreateDirectory "$SMPROGRAMS\Bacula"
205 CreateDirectory "$INSTDIR"
206 CreateDirectory "$INSTDIR\bin"
207 CreateDirectory "$APPDATA\Bacula"
210 Delete /REBOOTOK "$INSTDIR\bin\License.txt"
213 SectionGroup "Client"
215 Section "File Service" SecFileDaemon
218 SetOutPath "$INSTDIR\bin"
219 File "Release\bacula-fd.exe"
222 StrCpy $R1 "$APPDATA\Bacula\bacula-fd.conf"
223 IfFileExists $R1 0 +3
227 File /oname=$R1 ..\filed\bacula-fd.conf.in
229 ${If} $OptSilent <> 1
232 "Please edit the configuration file $R1 to fit your installation. When you click the OK button Wordpad will open to allow you to do this. Be sure to save your changes before closing Wordpad."
233 Exec 'write "$R1"' ; spawn wordpad with the file to be edited
236 ExecWait 'cmd.exe /C echo Y|cacls "$R1" /G SYSTEM:F Administrators:F'
240 StrCpy $1 "File Service"
241 StrCpy $2 $OptionsClientService
242 StrCpy $3 $OptionsClientStart
246 CreateShortCut "$SMPROGRAMS\Bacula\Edit Client Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-fd.conf"'
251 SectionGroup "Server"
253 Section "Storage Service" SecStorageDaemon
256 SetOutPath "$INSTDIR\bin"
257 File "Release\bacula-sd.exe"
258 File "Release\bcopy.exe"
259 File "Release\bextract.exe"
260 File "Release\bls.exe"
261 File "Release\bscan.exe"
262 File "Release\btape.exe"
265 StrCpy $R1 "$APPDATA\Bacula\bacula-sd.conf"
266 IfFileExists $R1 0 +3
270 File /oname=$R1 ..\stored\bacula-sd.conf.in
272 ${If} $OptSilent <> 1
275 "Please edit the configuration file $R1 to fit your installation. When you click the OK button Wordpad will open to allow you to do this. Be sure to save your changes before closing Wordpad."
276 Exec 'write "$R1"' ; spawn wordpad with the file to be edited
279 ExecWait 'cmd.exe /C echo Y|cacls "$R1" /G SYSTEM:F Administrators:F'
283 StrCpy $1 "Storage Service"
284 StrCpy $2 $OptionsStorageService
285 StrCpy $3 $OptionsStorageStart
288 CreateShortCut "$SMPROGRAMS\Bacula\Edit Storage Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-sd.conf"'
291 Section "Director Service" SecDirectorDaemon
294 SetOutPath "$INSTDIR\bin"
295 File "Release\bacula-dir.exe"
296 File "Release\dbcheck.exe"
299 StrCpy $R1 "$APPDATA\Bacula\bacula-dir.conf"
300 IfFileExists $R1 0 +3
304 File /oname=$R1 ..\dird\bacula-dir.conf.in
306 ${If} $OptSilent <> 1
309 "Please edit the configuration file $R1 to fit your installation. When you click the OK button Wordpad will open to allow you to do this. Be sure to save your changes before closing Wordpad."
310 Exec 'write "$R1"' ; spawn wordpad with the file to be edited
313 ExecWait 'cmd.exe /C echo Y|cacls "$R1" /G SYSTEM:F Administrators:F'
317 StrCpy $1 "Director Service"
318 StrCpy $2 $OptionsDirectorService
319 StrCpy $3 $OptionsDirectorStart
322 CreateShortCut "$SMPROGRAMS\Bacula\Edit Director Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bacula-dir.conf"'
327 SectionGroup "Consoles"
329 Section "Command Console" SecConsole
332 File Release\bconsole.exe
333 Call CopyDependencies
336 StrCpy $R1 "$APPDATA\Bacula\bconsole.conf"
337 IfFileExists $R1 0 +3
341 File /oname=$R1 ..\console\bconsole.conf.in
343 ${If} $OptSilent <> 1
346 "Please edit the configuration file $R1 to fit your installation. When you click the OK button Wordpad will open to allow you to do this. Be sure to save your changes before closing Wordpad."
347 Exec 'write "$R1"' ; spawn wordpad with the file to be edited
350 ExecWait 'cmd.exe /C echo Y|cacls "$R1" /G SYSTEM:F Administrators:F'
353 CreateShortCut "$SMPROGRAMS\Bacula\Edit Command Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\bconsole.conf"'
357 Section "Graphical Console" SecWxConsole
360 File Release\wx-console.exe
361 Call CopyDependencies
364 StrCpy $R1 "$APPDATA\Bacula\wx-console.conf"
365 IfFileExists $R1 0 +3
369 File /oname=$R1 ..\wx-console\wx-console.conf.in
371 ${If} $OptSilent <> 1
374 "Please edit the configuration file $R1 to fit your installation. When you click the OK button Wordpad will open to allow you to do this. Be sure to save your changes before closing Wordpad."
375 Exec 'write "$R1"' ; spawn wordpad with the file to be edited
378 ExecWait 'cmd.exe /C echo Y|cacls "$R1" /G SYSTEM:F Administrators:F'
381 ; Create Start Menu entry
382 CreateShortCut "$SMPROGRAMS\Bacula\Console.lnk" "$INSTDIR\bin\wx-console.exe" '-c "$APPDATA\Bacula\wx-console.conf"' "$INSTDIR\bin\wx-console.exe" 0
383 CreateShortCut "$SMPROGRAMS\Bacula\Edit Graphical Console Configuration.lnk" "write.exe" '"$APPDATA\Bacula\wx-console.conf"'
388 SectionGroup "Documentation"
390 Section "Documentation (Acrobat Format)" SecDocPdf
393 SetOutPath "$INSTDIR\doc"
394 CreateDirectory "$INSTDIR\doc"
395 File ..\..\..\docs\manual\bacula.pdf
396 CreateShortCut "$SMPROGRAMS\Bacula\Manual.lnk" '"$INSTDIR\doc\bacula.pdf"'
399 Section "Documentation (HTML Format)" SecDocHtml
402 SetOutPath "$INSTDIR\doc"
403 CreateDirectory "$INSTDIR\doc"
404 File ..\..\..\docs\manual\bacula\*.html
405 File ..\..\..\docs\manual\bacula\*.png
406 File ..\..\..\docs\manual\bacula\*.css
407 CreateShortCut "$SMPROGRAMS\Bacula\Manual (HTML).lnk" '"$INSTDIR\doc\bacula.html"'
412 Section "-Write Installer"
413 ; Write the uninstall keys for Windows & create Start Menu entry
414 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula"
415 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
416 WriteUninstaller "$INSTDIR\Uninstall.exe"
417 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
421 ; Extra Page descriptions
424 LangString DESC_SecFileDaemon ${LANG_ENGLISH} "Install Bacula File Daemon on this system."
425 LangString DESC_SecStorageDaemon ${LANG_ENGLISH} "Install Bacula Storage Daemon on this system."
426 LangString DESC_SecDirectorDaemon ${LANG_ENGLISH} "Install Bacula Director Daemon on this system."
427 LangString DESC_SecConsole ${LANG_ENGLISH} "Install command console program on this system."
428 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install graphical console program on this system."
429 LangString DESC_SecDocPdf ${LANG_ENGLISH} "Install documentation in Acrobat format on this system."
430 LangString DESC_SecDocHtml ${LANG_ENGLISH} "Install documentation in HTML format on this system."
432 LangString TITLE_ClientConfig ${LANG_ENGLISH} "Configure Client"
433 LangString SUBTITLE_ClientConfig ${LANG_ENGLISH} "Create initial configuration for Client."
435 LangString TITLE_Options ${LANG_ENGLISH} "Options"
436 LangString SUBTITLE_Options ${LANG_ENGLISH} "Set installation options."
438 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
439 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon)
440 !insertmacro MUI_DESCRIPTION_TEXT ${SecStorageDaemon} $(DESC_SecStorageDaemon)
441 !insertmacro MUI_DESCRIPTION_TEXT ${SecDirectorDaemon} $(DESC_SecDirectorDaemon)
442 !insertmacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
443 !insertmacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
444 !insertmacro MUI_DESCRIPTION_TEXT ${SecDocPdf} $(DESC_SecDocPdf)
445 !insertmacro MUI_DESCRIPTION_TEXT ${SecDocHtml} $(DESC_SecDocHtml)
446 !insertmacro MUI_FUNCTION_DESCRIPTION_END
450 UninstallText "This will uninstall Bacula. Hit next to continue."
453 ; Shutdown any baculum that could be running
454 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
455 ExecWait '"$INSTDIR\bin\bacula-sd.exe" /kill'
456 ExecWait '"$INSTDIR\bin\bacula-dir.exe" /kill'
458 ReadRegDWORD $R0 HKLM "Software\Bacula" "Installed_Bacula-fd"
460 ; Remove bacula service
461 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
464 ReadRegDWORD $R0 HKLM "Software\Bacula" "Installed_Bacula-sd"
466 ; Remove bacula service
467 ExecWait '"$INSTDIR\bin\bacula-sd.exe" /remove'
470 ReadRegDWORD $R0 HKLM "Software\Bacula" "Installed_Bacula-dir"
472 ; Remove bacula service
473 ExecWait '"$INSTDIR\bin\bacula-dir.exe" /remove'
476 ; remove registry keys
477 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
478 DeleteRegKey HKLM "Software\Bacula"
480 ; remove start menu items
481 SetShellVarContext all
482 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
483 RMDir "$SMPROGRAMS\Bacula"
485 ; remove files and uninstaller (preserving config for now)
486 Delete /REBOOTOK "$INSTDIR\bin\*.*"
487 Delete /REBOOTOK "$INSTDIR\doc\*.*"
488 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
490 ; Check for existing installation
491 MessageBox MB_YESNO|MB_ICONQUESTION \
492 "Would you like to delete the current configuration files and the working state file?" IDNO +3
493 Delete /REBOOTOK "$APPDATA\Bacula\*"
494 RMDir "$APPDATA\Bacula"
496 ; remove directories used
502 Function EnterClientConfig
503 SectionGetFlags ${SecFileDaemon} $R0
506 SectionGetFlags ${SecStorageDaemon} $R1
509 SectionGetFlags ${SecDirectorDaemon} $R2
518 !insertmacro MUI_HEADER_TEXT "$(TITLE_ClientConfig)" "$(SUBTITLE_ClientConfig)"
519 !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ClientConfig.ini"
520 Pop $HDLG ;HWND of dialog
522 ; Initialize Controls
524 !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ClientConfig.ini" "Field 3" "HWND"
525 SendMessage $HCTL ${EM_LIMITTEXT} 30 0
528 !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ClientConfig.ini" "Field 6" "HWND"
529 SendMessage $HCTL ${EM_LIMITTEXT} 5 0
530 SendMessage $HCTL ${WM_SETTEXT} 0 "STR:9102"
533 !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ClientConfig.ini" "Field 8" "HWND"
534 SendMessage $HCTL ${EM_LIMITTEXT} 2 0
535 SendMessage $HCTL ${WM_SETTEXT} 0 "STR:20"
538 !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ClientConfig.ini" "Field 11" "HWND"
539 SendMessage $HCTL ${EM_LIMITTEXT} 30 0
542 !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ClientConfig.ini" "Field 14" "HWND"
543 SendMessage $HCTL ${EM_LIMITTEXT} 60 0
546 !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ClientConfig.ini" "Field 17" "HWND"
547 SendMessage $HCTL ${EM_LIMITTEXT} 30 0
550 !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ClientConfig.ini" "Field 20" "HWND"
551 SendMessage $HCTL ${EM_LIMITTEXT} 60 0
553 !insertmacro MUI_INSTALLOPTIONS_SHOW
559 !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientName "ClientConfig.ini" "Field 3" "State"
561 !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPort "ClientConfig.ini" "Field 6" "State"
563 !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMaxJobs "ClientConfig.ini" "Field 8" "State"
566 !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorName "ClientConfig.ini" "Field 11" "State"
568 !insertmacro MUI_INSTALLOPTIONS_READ $ConfigDirectorPW "ClientConfig.ini" "Field 14" "State"
571 !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMonitorName "ClientConfig.ini" "Field 17" "State"
573 !insertmacro MUI_INSTALLOPTIONS_READ $ConfigMonitorPW "ClientConfig.ini" "Field 20" "State"
576 Function LeaveClientConfig
578 !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ClientConfig.ini" "Field 6" "State"
581 MessageBox MB_OK "Port must be between 1024 and 65535 inclusive."
586 !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ClientConfig.ini" "Field 8" "State"
589 MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive."
594 Function EnterOptions
595 SectionGetFlags ${SecFileDaemon} $R0
598 SectionGetFlags ${SecStorageDaemon} $R1
601 SectionGetFlags ${SecDirectorDaemon} $R2
610 FileOpen $R3 "$PLUGINSDIR\options.ini" w
612 StrCpy $R4 1 ; Field Number
618 FileWrite $R3 '[Field $R4]$\r$\n'
619 FileWrite $R3 'Type="GroupBox"$\r$\nText="Client"$\r$\nLeft=0$\r$\nTop=$R5$\r$\nRight=300$\r$\nBottom=$R6$\r$\n'
625 FileWrite $R3 '[Field $R4]$\r$\nType="Checkbox"$\r$\nState=$OptService$\r$\nText="Install as service"$\r$\nLeft=6$\r$\nTop=$R5$\r$\nRight=280$\r$\nBottom=$R6$\r$\n'
631 FileWrite $R3 '[Field $R4]$\r$\nType="Checkbox"$\r$\nState=$OptStart$\r$\nText="Start after install"$\r$\nLeft=6$\r$\nTop=$R5$\r$\nRight=280$\r$\nBottom=$R6$\r$\n'
640 FileWrite $R3 '[Field $R4]$\r$\n'
641 FileWrite $R3 'Type="GroupBox"$\r$\nText="Storage"$\r$\nLeft=0$\r$\nTop=$R5$\r$\nRight=300$\r$\nBottom=$R6$\r$\n'
647 FileWrite $R3 '[Field $R4]$\r$\nType="Checkbox"$\r$\nState=$OptService$\r$\nText="Install as service"$\r$\nLeft=6$\r$\nTop=$R5$\r$\nRight=280$\r$\nBottom=$R6$\r$\n'
653 FileWrite $R3 '[Field $R4]$\r$\nType="Checkbox"$\r$\nState=$OptStart$\r$\nText="Start after install"$\r$\nLeft=6$\r$\nTop=$R5$\r$\nRight=280$\r$\nBottom=$R6$\r$\n'
662 FileWrite $R3 '[Field $R4]$\r$\n'
663 FileWrite $R3 'Type="GroupBox"$\r$\nText="Director"$\r$\nLeft=0$\r$\nTop=$R5$\r$\nRight=300$\r$\nBottom=$R6$\r$\n'
669 FileWrite $R3 '[Field $R4]$\r$\nType="Checkbox"$\r$\nState=$OptService$\r$\nText="Install as service"$\r$\nLeft=6$\r$\nTop=$R5$\r$\nRight=280$\r$\nBottom=$R6$\r$\n'
675 FileWrite $R3 '[Field $R4]$\r$\nType="Checkbox"$\r$\nState=$OptStart$\r$\nText="Start after install"$\r$\nLeft=6$\r$\nTop=$R5$\r$\nRight=280$\r$\nBottom=$R6$\r$\n'
681 FileWrite $R3 '[Field $R4]$\r$\nType="Label"$\r$\nText="Database:"$\r$\nLeft=6$\r$\nTop=$R5$\r$\nRight=46$\r$\nBottom=$R6$\r$\n'
687 FileWrite $R3 '[Field $R4]$\r$\nType="RadioButton"$\r$\nState=1$\r$\nText="MySQL"$\r$\nFlags="GROUP"$\r$\nLeft=46$\r$\nTop=$R5$\r$\nRight=86$\r$\nBottom=$R6$\r$\n'
692 FileWrite $R3 '[Field $R4]$\r$\nType="RadioButton"$\r$\nState=0$\r$\nText="PostgreSQL"$\r$\nFlags="NOTABSTOP"$\r$\nLeft=86$\r$\nTop=$R5$\r$\nRight=142$\r$\nBottom=$R6$\r$\n'
697 FileWrite $R3 '[Field $R4]$\r$\nType="RadioButton"$\r$\nState=0$\r$\nText="Builtin"$\r$\nFlags="NOTABSTOP"$\r$\nLeft=142$\r$\nTop=$R5$\r$\nRight=182$\r$\nBottom=$R6$\r$\n'
705 FileWrite $R3 "[Settings]$\r$\nNumFields=$R4$\r$\n"
709 !insertmacro MUI_HEADER_TEXT "$(TITLE_Options)" "$(SUBTITLE_Options)"
710 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "Options.ini"
719 !insertmacro MUI_INSTALLOPTIONS_READ $OptionsClientService "Options.ini" "Field $R4" "State"
721 !insertmacro MUI_INSTALLOPTIONS_READ $OptionsClientStart "Options.ini" "Field $R4" "State"
727 !insertmacro MUI_INSTALLOPTIONS_READ $OptionsStorageService "Options.ini" "Field $R4" "State"
729 !insertmacro MUI_INSTALLOPTIONS_READ $OptionsStorageStart "Options.ini" "Field $R4" "State"
735 !insertmacro MUI_INSTALLOPTIONS_READ $OptionsDirectorService "Options.ini" "Field $R4" "State"
737 !insertmacro MUI_INSTALLOPTIONS_READ $OptionsDirectorStart "Options.ini" "Field $R4" "State"
739 !insertmacro MUI_INSTALLOPTIONS_READ $R3 "Options.ini" "Field $R4" "State"
741 StrCpy $OptionsDirectorDB 1
744 !insertmacro MUI_INSTALLOPTIONS_READ $R3 "Options.ini" "Field $R4" "State"
746 StrCpy $OptionsDirectorDB 2
748 StrCpy $OptionsDirectorDB 3
755 ; $0 - Service Name (ie Bacula-FD)
756 ; $1 - Service Description (ie Bacula File Daemon)
757 ; $2 - Install as Service
758 ; $3 - Start Service now
760 Function InstallDaemon
761 Call CopyDependencies
763 IfFileExists "$APPDATA\Bacula\$0.conf" 0 +3
764 ExecWait '"$INSTDIR\bin\$0.exe" /kill' ; Shutdown any bacula that could be running
765 Sleep 3000 ; give it some time to shutdown
767 WriteRegDWORD HKLM "Software\Bacula" "Service_$0" $2
770 ExecWait '"$INSTDIR\bin\$0.exe" /install'
777 ; Start the service? (default skipped if silent, use /start to force starting)
781 Exec 'net start bacula'
784 Exec '"$INSTDIR\bin\$0.exe" -c "$APPDATA\Bacula\$0.conf"'
788 CreateShortCut "$SMPROGRAMS\Bacula\Start $1.lnk" "$INSTDIR\bin\$0.exe" '-c "$APPDATA\Bacula\$0.conf"' "$INSTDIR\bin\$0.exe" 0