User Tools

Site Tools


howto_upgrade_win32_bacula_file_daemons_with_ocs_inventory_ng

If you already have OCS Inventory NG deployed and the Bacula-FD installed on your Windows clients, here's how to upgrade your Bacula-FDs First you need to create a self-extracting package that automatically runs (you could also use this one with other deployment tools). Here is an example NSIS script you could use to generate an automated installer:

; upgradebacula.nsi
;
; ChangeLog
; v0.1 - initial release

!define TEMP1 $R0 ;Temp variable

; The name of the installer
Name "Bacula"

; The file to write
OutFile "upgradebacula.exe"

; The default installation directory
InstallDir "c:\bacula\bin"

Function .onInit
FunctionEnd

Section "Install"
  ; Set output path to the installation directory.
  SetOutPath $INSTDIR
  ; Shut down the FD.
  nsExec::Exec "net stop bacula-fd"
  Sleep 5000
  ; Extract the files that are in c:\baculabinaries to the install dir.
  File "c:\baculabinaries\*.*"
  Sleep 5000
  ; Start the FD again.
  nsExec::Exec "net start bacula-fd"

 SectionEnd

; eof

To generate an installer from this script, put all the binaries you want to be extracted on the target clients into c:\baculabinaries. You can get the binaries either by installing the FD normally, or by using 7-Zip or similar to extract them from the original installer.

Note: The above installer deploys the files to c:\bacula\bin. If your Bacula-FDs are installed in a different directory on your clients, you will need to adapt the installation directory in the script. The same goes for the service name: Initially, Bacula used the service name 'bacula', this has been changed to 'bacula-fd' in the meantime so if your clients still use the old name, change it back. Alternatively, you could also duplicate the line and have a 'net stop' command for each of them. ('net stop' on a non-existing service will output an error message but won't hurt your clients in any way.)

To use the above installer with OCS Inventory NG, simply put it into a ZIP file and then build a package with that zipfile and set it to execute 'upgradebacula.exe /S' (make sure you use an upper case S, otherwise the installer won't be silent).

One small warning: The above does not check whether the FD is currently running a backup or not. If you're unlucky, OCS Inventory might decide to run the package while a backup is taking place which, given that it shuts down the FD, would cause the running backup to fail. You can work around that by changing the 'File' line (append a /REBOOT parameter to it or similar to have NSIS only replace the files on reboot) and removing the 'net stop' and 'net start' commands), however you'll have to ensure your client gets rebooted after the package got deployed to it to make the new FD version become active.

howto_upgrade_win32_bacula_file_daemons_with_ocs_inventory_ng.txt · Last modified: 2008/05/09 12:06 by steltek