%bcond_with systemd

Summary:     A program for synchronizing files over a network.
Summary(ja): ネットワーク越しにファイルを同期させるプログラム
Name: rsync
Version: 3.2.3
Release: 2%{_dist_release}%{?with_systemd:.systemd}
Group: network
Vendor: Project Vine
Distribution: Vine Linux
Packager: daisuke

License: GPLv3+
URL: https://rsync.samba.org/
Source:	https://download.samba.org/pub/rsync/src/rsync-%{version}.tar.gz
Source1: https://download.samba.org/pub/rsync/src/rsync-patches-%{version}.tar.gz
Source2: rsyncd.socket
Source3: rsyncd.service
Source4: rsyncd.conf
Source5: rsyncd.sysconfig
Source6: rsyncd@.service
Source100: rsync.xinetd

#Added temporarily until new rebase
Patch0: rsync-3.2.2-ssl-verify-hostname.patch
#Added due to rhbz#1873975 - default-acls test fail on s390x due to libacl
Patch1: rsync-3.2.2-runtests.patch

# security fixes
# none

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libacl-devel libattr-devel popt-devel
BuildRequires: lz4-devel openssl-devel libzstd-devel
BuildRequires: acl attr

%description
Rsync uses a quick and reliable algorithm to very quickly bring
remote and host files into sync.  Rsync is fast because it just
sends the differences in the files over the network (instead of
sending the complete files). Rsync is often used as a very powerful
mirroring process or just as a more capable replacement for the
rcp command.  A technical report which describes the rsync algorithm
is included in this package.

Install rsync if you need a powerful mirroring program.

%description -l ja
rsync は高速で信頼性の高いアルゴリズムを使い，遠隔ホスト上のファイルと
高速に同期させることが出来ます．rsync が高速に動作するのは，ネットワーク
上に流れるデータがファイルの差分だけだからです (ファイル全体をやりとり
するのではなく)．rsync は強力なミラリングツールとしても，rcp コマンドの
代替としても使うことが出来ます．rsync のアルゴリズムに関する技術情報は
このパッケージに同梱されています．

強力なミラープログラムが必要ならば rsync をインストールして下さい．


%package daemon
Summary: Service for anonymous access to rsync
Group: servers
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%if %{with systemd}
%{?systemd_requires}
%else
Requires: xinetd
%endif
%description daemon
Rsync can be used to offer read only access to anonymous clients. This
package provides the anonymous rsync service.


%debug_package


%prep
%setup -q -b 1

#Enable --copy-devices parameter
patch -p1 -i patches/copy-devices.diff

%patch0 -p1 -b .verify-hostname
%patch1 -p1 -b .runtests

# security fixes
# none

%build
%configure --disable-xxhash
make %{?_smp_mflags} CCOPTFLAGS="$RPM_OPT_FLAGS"


%install
rm -rf $RPM_BUILD_ROOT
%makeinstall

install -D -m644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/rsyncd.conf
%if %{with systemd}
install -D -m644 %{SOURCE3} $RPM_BUILD_ROOT/%{_unitdir}/rsyncd.service
install -D -m644 %{SOURCE2} $RPM_BUILD_ROOT/%{_unitdir}/rsyncd.socket
install -D -m644 %{SOURCE6} $RPM_BUILD_ROOT/%{_unitdir}/rsyncd@.service
install -D -m644 %{SOURCE5} $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/rsyncd
%else
mkdir -p $RPM_BUILD_ROOT/etc/xinetd.d
install -m 644 %{SOURCE100} $RPM_BUILD_ROOT/etc/xinetd.d/rsync
%endif


