File rsync.spec of Package rsync.import4292

#
# spec file for package rsync
#
# 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/
#

# norootforbuild

%define with_system_zlib 0

Name:           rsync
Summary:        Replacement for RCP/mirror that has Many More Features
Version:        3.0.7
Release:        8.<RELEASE9>
License:        GPLv3+
Group:          Productivity/Networking/Other
AutoReqProv:    on
Url:            http://rsync.samba.org/
Source:         %{name}-%{version}.tar.bz2
Source1:        %{name}-patches-%{version}.tar.bz2
Source2:        logrotate.rsync
Source3:        rsync.xinetd
Source4:        rsyncd.rc
Source5:        rsyncd.conf
Source6:        rsyncd.secrets
Source7:        rsync-server.firewall
Patch3:         system-zlib.diff
#PATCH-FIX-UPSTREAM rsync-3.0.5-doc-fix.patch bnc487591 petr.uzel@suse.cz -- based on upstream changes to rsync.yo
Patch4:         rsync-3.0.5-doc-fix.patch
Patch5:         rsync-CVE-2011-1097.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %fillup_prereq %insserv_prereq sed grep
BuildRequires:  libacl-devel libpng openslp-devel
BuildRequires:  popt-devel zlib-devel
%if 0%{?suse_version} > 1020
BuildRequires:  texlive-latex
%else
BuildRequires:  te_ams te_latex
%endif
Recommends:     logrotate

%description
rsync uses the "rsync algorithm" which provides a very fast method for
bringing remote files into sync. It does this by sending just the
differences in the files across the link, without requiring that both
sets of files be present at one of the ends of the link beforehand. At
first glance, this may seem impossible because the calculation of diffs
between two files normally requires local access to both files.

A technical report describing the rsync algorithm is included with this
package.



Authors:
--------
    Andrew Tridgell <tridge@samba.org>
    Paul Mackerras <Paul.Mackerras@cs.anu.edu.au>

%prep
%setup -q -b 1 -n %{name}-%{version}
%if %with_system_zlib
rm -f zlib/*.h
%patch3
%endif
patch -p1 < patches/acls.diff
patch -p1 < patches/xattrs.diff
patch -p1 < patches/slp.diff
%patch4 -p1
%patch5 -p1

%build
autoheader
autoconf
%configure \
  --disable-debug \
  --enable-slp \
  --enable-acl-support \
  --enable-xattr-support
make %{?jobs:-j %jobs}
latex tech_report
latex tech_report
dvips tech_report -o tech_report.ps

%install
%makeinstall
rm -f $RPM_BUILD_ROOT/usr/sbin/rsyncd
install -d $RPM_BUILD_ROOT/etc/logrotate.d
install -d $RPM_BUILD_ROOT/etc/init.d
install -d $RPM_BUILD_ROOT/etc/xinetd.d
install -d $RPM_BUILD_ROOT/usr/sbin
ln -sf ../bin/rsync $RPM_BUILD_ROOT/usr/sbin/rsyncd
install -m 755 support/rsyncstats   $RPM_BUILD_ROOT/usr/bin
install -m 644 %{SOURCE2}     $RPM_BUILD_ROOT/etc/logrotate.d/rsync
install -m 644 %{SOURCE3}     $RPM_BUILD_ROOT/etc/xinetd.d/rsync
install -m 755 %{SOURCE4}     $RPM_BUILD_ROOT/etc/init.d/rsyncd
install -m 644 %{SOURCE5}     $RPM_BUILD_ROOT/etc/rsyncd.conf
install -m 600 %{SOURCE6}     $RPM_BUILD_ROOT/etc/rsyncd.secrets
ln -sf ../../etc/init.d/rsyncd                $RPM_BUILD_ROOT/usr/sbin/rcrsyncd
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
install -m 644 %{S:7} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/rsync-server

%preun
%stop_on_removal rsyncd

%post
%fillup_and_insserv rsyncd
if ! grep -q "^pid file" /etc/rsyncd.conf ; then
   sed -i -e "/^log file/{;p;s@\(.*\)@pid file = /var/run/rsyncd.pid@;}" /etc/rsyncd.conf
fi

%postun
%restart_on_update rsyncd
%insserv_cleanup

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,root)
%config(noreplace) /etc/rsyncd.conf
%config(noreplace) /etc/rsyncd.secrets
%config(noreplace) /etc/logrotate.d/rsync
%config(noreplace) /etc/xinetd.d/rsync
%config /etc/init.d/rsyncd
%{_sbindir}/rcrsyncd
%{_sbindir}/rsyncd
%{_bindir}/rsyncstats
%{_bindir}/rsync
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/*
%doc %{_mandir}/man1/rsync.1.gz
%doc %{_mandir}/man5/rsyncd.conf.5.gz
%doc COPYING NEWS README tech_report.ps tech_report.tex

%changelog