File bacula.spec of Package bacula52

#
# spec file for package bacula
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

%define pkgversion 5.2.13

Name:           bacula
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
BuildRequires:  gcc-c++ libacl-devel mysql-devel openssl-devel readline-devel xorg-x11-devel bc procps iputils postgresql-devel

%if 0%{?suse_version}
BuildRequires:	tcpd-devel termcap
%if 0%{?suse_version} <= 1230
BuildRequires:  postgresql-libs
%else
BuildRequires:  libpq5
BuildRequires:	libtool
%endif
%endif

%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
BuildRequires:	tcp_wrappers libtermcap-devel
%endif

%if 0%{?fedora_version} >= 7 || 0%{?rhel_version} >= 600 || 0%{?sl_version} >= 600 || 0%{?centos_version} >= 6
BuildRequires:	tcp_wrappers-devel
%endif

%define		_libver 5_2_13
%define		_sover 5.2.13

License:        GPL v2 or later
Group:          Productivity/Archiving/Backup
AutoReqProv:    on
Version:        5.2.13
Release:        1
Summary:        Bacula--The Network Backup Solution: Client Part
Url:            http://www.bacula.org
Source0:        %{name}-%{pkgversion}.tar.bz2
%if 0%{?suse_version}
Source10:       bacula-dir.init
Source11:       bacula-fd.init
Source12:       bacula-sd.init
%endif

%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
Source10:	bacula-dir.init.rh
Source11:	bacula-fd.init.rh
Source12:	bacula-sd.init.rh
%endif

Source20:       bacula-dir.fw
Source21:       bacula-fd.fw
Source22:       bacula-sd.fw
Source50:	bacula-rpmlintrc
Patch1:         %{name}-2.4.4-python.diff
Patch3:		bacula-compress-man.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Bacula comes by night and sucks the vital essence from your computers.
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. Bacula is
relatively easy to use and efficient, while offering many advanced
storage management features that make it easy to find and recover lost
or damaged files.



%package server
License:        GPL v2 or later
Summary:        Bacula - The Network Backup Solution - server part
Group:          Productivity/Archiving/Backup
Requires:       bacula = %{version}
Obsoletes:	bacula-server-postgresql
Obsoletes:	bacula-server-mysql
Provides:	bacula-server-postgresql = %{version}
Provides:	bacula-server-mysql = %{version}
AutoReqProv:    on

%description server
Bacula - It comes by night and sucks the vital essence from your
computers. 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.
Bacula is relatively easy to use and efficient, while offering many
advanced storage management features that make it easy to find and
recover lost or damaged files. This package contains Bacula server
daemons.


%package devel
Summary:	Bacula devel files
Group:		Productivity/Archiving/Backup
Requires:	libbac-%{_libver} = %{version}
Requires:	libbaccfg-%{_libver} = %{version}
Requires:	libbacfind-%{_libver} = %{version}
Requires:	libbacpy-%{_libver} = %{version}
Requires:	libbacsql-%{_libver} = %{version}
Requires:	ncurses-devel
%if 0%{?suse_version}
Requires:	tcpd-devel
%endif
Requires:	postgresql-devel
Requires:	glibc-devel

%description devel

%package -n libbaccats-%{_libver}
Summary:	Bacula catalog library
Group:		Productivity/Archiving/Backup

%description -n libbaccats-%{_libver}

%package -n libbac-%{_libver}
Summary:	Bacula library
Group:		Productivity/Archiving/Backup

%description -n libbac-%{_libver}

%package -n libbaccfg-%{_libver}
Summary:	Bacula config library
Group:		Productivity/Archiving/Backup

%description -n libbaccfg-%{_libver}

%package -n libbacfind-%{_libver}
Summary:	Bacula find library
Group:		Productivity/Archiving/Backup

%description -n libbacfind-%{_libver}

%package -n libbacpy-%{_libver}
Summary:	Bacula python library
Group:		Productivity/Archiving/Backup

%description -n libbacpy-%{_libver}

%package -n libbacsql-%{_libver}
Summary:	Bacula sql library
Group:		Productivity/Archiving/Backup

%description -n libbacsql-%{_libver}

%package -n nagios-plugins-bacula
Summary:	Bacula nagios plugins
Group:		Productivity/Archiving/Backup

%description -n nagios-plugins-bacula
Nagios/Icinga plugins to check bacula.

%prep
%setup -q -n %{name}-%{pkgversion}
%patch1
%patch3

