[CentOS] Bacula in CentOS 5

Mon Jul 2 15:14:21 UTC 2007
Paul Heinlein <heinlein at madboa.com>

On Mon, 2 Jul 2007, Jordi Espasa Clofent wrote:

> Hi all,
> I'm planning to use Bacula in production environment. I've seen the 
> Bacula packages are not provided neither by any official repo nor 
> any third popular repo (as rpmforge).
> ¿Anyone use bacula in CentOS 5?

Yeah, I back up a handful of CentOS 5 (x86_64) boxes with Bacula 
2.0.3. For my purposes, I rely on a home-brewed client-only rpm that 
installs a minimal set of binaries. The .spec isn't well tested, but 
I've included it below just in case it helps.

Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/

# rpm spec for bacula-fd
# ======================================================================

Summary: Bacula - The Network Backup Solution
Name: bacula-client
Version: 2.0.3
Release: 1%{?_distver:.%{_distver}}
Group: System Environment/Daemons
License: GPL v2
Packager: Paul Heinlein <heinlein at madboa.com>
URL: http://www.bacula.org/
Source: http://prdownloads.sourceforge.net/bacula/bacula-2.0.3.tar.gz
BuildRequires: findutils, openssl-devel, sed
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Bacula - It comes by night and sucks the vital essence from your

Bacula is a set of computer programs that permit you (or the system
administrator) to manage backup, recovery, and verification of
computer data across a network of computers of different kinds. In
technical terms, it is a network client/server based backup program.

This build includes just the Bacula client, bacula-fd, which will
only function when paired with a remote director and storage daemon.

%setup -q -n bacula-%{version}

CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" CPPFLAGS="-I/usr/kerberos/include" \
./configure \
   --prefix=%{_prefix} \
   --mandir=%{_mandir} \
   --sysconfdir=%{_sysconfdir}/bacula \
   --with-working-dir=%{_localstatedir}/bacula \
   --with-scriptdir=%{_sysconfdir}/bacula \
   --enable-client-only \
   --with-openssl \
   --with-fd-group=bacula \

make %{_smp_mflags}

/bin/rm -rf "$RPM_BUILD_ROOT"
# get rid of some files not needed for client-only installations
for f in \
   bacula-ctl-dir bacula-ctl-sd \
   disk-changer dvd-handler \
   gconsole \
   mtx-changer \
   startmysql stopmysql
   /bin/rm -f ${RPM_BUILD_ROOT}%{_sysconfdir}/bacula/${f}
# ...and some man pages, too
for f in \
   bacula-console-gnome bacula-tray-monitor bacula-wxconsole bsmtp \
   bacula-dir bacula-sd bcopy bextract bls bscan btape dbcheck
   /bin/rm -f ${RPM_BUILD_ROOT}%{_mandir}/*/${f}.?.gz
# the stock fd start script will work just fine as an init script
# as long as we add a chkconfig header (right before the conveniently
# placed description: comment :-)
install -d $RPM_BUILD_ROOT%{_initrddir}
sed -e \
   's/^\(#[[:space:]]*description:.*\)$/# chkconfig: 2345 98 20\n\1/' \
   ${RPM_BUILD_ROOT}%{_sysconfdir}/bacula/bacula-ctl-fd \
   > ${RPM_BUILD_ROOT}%{_initrddir}/bacula-fd
# make everything in the examples directory non-executable to
# avoid unresolved dependencies
/usr/bin/find examples -type f | /usr/bin/xargs chmod a-x

/bin/rm -rf $RPM_BUILD_ROOT

# check for and copy /etc/bacula/console.conf to bconsole.conf
if [ -s %{_sysconfdir}/bacula/console.conf ]; then
   cp -p %{_sysconfdir}/bacula/console.conf %{_sysconfdir}/bacula/bconsole.conf

/sbin/chkconfig --add bacula-fd
/usr/sbin/groupadd -r bacula 2>/dev/null || :

if [ $1 = 0 ]; then
   /sbin/service bacula-fd stop > /dev/null 2>&1
   /sbin/chkconfig --del bacula-fd

%doc ChangeLog LICENSE README ReleaseNotes examples kernstodo projects
%attr(0755,root,root) %{_initrddir}/bacula-fd
%dir %{_sysconfdir}/bacula
%config(noreplace) %{_sysconfdir}/bacula/bacula-fd.conf
%config(noreplace) %{_sysconfdir}/bacula/bconsole.conf
%doc %{_mandir}/*/*
%dir %attr(0700,root,root) %{_localstatedir}/bacula

### eof