# Bacula RPM spec file
#
-# Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
# Platform Build Configuration
# basic defines for every build
%define _release 1
-%define _version 5.0.0
+%define _version 5.0.3
%define _packager D. Scott Barninger <barninger@fairfieldcomputers.com>
%define depkgs_version 18Dec09
-%define single_dir 0
+# postgresql defines - defaults for most platforms
+# pass changes if required
+# versions less than 8 are no longer supported
+%define postgres_version 8
+%{?postgresql_version:%define postgres_version %{postgresql_version}}
+%define postgres_package postgresql84
+%{?postgresql_package:%define postgres_package %{postgresql_package}}
+%define postgres_server_package postgresql84-server
+%{?postgresql_server_package:%define postgres_server_package %{postgresql_server_package}}
+%define postgres_devel_package postgresql84-devel
+%{?postgresql_devel_package:%define postgres_devel_package %{postgresql_devel_package}}
+
+%define single_dir 1
%{?single_dir_install:%define single_dir 1}
# Installation Directory locations
%define _sbindir /opt/bacula/bin
%define _bindir /opt/bacula/bin
%define _subsysdir /opt/bacula/working
-%define sqlite_bindir /opt/bacula/sqlite
+%define sqlite_bindir /opt/bacula/sqlite
%define _mandir /usr/share/man
%define sysconf_dir /opt/bacula/etc
%define script_dir /opt/bacula/scripts
# am I running in opensuse build service?
# TODO: seems to make problems
-# choose database backend here
-# postgres, mysql, sqlite
-%define build_mysql 1
-
# Build Service: Determine Distribution
%ifarch x86_64
Version: %{_version}
Release: %{_release}
Group: System Environment/Daemons
-License: GPL v2
+License: AGPLv3
BuildRoot: %{_tmppath}/%{name}-root
URL: http://www.bacula.org/
Vendor: The Bacula Team
%else
Source1: Release_Notes-%{version}-%{release}.tar.gz
%endif
-Source2: bacula-2.2.7-postgresql.patch
-Source3: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
+Source2: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
# define the basic package description
-%define blurb Bacula - It comes by night and sucks the vital essence from your computers.
+%define blurb Bacula - The Leading Open Source Backup Solution.
%define blurb2 Bacula is a set of computer programs that permit you (or the system
%define blurb3 administrator) to manage backup, recovery, and verification of computer
%define blurb4 data across a network of computers of different kinds. In technical terms,
%define blurb5 it is a network client/server based backup program. Bacula is relatively
%define blurb6 easy to use and efficient, while offering many advanced storage management
%define blurb7 features that make it easy to find and recover lost or damaged files.
-%define blurb8 Bacula source code has been released under the GPL version 2 license.
+%define blurb8 Bacula source code has been released under the AGPL version 3 license.
%define user_file /etc/passwd
%define group_file /etc/group
%{?build_fc9:%define fc9 1}
%define fc10 0
%{?build_fc10:%define fc10 1}
+%define fc11 0
+%{?build_fc11:%define fc11 1}
+%define fc12 0
+%{?build_fc12:%define fc12 1}
# Whitebox Enterprise build
%define wb3 0
%{?build_wb3:%define wb3 1}
%define rhat 1
%endif
%define fed 0
-%if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc6} || %{fc7} || %{fc8} || %{fc9} || %{fc10}
+%if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc6} || %{fc7} || %{fc8} || %{fc9} || %{fc10} || %{fc11} || %{fc12}
%define fed 1
%endif
%define suse 0
# test for a platform definition
-%if !%{rhat} && !%{rhel} && !%{fed} && !%{wb3} && !%{suse} && !%{mdk}
+%if !%{rhat} && !%{rhel} && !%{fed} && !%{wb3} && !%{suse} && !%{mdk} && !%{scil}
%{error: You must specify a platform. Please examine the spec file.}
exit 1
%endif
# set for database support desired or define the build_xxx on the command line
%define mysql 0
%{?build_mysql:%define mysql 1}
-# if using mysql 4.x define this and mysql above
-# currently: Mandrake 10.1, SuSE 9.x & 10.0, RHEL4 and Fedora Core 4
-%define mysql4 0
-%{?build_mysql4:%define mysql4 1}
-%{?build_mysql4:%define mysql 1}
-# if using mysql 5.x define this and mysql above
-# currently: SuSE 10.1 and Fedora Core 5
-%define mysql5 0
-%{?build_mysql5:%define mysql5 1}
-%{?build_mysql5:%define mysql 1}
%define sqlite 0
%{?build_sqlite:%define sqlite 1}
%define postgresql 0
# test for a database definition
%if ! %{mysql} && ! %{sqlite} && ! %{postgresql} && ! %{client_only}
-%{error: You must specify database support. Please examine the spec file.}
+%{error: You must specify database support, by passing one of the following to rpmbuild:}
+%{error: --define build_postgresql=1}
+%{error: --define build_sqlite=1}
+%{error: --define build_mysql=1}
exit 1
%endif
%if %{rhat} || %{rhel}
%define _dist %(grep Red /etc/redhat-release)
%endif
-%if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc7} || %{fc8} || %{fc9} || %{fc10}
+%if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc7} || %{fc8} || %{fc9} || %{fc10} || %{fc11} || %{fc12}
%define _dist %(grep Fedora /etc/redhat-release)
%endif
%if %{centos5} || %{centos4} || %{centos3}
# only set Disribution if not in opensuse build service, as it sets it itself
%if ! 0%{?opensuse_bs}
-%{?DISTNAME:%define _dist %{DISTNAME}}
Distribution: %{_dist}
%endif
BuildRequires: mysql
%endif
%if 0%{?opensuse_bs} && %{suse} && %{postgresql}
-BuildRequires: postgresql
-BuildRequires: postgresql-server
+BuildRequires: %{postgres_package}
+BuildRequires: %{postgres_server_package}
%endif
BuildRequires: openssl
%define python 0
%{?build_python:%define python 1}
-# specifically disallow build of mtx package if desired
-%define mtx 0
-%{?nobuild_mtx:%define mtx 0}
-
-# do we need to patch for old postgresql version?
-%define old_pgsql 0
-%{?build_old_pgsql:%define old_pgsql 1}
+# should we enable tcp wrappers support
+%define tcpwrappers 0
+%{?build_tcpwrappers:%define tcpwrappers 1}
# Mandriva somehow forces the manpage file extension to bz2 rather than gz
%if %{mdk}
# for client only build
%if %{client_only}
%define mysql 0
-%define mysql4 0
-%define mysql5 0
%define postgresql 0
%define sqlite 0
%endif
BuildRequires: gcc, gcc-c++, make, autoconf
BuildRequires: glibc, glibc-devel
-BuildRequires: ncurses-devel, perl
+BuildRequires: ncurses-devel, perl, readline-devel
BuildRequires: libstdc++-devel, zlib-devel
BuildRequires: openssl-devel
BuildRequires: libacl-devel
%endif
%if %{rh7}
-BuildRequires: libtermcap-devel
BuildRequires: libxml-devel
%endif
-%if %{suse}
-BuildRequires: termcap
-%endif
%if %{mdk}
-BuildRequires: libtermcap-devel
BuildRequires: libstdc++-static-devel
BuildRequires: glibc-static-devel
%endif
-%if %{fc1} || %{fc3} || %{fc4} || %{fc5} || %{fc7} || %{fc8}
+
+%if %{suse}
+BuildRequires: termcap
+%else
BuildRequires: libtermcap-devel
%endif
+
%if %{sqlite}
BuildRequires: sqlite-devel
%endif
%endif
%if %{postgresql} && %{wb3}
-BuildRequires: rh-postgresql-devel >= 7
+BuildRequires: rh-postgresql-devel >= %{postgres_version}
%endif
%if %{postgresql} && ! %{wb3}
-BuildRequires: postgresql-devel >= 7
+BuildRequires: %{postgres_devel_package} >= %{postgres_version}
%endif
%description
Conflicts: bacula-client
Requires: ncurses, libstdc++, zlib, openssl
-Requires: glibc
+Requires: glibc, readline, %{name}-libs
-%if %{rhel} || %{rhat} || %{fed}
-Requires: libtermcap
-%endif
%if %{suse}
Conflicts: bacula
Requires: termcap
+%else
+Requires: libtermcap
%endif
%if %{mysql}
Requires: mysql
-
-%if %{suse} || %{mdk}
-Requires: mysql-client
-%else
-Requires: mysql-server
-%endif
%endif
%if %{postgresql} && %{wb3}
Requires: rh-postgresql >= 7
-Requires: rh-postgresql-server >= 7
%endif
%if %{postgresql} && ! %{wb3}
Requires: postgresql >= 7
-Requires: postgresql-server >= 7
%endif
%if %{mysql}
%if %{python}
This build includes python scripting support.
%endif
+%if %{tcpwrappers}
+This build includes tcp-wrappers support.
+%endif
%package client
Summary: Bacula - The Network Backup Solution
%endif
Requires: libstdc++, zlib, openssl
-Requires: glibc
+Requires: glibc, readline, %{name}-libs
%if %{suse}
Requires: termcap
%if %{python}
This build includes python scripting support.
%endif
+%if %{tcpwrappers}
+This build includes tcp-wrappers support.
+%endif
%if ! %{client_only}
%package updatedb
database.
%endif
+%package libs
+
+Summary: Bacula - The Network Backup Solution
+Group: System Environment/Daemons
+
+%description libs
+%{blurb}
+
+%{blurb2}
+%{blurb3}
+%{blurb4}
+%{blurb5}
+%{blurb6}
+%{blurb7}
+%{blurb8}
+
+This package installs the shared libraries used by many bacula programs.
+
# Must explicitly enable debug pkg on SuSE
# but not in opensuse_bs
%if %{suse} && ! 0%{?opensuse_bs}
%prep
%setup
%setup -T -D -b 1
-%setup -T -D -b 3
+%setup -T -D -b 2
%build
%if %{suse}
-export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap"
+export LDFLAGS="${LDFLAGS} -L/usr/lib/termcap -L/usr/lib64/termcap"
%endif
cwd=${PWD}
cd ${cwd}
%endif
-%if %{wb3} || %{old_pgsql}
-patch -p3 src/cats/postgresql.c < %SOURCE2
-%endif
+%if %{sqlite}
# patches for the bundled sqlite scripts
# patch the make_sqlite_tables script for installation bindir
%if %{sqlite} && %{suse}
patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
%endif
+%endif
# 64 bit lib location hacks
# as of 1.39.18 it should not be necessary to enable x86_64 as configure is
--disable-gnome \
--disable-bwx-console \
--disable-tray-monitor \
+ --disable-conio \
+ --enable-readline \
%if %{mysql}
--with-mysql \
%endif
--with-postgresql \
%endif
--disable-bat \
- --without-qwt \
%if %{python}
--with-python \
%endif
+%if %{tcpwrappers}
+ --with-tcp-wrappers \
+%endif
%if %{client_only}
--enable-client-only \
%endif
# install the updatedb scripts
cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
+# install the sample-query.sql file
+%if ! %{client_only}
+cp -p examples/sample-query.sql $RPM_BUILD_ROOT%{script_dir}/sample-query.sql
+%endif
+
# install the logwatch scripts
%if ! %{client_only}
cp -p scripts/logwatch/bacula $RPM_BUILD_ROOT%{logwatch_dir}/scripts/services/bacula
# fix me - building enable-client-only installs files not included in bacula-client package
%if %{client_only}
rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula_config
rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
%attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
%attr(-, root, %{daemon_group}) %{script_dir}/startmysql
%attr(-, root, %{daemon_group}) %{script_dir}/stopmysql
+%{_libdir}/libbacsql*
%endif
%if %{sqlite}
%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
%attr(-, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
%attr(-, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
-# The rest is DB backend independent
+%{_libdir}/libbacsql*
%endif
-# opensuse_bs: directories not owned by any package
-%dir %attr(-, root, %{daemon_group}) %{sysconf_dir}
+
+# The rest is DB backend independent
%if ! %{client_only}
%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
%attr(-, root, %{daemon_group}) %{script_dir}/bacula
%attr(-, root, %{daemon_group}) %{script_dir}/bacula_config
%attr(-, root, %{daemon_group}) %{script_dir}/bconsole
%attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.mdb
%attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
%attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
%attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
%attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
-%attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer.conf
+%attr(-, root, %{storage_daemon_group}) %config(noreplace) %{script_dir}/mtx-changer.conf
/etc/logrotate.d/bacula
%{logwatch_dir}/scripts/services/bacula
%attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/logfiles/bacula.conf
%attr(-, root, %{daemon_group}) %config(noreplace) %{logwatch_dir}/conf/services/bacula.conf
%attr(-, root, %{daemon_group}) %config(noreplace) %{script_dir}/query.sql
+%attr(-, root, %{daemon_group}) %{script_dir}/sample-query.sql
%attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
%{_mandir}/man8/dbcheck.8.%{manpage_ext}
%{_mandir}/man1/bsmtp.1.%{manpage_ext}
%{_mandir}/man1/bat.1.%{manpage_ext}
-%{_libdir}/libbac*
%_prefix/share/doc/*
# opensuse build service changes the release itself
%if %{mysql}
%pre mysql
-# test for bacula database older than version 12
+# test for bacula database older than version 13
# note: this ASSUMES no password has been set for bacula database
DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
%endif
echo "chown bacula.bacula bacula.db"
exit 1
fi
-# test for bacula database older than version 11 and sqlite3
+# test for bacula database older than version 12 and sqlite3
if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite3 ];then
DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
%endif
%endif
%if ! %{client_only}
-if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "11" ]; then
- echo "This bacula upgrade will update a bacula database from version 11 to 12."
+if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "12" ]; then
+ echo "This bacula upgrade will update a bacula database from version 12 to 13."
echo "You appear to be running database version $DB_VER. You must first update"
- echo "your database to version 11 and then install this upgrade. The alternative"
+ echo "your database to version 12 and then install this upgrade. The alternative"
echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
echo "catalog information, then do the upgrade. Information on updating a"
- echo "database older than version 11 can be found in the release notes."
+ echo "database older than version 12 can be found in the release notes."
exit 1
fi
%endif
%{script_dir}/make_mysql_tables
# check to see if we need to upgrade a 3.x database
-elif [ "$DB_VER" -lt "12" ]; then
+elif [ "$DB_VER" -lt "13" ]; then
echo "This release requires an upgrade to your bacula database."
echo "Backing up your current database..."
mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
if [ -s %{working_dir}/bacula.db ]; then
DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite3 2>/dev/null %{working_dir}/bacula.db | tail -n 1`
# check to see if we need to upgrade a 3.x database
- if [ "$DB_VER" -lt "12" ] && [ "$DB_VER" -ge "11" ]; then
+ if [ "$DB_VER" -lt "13" ] && [ "$DB_VER" -ge "12" ]; then
echo "This release requires an upgrade to your bacula database."
echo "Backing up your current database..."
echo ".dump" | %{sqlite_bindir}/sqlite3 %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Granting privileges for PostgreSQL user bacula..."
%{script_dir}/grant_postgresql_privileges
-# check to see if we need to upgrade a 3.x database
-elif [ "$DB_VER" -lt "12" ]; then
+# check to see if we need to upgrade a 5.0.x database
+elif [ "$DB_VER" -lt "13" ]; then
echo "This release requires an upgrade to your bacula database."
echo "Backing up your current database..."
pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
done
fi
%endif
-/sbin/ldconfig
-exit 0 # always exit successfull, as otherwise opensuse build service complains
+
%if %{mysql}
%preun mysql
/sbin/chkconfig --del bacula-fd
/sbin/chkconfig --del bacula-sd
fi
-/sbin/ldconfig
%endif
-# added: run ldconfig in postun
-%if %{mysql}
-%postun mysql
-%endif
-%if %{sqlite}
-%postun sqlite
-%endif
-%if %{postgresql}
-%postun postgresql
-%endif
-/sbin/ldconfig
-
%files client
%defattr(-,root,root)
%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
%{script_dir}/bacula-ctl-fd
/etc/init.d/bacula-fd
%{_mandir}/man8/bconsole.8.%{manpage_ext}
%{_mandir}/man8/btraceback.8.%{manpage_ext}
%{_mandir}/man1/bat.1.%{manpage_ext}
-%{_libdir}/libbac.*
-%{_libdir}/libbaccfg.*
-%{_libdir}/libbacfind.*
-%{_libdir}/libbacpy.*
%_prefix/share/doc/*
-#opensuse_bs: directories not owned by any package
-%dir %attr(-, root, %{daemon_group}) %{sysconf_dir}
-
%pre client
# create the daemon group and user
HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
done
fi
-/sbin/ldconfig
-exit 0
%preun client
# delete our link
if [ $1 = 0 ]; then
/sbin/chkconfig --del bacula-fd
fi
-%postun client
+%files libs
+%defattr(-,root,root)
+%{_libdir}/libbac-*
+%{_libdir}/libbac.*
+%{_libdir}/libbaccfg*
+%{_libdir}/libbacfind*
+%{_libdir}/libbacpy*
+
+%post libs
/sbin/ldconfig
+exit 0
+
+%postun libs
+/sbin/ldconfig
+exit 0
%if ! %{client_only}
%files updatedb
%endif
%changelog
+* Mon Sep 06 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
+* Mon Sep 06 2010 Kern Sibbald <kern@sibbald.com>
+- 5.0.3
+- change license to AGPL v3
+- add defines for postgresql version and packages, require version 8 or greater
+- adjusted package description
+- fix bug with libbacsql files
+* Sun Mar 07 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- remove --without-qwt from configure statement
+* Sat Feb 27 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- move shared libraries into bacula-libs package
+* Sat Feb 20 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- remove deprecated mysql4 and mysql5 build defines
+- add build support for tcpwrappers
+- remove bacula_config file for client only build
+- remove requirements for database server packages
+- enable readline support
+- add fc11 and fc12
+* Sat Feb 13 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- 5.0.1
+- fix client only build
+- clean up requirements for termcap
+- query.sql now empty by default so we install sample-query.sql along side it
+- remove old nobuild_mtx switch
* Sun Feb 07 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
- fix mysql database upgrade
* Fri Feb 05 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>