File amanda.spec of Package amanda.549

#
# spec file for package amanda
#
# Copyright (c) 2011 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/
#


%if 0%{?suse_version} <= 1110
    %define amanda_group disk
%else
    %define amanda_group amanda
%endif

Name:           amanda
BuildRequires:  dump glib2-devel gnuplot krb5-devel perl-base popt-devel samba-client sendmail
BuildRequires:  cups-libs gawk libsmbclient libsmbclient-devel libxslt mailx mtx openssh readline-devel
%define package_version 2.6.1p1  
Version:        2.6.1.1
Release:        11
PreReq:         pwdutils permissions
Requires:       dump /usr/bin/smbclient
Requires:       perl = %{perl_version}
AutoReqProv:    on
Group:          Productivity/Archiving/Backup
License:        GPLv2+ ; MIT License (or similar)
Url:            http://www.amanda.org/
Summary:        Network Disk Archiver
Source:         %{name}-%{package_version}.tar.bz2
#amanda-SuSE.tar.bz2 contain init scripts, config examples
Source1:        %{name}-SuSE.tar.bz2
Source2:        amanda-howto-collection.pdf.tar.bz2
Patch1:         %{name}-%{package_version}-pie.patch
Patch3:         %{name}-%{package_version}-shellbang.patch
Patch4:         %{name}-%{package_version}-return_val.patch
Patch5:         %{name}-%{package_version}-newer_glib.patch
Patch6:         %{name}-permission.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This is a release of Amanda, the Advanced Maryland Automatic Network
Disk Archiver.	Amanda is a backup system designed to archive many
computers on a network to a single large-capacity tape drive.



Authors:
--------
    James da Silva <jds@cs.umd.edu>
    Mike Grupenhoff <kashmir@munge.com>
    Todd Kover <kovert@uu.net>
    James Mathiesen <James-Mathiesen@deshaw.com>
    Alan McIvor <a.mcivor@irl.cri.nz>
    George Scott <George.Scott@cc.monash.edu.au>
    Alexandre Oliva <oliva@dcc.unicamp.br>
    Blair Zajac <blair@gps.caltech.edu>
    Curtis Varner <cvarner@cs.ucr.edu>
    John R. Jackson <jrj@gandalf.cc.purdue.edu>
    Jean-Louis Martineau <martinea@iro.umontreal.edu>

%prep
%setup -q -a 1 -a 2 -n %{name}-%{package_version}
%patch1 -p1
%patch3
%patch4
%patch5
%patch6 -p1

%build
./autogen
CFLAGS="$RPM_OPT_FLAGS -U BUILD_DATE -U BUILD_MACH -fno-strict-aliasing -fPIC" CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC" \
	./configure --mandir=%{_mandir} \
          --with-bsdtcp-security \
          --with-bsdudp-security \
          --prefix=%{_prefix} \
          --infodir=%{_infodir} \
          --sysconfdir=%{_sysconfdir} \
          --libdir=%{_libdir} \
          --libexecdir=/usr/lib \
          --localstatedir=/var/lib \
          --with-index-server=localhost \
          --with-gnutar-listdir=/var/lib/amanda/gnutar-lists \
          --with-smbclient=%{_prefix}/bin/smbclient \
          --with-amperldir=%{perl_vendorlib} \
          --with-user=amanda \
          --with-group=%{amanda_group} \
          --with-gnutar=/bin/tar \
          --disable-libtool \
          --with-amandahosts \
          --disable-installperms
make

%install
make DESTDIR=$RPM_BUILD_ROOT/ install
install -d $RPM_BUILD_ROOT/%{_sysconfdir}/amanda \
           $RPM_BUILD_ROOT/var/lib/amanda/index \
           $RPM_BUILD_ROOT/var/lib/amanda/gnutar-lists \
           $RPM_BUILD_ROOT/var/lib/amanda/disklist \
           $RPM_BUILD_ROOT/var/lib/amanda/DailySet1 \
           $RPM_BUILD_ROOT/var/lib/amanda/lbl-templ \
           $RPM_BUILD_ROOT/%{_docdir}/%{name} \
           $RPM_BUILD_ROOT/%{_sysconfdir}/xinetd.d
install NEWS README README.SuSE example/{amanda.conf,chg-multi.conf,disklist} $RPM_BUILD_ROOT/%{_docdir}/%{name}
chmod 644 $RPM_BUILD_ROOT/%{_docdir}/%{name}/* \
          $RPM_BUILD_ROOT/%{_mandir}/*/*
