Blob Blame History Raw
%define working_dir	/var/spool/bacula2
%define script_dir	/usr/libexec/bacula2

Summary: Backup client for bacula version 2 server
Name: bacula2
Version: 2.4.4
Release: 9%{?dist}
# See LICENSE for details
License: GPLv2 with exceptions
Group: System Environment/Daemons
Source0: http://downloads.sf.net/bacula/bacula-%{version}.tar.gz
#Source7: bacula2-fd.init
Source8: bacula2-fd.service
Patch0:	bacula2-2.4.4-utf8.patch
Patch1: bacula2-config.patch
Patch2: bacula2-3.0.2-openssl.patch
Patch3: bacula2-2.4.4-python27.patch
URL: http://www.bacula.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: openssl-devel, perl
BuildRequires: libacl-devel, zlib-devel, python-devel, 
BuildRequires: libstdc++-devel, libxml2-devel, pkgconfig
BuildRequires: glibc-devel, sed, systemd-units
# This is actually tcp_wrappers-devel but I don't want to deviate from the main
# Fedora/EPEL packages without good reason.
BuildRequires: /usr/include/tcpd.h

%description
Bacula is a set of programs that allow you to manage the backup, recovery,
and verification of computer data across a network of different computers.
It is based on a client/server architecture and is efficient and relatively
easy to use, while offering many advanced storage management features that
make it easy to find and recover lost or damaged files.

The bacula2 packages are clients suitable for use with a bacula version
2.x server (director), since later clients are incompatible.

%package client
Summary: Bacula backup client
Group: System Environment/Daemons
Requires: bacula2-common = %{version}-%{release}
#Requires(post): /sbin/chkconfig
#Requires(preun): /sbin/chkconfig
#Requires(preun): /sbin/service
#Requires(postun): /sbin/service
Requires(post): systemd-units
Requires(post): systemd-sysv
Requires(preun): systemd-units
Requires(postun): systemd-units


%description client
Bacula is a set of programs that allow you to manage the backup, recovery,
and verification of computer data across a network of different computers.
It is based on a client/server architecture.

This package contains the bacula version 2 client, the daemon running on
the system to be backed up to a bacula version 2 server (director).

%package common
Summary: Common Bacula utilities
Group: System Environment/Daemons
Requires(pre): shadow-utils

%description common
Bacula is a set of programs that allow you to manage the backup, recovery,
and verification of computer data across a network of different computers.
It is based on a client/server architecture.

The bacula2 packages are clients suitable for use with a bacula version
2.x server (director), since later clients are incompatible.

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

# Patching and other source preparation
%patch0 -p1
%patch1 -p1
%patch2 -p2
%patch3 -p0

# Remove execution permissions from files we're packaging as docs later on
find examples -type f | xargs chmod -x
find updatedb -type f | xargs chmod -x

# Fix perms of c files to silent rpmlint for debuginfo
chmod -x src/console/conio.c

%build

# GCC 4.3+/glibc detects a false positive buffer overflow in bacula 2.4 so we
# need to disable FORTIFY_SOURCE:
#  - http://www.mail-archive.com/bacula-devel@lists.sourceforge.net/msg01786.html
#  - http://bugs.bacula.org/view.php?id=1220
#  - http://bugs.bacula.org/view.php?id=1042
CFLAGS="$(echo %{optflags}|sed s/-D_FORTIFY_SOURCE=./-U_FORTIFY_SOURCE/)" \
  %configure \
	--sysconfdir=%{_sysconfdir}/bacula2 \
	--with-fd-user=root \
	--with-fd-group=root \
	--with-fd-password=@@FD_PASSWORD@@ \
	--with-mon-dir-password=@@MON_DIR_PASSWORD@@ \
	--with-mon-fd-password=@@MON_FD_PASSWORD@@ \
	--with-mon-sd-password=@@MON_SD_PASSWORD@@ \
	--with-working-dir=%{working_dir} \
	--with-scriptdir=%{script_dir} \
	--with-smtp-host=localhost \
	--with-subsys-dir=%{_localstatedir}/lock/subsys \
	--with-pid-dir=%{_localstatedir}/run \
	--enable-client-only \
	--enable-largefile \
	--with-openssl \
	--with-tcp-wrappers \
	--with-python \
	--enable-smartalloc

%{__make} %{?_smp_mflags}

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}

# Desktop Integration for the console apps and the traymonitor
mkdir -p %{buildroot}%{_bindir}

# Initscript
#install -m 755 -D %{SOURCE7}  %{buildroot}%{_initrddir}/bacula2-fd
install -m 755 -D %{SOURCE8}  %{buildroot}%{_unitdir}/bacula2-fd.service

# Create the spool directory (bacula user's home directory)
mkdir -p %{buildroot}%{_localstatedir}/spool/bacula2

# rename files so that they don't interfer with the main bacula package
mv %{buildroot}%{_sbindir}/bacula-fd %{buildroot}%{_sbindir}/bacula2-fd
mv %{buildroot}%{_mandir}/man8/bacula-fd.8.gz %{buildroot}%{_mandir}/man8/bacula2-fd.8.gz

# Nuke commands we do not need
rm -vf %{buildroot}%{_sbindir}/{bconsole,btraceback}

# Nuke the scripts we do not need
rm -rvf %{buildroot}%{_libexecdir}/