%build
touch platforms/suse/bacula.spec.in
CFLAGS="-fno-strict-aliasing $RPM_OPT_FLAGS $(ncurses5-config --cflags)"  LDFLAGS="-L/usr/%{_lib}/mysql $(ncurses5-config --libs)" ./configure \
 	--prefix=%{_prefix} \
	--libexecdir=%{_libdir} \
        --sbindir=%{_sbindir} \
        --bindir=%{_bindir} \
        --libdir=%{_libdir} \
        --infodir=%{_infodir} \
        --mandir=%{_mandir} \
	--sysconfdir=%{_sysconfdir}/bacula \
	--with-working-dir=/var/lib/bacula/working \
	--with-openssl \
	--with-tcp-wrappers \
	--enable-readline \
	--with-readline=%{_prefix} \
	--enable-shared \
	--with-mysql --with-postgresql
	"$@"

%{__make}

%install
%__make DESTDIR=$RPM_BUILD_ROOT install

# build nagios plugin
PREDIR=`pwd`
cd examples/nagios/check_bacula
%__make
#%__make DESTDIR=%{buildroot} install
libtool --mode=install install -D -m755 check_bacula %{buildroot}/usr/lib/nagios/plugins/check_bacula

cd $PREDIR

mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -m 755 %SOURCE10 $RPM_BUILD_ROOT/etc/init.d/bacula-dir
install -m 755 %SOURCE11 $RPM_BUILD_ROOT/etc/init.d/bacula-fd
install -m 755 %SOURCE12 $RPM_BUILD_ROOT/etc/init.d/bacula-sd
ln -sf ../../etc/init.d/bacula-fd       $RPM_BUILD_ROOT/%{_sbindir}/rcbacula-fd
ln -sf ../../etc/init.d/bacula-sd       $RPM_BUILD_ROOT/%{_sbindir}/rcbacula-sd
ln -sf ../../etc/init.d/bacula-dir      $RPM_BUILD_ROOT/%{_sbindir}/rcbacula-dir
# remove /etc/bacula/startmysql
# and /etc/bacula/stopmysql
# as they are not needed (bug #145310)
rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql $RPM_BUILD_ROOT/etc/bacula/stopmysql
rm -f $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-dir $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-fd $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-sd
# remove .old / .new files from duplicate build
rm -f $RPM_BUILD_ROOT/etc/bacula/*.new
rm -f $RPM_BUILD_ROOT/etc/bacula/*.old

# install nagios plugins#
install -m755 examples/nagios/check_bacula_pools.sh %{buildroot}/usr/lib/nagios/plugins/check_bacula_pools

#install fw definitions
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}/
install -m 644 %SOURCE20 $RPM_BUILD_ROOT/%{_fwdefdir}/bacula-dir
install -m 644 %SOURCE21 $RPM_BUILD_ROOT/%{_fwdefdir}/bacula-fd
install -m 644 %SOURCE22 $RPM_BUILD_ROOT/%{_fwdefdir}/bacula-sd
# delete docs
rm -rf %{buildroot}/usr/share/doc/bacula 
chmod 755 %{buildroot}%{_libdir}/libbac*so*

# fix baccats link 
rm -f %{buildroot}%{_libdir}/libbaccats.so
rm -f %{buildroot}%{_libdir}/libbaccats-%{_sover}.so

%clean
rm -rf $RPM_BUILD_ROOT

%preun
%if 0%{?suse_version}
%stop_on_removal bacula-fd
%else
/sbin/service bacula-fd stop || :
%endif

%postun
%if 0%{?suse_version}
%restart_on_update bacula-fd
%insserv_cleanup
%else
/sbin/service bacula-fd restart || :
%endif

%preun server
%if 0%{?suse_version}
%stop_on_removal bacula-dir bacula-sd
%else
/sbin/service bacula-dir stop || :
/sbin/service bacula-sd stop || :
%endif

%postun server
%if 0%{?suse_version}
%restart_on_update bacula-dir bacula-sd
%insserv_cleanup
%else
/sbin/service bacula-dir restart || :
/sbin/service bacula-sd restart || :
%endif

%files
%defattr(-,root,root)   
%config /etc/init.d/bacula-fd
%doc ABOUT-NLS COPYING INSTALL LICENSE README VERIFYING ReleaseNotes projects technotes ChangeLog
%{_sbindir}/bacula-fd
%{_sbindir}/bconsole
%{_sbindir}/btraceback
%{_sbindir}/rcbacula-fd
%config(noreplace) /etc/bacula/bacula-fd.conf
%config /etc/bacula/bconsole
%config(noreplace) /etc/bacula/bconsole.conf
%config /etc/bacula/btraceback.dbx
%config /etc/bacula/btraceback.gdb
%config /etc/bacula/btraceback.mdb
%config /etc/bacula/mtx-changer
%config /etc/bacula/bacula
%config /etc/bacula/dvd-handler
%config /etc/bacula/disk-changer
%dir /etc/bacula
%dir /var/lib/bacula
%dir /var/lib/bacula/working
%config %{_fwdefdir}/bacula-fd
%doc %{_mandir}/man?/*
%{_libdir}/bpipe-fd.so

%files server
%defattr(-,root,root)
%config /etc/init.d/bacula-sd
%config /etc/init.d/bacula-dir
%{_sbindir}/rcbacula-sd
%{_sbindir}/rcbacula-dir
%{_sbindir}/bacula
%{_sbindir}/bextract
%{_sbindir}/bls
%{_sbindir}/bregex
%{_sbindir}/bsmtp
%{_sbindir}/btape
%{_sbindir}/bwild
%{_sbindir}/dbcheck
%{_sbindir}/bcopy
%{_sbindir}/bacula-sd
%{_sbindir}/bacula-dir
%{_sbindir}/bscan
%exclude %{_sbindir}/bacula-fd
%exclude %{_sbindir}/rcbacula-fd
%config(noreplace) /etc/bacula/bacula-dir.conf
%config(noreplace) /etc/bacula/bacula-sd.conf
%config(noreplace) /etc/bacula/mtx-changer.conf
%config /etc/bacula/bacula_config
%config /etc/bacula/create*
%config /etc/bacula/delete*
%config /etc/bacula/drop*
%config /etc/bacula/grant*
%config /etc/bacula/make*
%config /etc/bacula/update*
%config /etc/bacula/query.sql
%config %{_fwdefdir}/bacula-dir
%config %{_fwdefdir}/bacula-sd
%dir /etc/bacula
%dir /var/lib/bacula
%dir /var/lib/bacula/working

%files -n libbaccats-%{_libver}
%defattr(-,root,root)
%{_libdir}/libbaccats-mysql-%{_sover}.so
%{_libdir}/libbaccats-postgresql-%{_sover}.so

%files -n libbaccfg-%{_libver}
%defattr(-,root,root)
%{_libdir}/libbaccfg-%{_sover}.so

%files -n libbacfind-%{_libver}
%defattr(-,root,root)
%{_libdir}/libbacfind-%{_sover}.so

%files -n libbacpy-%{_libver}
%defattr(-,root,root)
%{_libdir}/libbacpy-%{_sover}.so

%files -n libbacsql-%{_libver}
%defattr(-,root,root)
%{_libdir}/libbacsql-%{_sover}.so

%files -n libbac-%{_libver}
%defattr(-,root,root)
%{_libdir}/libbac-%{_sover}.so

%files devel
%defattr(-,root,root)
%{_libdir}/libbaccats-mysql.so
%{_libdir}/libbaccats-postgresql.so
%{_libdir}/libbaccfg.so
%{_libdir}/libbacfind.so
%{_libdir}/libbacpy.so
%{_libdir}/libbacsql.so
%{_libdir}/libbac.so
%{_libdir}/libbac*.la

%files -n nagios-plugins-bacula
%defattr(-,root,root)
%dir /usr/lib/nagios
%dir /usr/lib/nagios/plugins
/usr/lib/nagios/plugins/check_bacula
/usr/lib/nagios/plugins/check_bacula_pools

%post -n libbaccats-%{_libver} -p /sbin/ldconfig

%post -n libbaccfg-%{_libver} -p /sbin/ldconfig

%post -n libbacfind-%{_libver} -p /sbin/ldconfig

%post -n libbacpy-%{_libver} -p /sbin/ldconfig

%post -n libbacsql-%{_libver} -p /sbin/ldconfig

%post -n libbac-%{_libver} -p /sbin/ldconfig


%postun -n libbaccats-%{_libver} -p /sbin/ldconfig

%postun -n libbaccfg-%{_libver} -p /sbin/ldconfig

%postun -n libbacfind-%{_libver} -p /sbin/ldconfig

%postun -n libbacpy-%{_libver} -p /sbin/ldconfig

%postun -n libbacsql-%{_libver} -p /sbin/ldconfig

%postun -n libbac-%{_libver} -p /sbin/ldconfig



%changelog
openSUSE Build Service is sponsored by