%check
make check
chmod -x support/*


%clean
rm -rf $RPM_BUILD_ROOT


%if %{with systemd}
%post daemon
%systemd_post rsyncd.service

%preun daemon
%systemd_preun rsyncd.service

%postun daemon
%systemd_postun_with_restart rsyncd.service
%endif


%files
%defattr(-,root,root)
%license COPYING
%doc README* tech_report.tex support/
%doc NEWS* TODO
%{_bindir}/%{name}
%{_bindir}/%{name}-ssl
%config(noreplace) %{_sysconfdir}/rsyncd.conf
%{_mandir}/man1/%{name}.1*
%{_mandir}/man1/%{name}-ssl.1*
%{_mandir}/man5/rsyncd.conf.5*

%files daemon
%if %{with systemd}
%{_unitdir}/rsyncd.socket
%{_unitdir}/rsyncd.service
%{_unitdir}/rsyncd@.service
%config(noreplace) %{_sysconfdir}/sysconfig/rsyncd
%else
%config(noreplace) /etc/xinetd.d/rsync
%endif


%changelog
* Mon Oct 04 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.2.3-2
- rebuilt with openssl-3.0.0.

* Fri Sep 04 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.2.3-1
- updated to 3.2.3.
- re-impoerted all patches from rawhide.
- added systemd support (disabled as default).

* Wed Oct 16 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.1.3-1
- updated to 3.1.2.
- imported Patch1-3 from rawhide.
- dropped Patch100-130.

* Sat Jan 13 2018 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 3.1.2-1
- update to 3.1.2
- add patch100-130 to fix security issue from debian
- use make reconfigure in build section

* Sat Nov 14 2015 Toshiharu Kudoh <toshi.kd2@gmail.com> 3.1.1-2
- added Patch100 to fix CVE-2014-9512

* Fri Nov 07 2014 Toshiharu Kudoh <toshi.kd2@gmail.com> 3.1.1-1
- new upstream release
- deleted Patch100 to merge source

* Wed Jun 11 2014 Daisuke SUZUKI <daisuke@vinelinux.org> 3.1.0-2
- add Patch100 to fix CVE-2014-2855

* Sat Nov 23 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> 3.1.0-1
- new upstream release

* Fri Jan 20 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> 3.0.9-1
- new upstream release

* Sun May 22 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 3.0.8-1
- new upstream release with security fixes
- drop patch100 (is included in new release) 

* Sat Apr  2 2011 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 3.0.7-2
- add Patch100 for fix CVE-2011-1097 (filelist)
- change specfile name (-vl)

* Sat Jan 2 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> 3.0.7-1
- new upstream release

* Thu Oct 8 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 3.0.6-1
- new upstream release
- changed License tag
- added Patch0 from Debian
- added BuildRequires: libattr-devel popt-devel
- added patch -p1 -i patches/copy-devices.diff in %setup
  (to enable --copy-devices parameter)

* Sun Sep 27 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 3.0.4-2
- added BuildRequires: libacl-devel (to enable ACL)

* Tue Sep 09 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 3.0.4-1
- new upstream release
- add rsync-patches (replaces patch1,2)
  use xattr.patch and acls.patch for backword compatibility

* Sun Apr 13 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 3.0.2-1
- new upstream release
- add patch1,2 for backward compatibility from fc
- new versioning policy

* Tue Aug 21 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.6.9-0vl2
- add Patch10 for CVE-2007-4091
  (rsync "f_name()" Function Directory Name Handling Off-By-One Vulnerability)

* Wed Jan 10 2007 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.6.9-0vl1
- new upstream release
- add Vendor/Distribution tag

* Mon Mar 28 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.4-0vl1
- new upstream release

* Sat Oct 30 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.3-0vl1
- new upstream release
- drop obsolete patch1 which is merged in upstream.

* Tue Aug 17 2004 SATO Masakiyo <info@pocomoco.net> 2.6.2-0vl2
- added patch1 for a path-sanitizing bug

* Wed May  5 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.2-0vl1
- new upstream release

* Fri Apr 30 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.1-0vl1
- new upstream release

* Fri Dec 05 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 2.5.7-0vl1
- new upstream release
- security fix

* Mon Apr 21 2003 IWAI Masaharu <iwai@alib.jp> 2.5.6-0vl1
- new upstream release

* Sun Sep 29 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 2.5.5-0vl1
- new upstream release

* Wed Mar 13 2002 Toru Sagami <sagami@vinelinux.org> 2.5.4-0vl1
- updated to 2.5.4, which contains additional fix for zlib double-free bug.

* Tue Mar 12 2002 IWAI Masaharu <iwaim@cc.mbn.or.jp> 2.5.3-0vl1
- upstream release

* Sat Jan 26 2002 Toru Sagami <sagami@vinelinux.org> 2.5.2-0vl1
- SECURITY FIXES: 
    * Signedness security patch from Sebastian Krahmer
- added more docs

* Sun Jan 06 2002 Toru Sagami <sagami@vinelinux.org>
- 2.5.1-0vl1

* Sun Dec  2 2001 Yoichi Imai <yoichi@silver-forest.com>
- 2.5.0-0vl1
- update to 2.5.0
- edit maxdel.patch for 2.5.0

* Tue Jan 09 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 2.4.6-2vl1
- based on 2.4.6-2 from Rawhide
- added Japanese summary and description

* Sat Sep 30 2000 Florian La Roche <Florian.LaRoche@redhat.de>
- add xinetd configuration

* Tue Sep 26 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.4.6

* Mon Jul 31 2000 Bill Nottingham <notting@redhat.com>
- update to 2.4.4 - fixes yet another problem with rsh transport

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Sat Jun 10 2000 Bill Nottingham <notting@redhat.com>
- rebuild in new build env.

* Mon Apr 10 2000 Bill Nottingham <notting@redhat.com>
- update to 2.4.3

* Tue Apr  4 2000 Bill Nottingham <notting@redhat.com>
- update to 2.4.2

* Tue Mar  7 2000 Bill Nottingham <notting@redhat.com>
- fix maxdelete behavior so it isn't sent to older servers.

* Mon Jan 31 2000 Jeff Johnson <jbj@redhat.com>
- update to 2.4.1.

* Fri Dec 17 1999 Bill Nottingham <notting@redhat.com>
- update to 2.3.2

* Sat Jun 12 1999 Jeff Johnson <jbj@redhat.com>
- add "max. delete" patch to limit damage when server is hosed.

* Wed Apr 07 1999 Bill Nottingham <notting@redhat.com>
- update to 2.3.1.

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 2)

* Tue Mar 16 1999 Jeff Johnson <jbj@redhat.com>
- update to 2.3.0.

* Sat Mar 13 1999 Jeff Johnson <jbj@redhat.com>
- update to 2.3.0 beta.

* Fri Dec 18 1998 Bill Nottingham <notting@redhat.com>
- update to 2.2.1

* Thu Sep 10 1998 Jeff Johnson <jbj@redhat.com>
- updated to 2.1.1

* Mon Aug 17 1998 Erik Troan <ewt@redhat.com>
- updated to 2.1.0

* Thu Aug 06 1998 Erik Troan <ewt@redhat.com>
- buildrooted and attr-rophied
- removed tech-report.ps; the .tex should be good enough

* Mon Aug 25 1997 John A. Martin <jam@jamux.com>
- Built 1.6.3-2 after finding no rsync-1.6.3-1.src.rpm although there
  was an ftp://ftp.redhat.com/pub/contrib/alpha/rsync-1.6.3-1.alpha.rpm
  showing no packager nor signature but giving 
  "Source RPM: rsync-1.6.3-1.src.rpm".
- Changes from 1.6.2-1 packaging: added '$RPM_OPT_FLAGS' to make, strip
  to '%build', removed '%prefix'.

* Thu Apr 10 1997 Michael De La Rue <miked@ed.ac.uk>
- rsync-1.6.2-1 packaged.  (This entry by jam to credit Michael for the
  previous package(s).)