cp -a SuSE/* $RPM_BUILD_ROOT
#we must change group name for amanada user in xinit'd scripts for 11.1 and lower
%if 0%{?suse_version} <= 1110
    %__sed -i 's|amanda|disk|' $RPM_BUILD_ROOT/etc/xinetd.d/am*
%endif
# pdf doc
cp amanda-howto-collection.pdf $RPM_BUILD_ROOT/%{_docdir}/%{name}/
# label templates
cp -a example/*.ps $RPM_BUILD_ROOT/var/lib/amanda/lbl-templ
# contain docs,examples which are already included
rm -rf $RPM_BUILD_ROOT/usr/share/amanda
# bnc#412636
touch $RPM_BUILD_ROOT//usr/lib/amanda/exclude.gtar
# create a list of binaries to be checked externally
cat << EOF > $RPM_BUILD_ROOT/usr/lib/amanda/suidlist
/usr/sbin/amcheck
/usr/lib/amanda/calcsize
/usr/lib/amanda/rundump
/usr/lib/amanda/planner
/usr/lib/amanda/runtar
/usr/lib/amanda/dumper
/usr/lib/amanda/killpgrp
EOF

%pre
# since 11.2 we use group "tape" instead of "disk" for tape devices /dev/nst*, so we must check group for "amanda" user
%if 0%{?suse_version} > 1110
#create primary group for amanda user
    /usr/sbin/groupadd -r amanda 2>/dev/null || :
#if user already exists and has effective group "disk" we have to change this group to "amanda" group and also add supplementary "tape" group see bnc#523006
    /usr/bin/id -n -g amanda 2>&1 | grep "disk" >/dev/null && /usr/sbin/usermod -g amanda -G tape amanda  /usr/sbin/usermod -g amanda amanda 2>&1
#this is ugly but just simple add user with "tape" and "amanda" groups regardless of existing user
    /usr/sbin/useradd -r -o -g amanda -G tape -u 37 -s /bin/bash -c "Amanda admin" -d /var/lib/amanda amanda >/dev/null 2>&1 || :
# in <= 11.1 use old disk group for amanda user
%else
    /usr/sbin/useradd -r -o -g disk -u 37 -s /bin/bash -c "Amanda admin" -d /var/lib/amanda amanda >/dev/null 2>&1 || :
%endif

%post
%run_permissions
%verifyscript
%verify_permissions -f /usr/lib/amanda/suidlist

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc amanda-howto-collection.pdf ChangeLog NEWS AUTHORS COPYRIGHT README ReleaseNotes
%doc %{_mandir}/man*/*
%config /usr/lib/amanda/exclude.gtar
%attr(755,root,root) %dir /usr/lib/amanda
%attr(664,amanda,%{amanda_group}) %config(noreplace) %{_sysconfdir}/dumpdates
%attr(664,amanda,%{amanda_group}) %config(noreplace) %{_sysconfdir}/amandates
%attr(755,amanda,%{amanda_group}) %dir %{_sysconfdir}/amanda
%attr(755,amanda,%{amanda_group}) %dir %{_sysconfdir}/amanda/example
%attr(755,amanda,%{amanda_group}) %dir /var/lib/amanda/
%attr(755,amanda,%{amanda_group}) %dir /var/lib/amanda/disklist
%attr(755,amanda,%{amanda_group}) %dir /var/lib/amanda/gnutar-lists/
%attr(755,amanda,%{amanda_group}) %dir /var/lib/amanda/index/
%attr(755,amanda,%{amanda_group}) %dir /var/lib/amanda/DailySet1
%attr(755,amanda,%{amanda_group}) %dir /var/lib/amanda/lbl-templ
%attr(644,amanda,%{amanda_group}) /var/lib/amanda/lbl-templ/*
%config %attr(644,amanda,%{amanda_group}) /var/lib/amanda/.bashrc
%config %attr(644,amanda,%{amanda_group}) /var/lib/amanda/.profile
# bnc#412636 file permissions of .amandahosts should be 600
%config %attr(600,amanda,%{amanda_group}) /var/lib/amanda/.amandahosts
%config %attr(644,amanda,%{amanda_group}) %{_sysconfdir}/amanda/example/amanda.conf
%config %attr(644,amanda,%{amanda_group}) %{_sysconfdir}/amanda/example/disklist
%config(noreplace) %{_sysconfdir}/xinetd.d/*
# perl scripts
%dir %{perl_vendorlib}/Amanda/
%dir %{perl_vendorlib}/Amanda/Application
%dir %{perl_vendorlib}/Amanda/Changer
%dir %{perl_vendorlib}/Amanda/DB
%dir %{perl_vendorlib}/auto/Amanda/
%dir %{perl_vendorlib}/auto/Amanda/Application
%dir %{perl_vendorlib}/auto/Amanda/Archive
%dir %{perl_vendorlib}/auto/Amanda/Cmdline
%dir %{perl_vendorlib}/auto/Amanda/Config
%dir %{perl_vendorlib}/auto/Amanda/Debug
%dir %{perl_vendorlib}/auto/Amanda/Device
%dir %{perl_vendorlib}/auto/Amanda/Logfile
%dir %{perl_vendorlib}/auto/Amanda/MainLoop
%dir %{perl_vendorlib}/auto/Amanda/Tapelist
%dir %{perl_vendorlib}/auto/Amanda/Tests
%dir %{perl_vendorlib}/auto/Amanda/Types
%dir %{perl_vendorlib}/auto/Amanda/Util
%dir %{perl_vendorlib}/auto/Amanda/Xfer
%{perl_vendorlib}/Amanda/*/*.pm
%{perl_vendorlib}/Amanda/*.pm
%{perl_vendorlib}/auto/Amanda/*/*.so
%defattr(755,amanda,%{amanda_group})
%{_sbindir}/amadmin
%{_sbindir}/amcheckdb
%{_sbindir}/amcleanup
%{_sbindir}/amdump
%{_sbindir}/amflush
%{_sbindir}/amgetconf
%{_sbindir}/amlabel
%{_sbindir}/amoverview
%{_sbindir}/amplot
%verify(not mode) %attr(0750,root,%{amanda_group}) %{_sbindir}/amcheck
%attr(0750,amanda,%{amanda_group}) %{_sbindir}/amrecover
%{_sbindir}/amreport
%{_sbindir}/amrestore
%{_sbindir}/amrmtape
%{_sbindir}/amstatus
%{_sbindir}/amtape
%{_sbindir}/amtapetype
%{_sbindir}/amtoc
%{_sbindir}/amcrypt-ossl
%{_sbindir}/amcrypt-ossl-asym
%{_sbindir}/amoldrecover
%{_sbindir}/amgpgcrypt
%{_sbindir}/amaespipe
%{_sbindir}/amcrypt
%{_sbindir}/amfetchdump
%{_sbindir}/amaddclient
%{_sbindir}/amarchiver
%{_sbindir}/amcheckdump
%{_sbindir}/amcryptsimple
%{_sbindir}/amdevcheck
%{_sbindir}/amserverconfig
%{_sbindir}/amservice
%{_sbindir}/amvault
%defattr(644,amanda,%{amanda_group})
/usr/lib/amanda/suidlist
/usr/lib/amanda/amcat.awk
/usr/lib/amanda/amplot.awk
/usr/lib/amanda/amplot.g
/usr/lib/amanda/amplot.gp
%defattr(755,amanda,%{amanda_group})
/usr/lib/amanda/amandad
/usr/lib/amanda/amidxtaped
/usr/lib/amanda/amindexd
/usr/lib/amanda/amtrmidx
/usr/lib/amanda/chg-mcutil
/usr/lib/amanda/chg-null
/usr/lib/amanda/chg-chio
/usr/lib/amanda/chg-chs
/usr/lib/amanda/chg-disk
/usr/lib/amanda/chg-iomega
/usr/lib/amanda/chg-juke
/usr/lib/amanda/chg-manual
/usr/lib/amanda/chg-mtx
/usr/lib/amanda/chg-multi
/usr/lib/amanda/chg-rait
/usr/lib/amanda/chg-rth
/usr/lib/amanda/chg-scsi
/usr/lib/amanda/chg-zd-mtx
/usr/lib/amanda/driver
/usr/lib/amanda/amcleanupdisk
/usr/lib/amanda/amlogroll
/usr/lib/amanda/amtrmlog
/usr/lib/amanda/patch-system
/usr/lib/amanda/selfcheck
/usr/lib/amanda/sendbackup
/usr/lib/amanda/sendsize
/usr/lib/amanda/taper
/usr/lib/amanda/versionsuffix
/usr/lib/amanda/chunker
/usr/lib/amanda/noop
/usr/lib/amanda/amanda-sh-lib.sh
/usr/lib/amanda/teecount
/usr/lib/amanda/chg-glue
/usr/lib/amanda/chg-lib.sh
%verify(not mode) %attr(0750,root,%{amanda_group})/usr/lib/amanda/calcsize
%verify(not mode) %attr(0750,root,%{amanda_group})/usr/lib/amanda/dumper
%verify(not mode) %attr(0750,root,%{amanda_group})/usr/lib/amanda/killpgrp
%verify(not mode) %attr(0750,root,%{amanda_group})/usr/lib/amanda/planner
%verify(not mode) %attr(0750,root,%{amanda_group})/usr/lib/amanda/rundump
%verify(not mode) %attr(0750,root,%{amanda_group})/usr/lib/amanda/runtar
%dir /usr/lib/amanda/application/
/usr/lib/amanda/application/*
# include shared libs
%dir %{_libdir}/amanda/
%{_libdir}/amanda/lib*
# excluding static libs
%exclude %{_libdir}/amanda/lib*.la
%exclude %{_libdir}/amanda/lib*.a
%exclude %{perl_vendorlib}/auto/Amanda/*/*.la
%exclude %{perl_vendorlib}/auto/Amanda/*/*.a

%changelog
openSUSE Build Service is sponsored by