# Nuke manpages for commands we do not ship
rm -vf %{buildroot}%{_mandir}/man1/{bat,bsmtp,bacula-bgnome-console,bacula-bwxconsole,bacula-tray-monitor}.1.gz
rm -vf %{buildroot}%{_mandir}/man8/{bacula,bacula-*,bconsole,bcopy,bextract,bls,bscan,btape,btraceback,dbcheck}.8.gz

# Nuke config files
rm -vf %{buildroot}%{_sysconfdir}/bacula2/bconsole.conf

# Fix up some perms so rpmlint does not complain too much
chmod 755 %{buildroot}%{_sbindir}/*

%clean
rm -rf %{buildroot}

%pre common
getent group bacula >/dev/null || groupadd -r bacula
getent passwd bacula >/dev/null || \
	useradd -r -s /sbin/nologin -d %{_localstatedir}/spool/bacula2 -M \
		-c 'Bacula Backup System' -g bacula bacula
exit 0

%post client
/sbin/chkconfig --add bacula2-fd

%preun client
if [ $1 = 0 ]; then
#	/sbin/service bacula2-fd stop &>/dev/null || :
#	/sbin/chkconfig --del bacula2-fd
	# Package removal, not upgrade
	/bin/systemctl --no-reload disable bacula2-fd.service > /dev/null 2>&1 || :
	/bin/systemctl stop bacula2-fd.service > /dev/null 2>&1 || :

fi

%postun client
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ "$1" -ge "1" ]; then
#	/sbin/service bacula2-fd condrestart &>/dev/null || :
	# Package upgrade, not uninstall
	/bin/systemctl try-restart bacula2-fd.service >/dev/null 2>&1 || :
fi

%triggerun -- bacula2-client < 2.4.4-8
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply httpd
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save bacula2-fd >/dev/null 2>&1 ||:

# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del bacula2-fd >/dev/null 2>&1 || :
/bin/systemctl try-restart bacula2-fd.service >/dev/null 2>&1 || :


%files common
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING LICENSE README SUPPORT VERIFYING examples/
%dir %{_sysconfdir}/bacula2/
%dir %attr(750, bacula, bacula) %{_localstatedir}/spool/bacula2/

%files client
%defattr(-,root,root,-)
%{_sbindir}/bacula2-fd
#%{_initrddir}/bacula2-fd
%{_unitdir}/bacula2-fd.service
%config(noreplace) %{_sysconfdir}/bacula2/bacula-fd.conf
%dir %{_localstatedir}/spool/bacula2/
%{_mandir}/man8/bacula2-fd.8*

%changelog
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.4-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Nov 22 2011 Jon Ciesla <limb@jcomserv.net> 2.4.4-8
- Migrated to systemd, BZ 754475.

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Jul 30 2010 Jon Ciesla <limb@jcomserv.net> 2.4.4-6
- Python 2.7 patch.

* Fri Jul 30 2010 Jon Ciesla <limb@jcomserv.net> 2.4.4-5
- Python 2.7 rebuild.

* Mon Mar 22 2010 Jon Ciesla <limb@jcomserv.net> 2.4.4-4
- Renamed sources and patches to avoid clobering Bacula SRPM.

* Sat Feb  6 2010 Felix Schwarz <felix.schwarz@oss.schwarz.eu> 2.4.4-3
- Changed all names to bacula2 so that the package can be installed in parallel
  to a modern bacula package
- Disabled FORTIFY_SOURCE due - GCC 4.3+ detects false positive

* Fri Feb  5 2010 Paul Howarth <paul@city-fan.org> 2.4.4-2
- Fork to bacula2, a client-only package to support use of bacula version 2
  servers on more recent distributions

* Wed Jan 14 2009 Jon Ciesla <limb@jcomserv.net> 2.4.4-1
- Update to 2.4.4, fix alternatives.

* Thu Sep 13 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-10
- Applied restore fix to sd. #288981

* Wed Jul 25 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-9
- Corrected the %%post alternatives calls. Fixing #249560.

* Wed Jul 19 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-8
- Moved some files around in the %%files section and refactored
  spec parts a bit
- Fixed up the catalog-backup scripts by including them in the
  alternatives system
- Applied tls patch fixing some tls disconnection issues.

* Thu Jul 18 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-7
- Minor specchanges, mostly typos in the comments
- Incorporated minor changes from dgilmore's review.

* Fri Jul 13 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-6
- Fixing %%preun scripts. Thx to Dan for spotting this

* Fri Jul 13 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-5
- Fixed provides and requires

* Wed Jul 11 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-4
- Fixed many rpmlint issues

* Thu Apr 26 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-3
- Final cleanups for fedora
- Removed webgui for now. It will be back in a future release
- Added LANG=C calls to the initscripts

* Thu Apr 26 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-2
- Added logdir
- Fixed up doc-creation to actually work
- Fixed up web interface
- Included docs sub-package
- Included README et al as docs where appropriate

* Sat Mar 10 2007 Andreas Thienemann <andreas@bawue.net> 2.0.3-1
- Updated to 2.0.3
- Reverted the database-check as we're not sure the db is running on the
  local machine. A later revision might parse the bacula-dir.conf file
  and just connect to the db to see if it's running.

* Sat Feb 28 2007 Andreas Thienemann <andreas@bawue.net> 2.0.2-1
- Further updates on the spec

* Sat Feb 18 2007 Andreas Thienemann <andreas@bawue.net> 2.0.2-1
- Much work on the spec
- Updated to 2.0.2

* Sat Feb 18 2006 Andreas Thienemann <andreas@bawue.net> 1.38.11-1
- Initial spec.