From 3bfee3e3eb72e0d112fd34fdefae91b33e331a33 Mon Sep 17 00:00:00 2001 From: Michal Luscon <mluscon@redhat.com> Date: Fri, 30 Nov 2012 16:54:34 +0100 Subject: [PATCH] Fixed: #737710 - provide native systemd services --- rsync.spec | 36 ++++++++++++++++++++++++++++++------ rsync.xinetd | 14 -------------- rsyncd.conf | 20 ++++++++++++++++++++ rsyncd.service | 9 +++++++++ rsyncd.socket | 10 ++++++++++ rsyncd.sysconfig | 1 + 6 files changed, 70 insertions(+), 20 deletions(-) delete mode 100644 rsync.xinetd create mode 100644 rsyncd.conf create mode 100644 rsyncd.service create mode 100644 rsyncd.socket create mode 100644 rsyncd.sysconfig diff --git a/rsync.spec b/rsync.spec index 22b721f..8006960 100644 --- a/rsync.spec +++ b/rsync.spec @@ -7,15 +7,21 @@ Summary: A program for synchronizing files over a network Name: rsync Version: 3.0.9 -Release: 5%{?prerelease}%{?dist} +Release: 6%{?prerelease}%{?dist} Group: Applications/Internet URL: http://rsync.samba.org/ Source0: ftp://rsync.samba.org/pub/rsync/rsync-%{version}%{?prerelease}.tar.gz Source1: ftp://rsync.samba.org/pub/rsync/rsync-patches-%{version}%{?prerelease}.tar.gz -Source2: rsync.xinetd +Source2: rsyncd.socket +Source3: rsyncd.service +Source4: rsyncd.conf +Source5: rsyncd.sysconfig BuildRequires: libacl-devel, libattr-devel, autoconf, popt-devel, zlib-devel Requires: zlib +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units License: GPLv3+ Patch0: rsync-3.0.10-lose-track.patch @@ -56,7 +62,7 @@ rm -fr autom4te.cache autoconf -o configure.sh autoheader && touch config.h.in -%configure +%configure make proto make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" @@ -65,8 +71,11 @@ make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" rm -rf $RPM_BUILD_ROOT %makeinstall INSTALLCMD='install -p' INSTALLMAN='install -p' -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d -install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/%{name} + +install -D -m644 %{SOURCE3} $RPM_BUILD_ROOT/%{_unitdir}/rsyncd.service +install -D -m644 %{SOURCE2} $RPM_BUILD_ROOT/%{_unitdir}/rsyncd.socket +install -D -m644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/rsyncd.conf +install -D -m644 %{SOURCE5} $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/rsyncd %clean rm -rf $RPM_BUILD_ROOT @@ -74,12 +83,27 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc COPYING NEWS OLDNEWS README support/ tech_report.tex -%config(noreplace) %{_sysconfdir}/xinetd.d/%{name} %{_bindir}/%{name} %{_mandir}/man1/%{name}.1* %{_mandir}/man5/rsyncd.conf.5* +%config(noreplace) %{_sysconfdir}/rsyncd.conf +%config(noreplace) %{_sysconfdir}/sysconfig/rsyncd +%{_unitdir}/rsyncd.socket +%{_unitdir}/rsyncd.service + +%post +%systemd_post rsyncd.service + +%preun +%systemd_preun rsyncd.service + +%postun +%systemd_postun_with_restart rsyncd.service %changelog +* Thu Nov 15 2012 Michal Luscon <mluscon@redhat.com> 3.0.9-6 +- Systemd units for rsync + * Tue Oct 23 2012 Michal Luscon <mluscon@redhat.com> 3.0.9-5 - Reverted: #495310 - rsync contains forked copy of zlib diff --git a/rsync.xinetd b/rsync.xinetd deleted file mode 100644 index d4b591e..0000000 --- a/rsync.xinetd +++ /dev/null @@ -1,14 +0,0 @@ -# default: off -# description: The rsync server is a good addition to an ftp server, as it \ -# allows crc checksumming etc. -service rsync -{ - disable = yes - flags = IPv6 - socket_type = stream - wait = no - user = root - server = /usr/bin/rsync - server_args = --daemon - log_on_failure += USERID -} diff --git a/rsyncd.conf b/rsyncd.conf new file mode 100644 index 0000000..19e99a6 --- /dev/null +++ b/rsyncd.conf @@ -0,0 +1,20 @@ +# /etc/rsyncd: configuration file for rsync daemon mode + +# See rsyncd.conf man page for more options. + +# configuration examlple: + +# uid = nobody +# gid = nobody +# use chroot = yes +# max connections = 4 +# pid file = /var/run/rsyncd.pid +# exclude = lost+found/ +# transfer logging = yes +# timeout = 900 +# ignore nonreadable = yes +# dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2 + +# [ftp] +# path = /home/ftp +# comment = ftp export area diff --git a/rsyncd.service b/rsyncd.service new file mode 100644 index 0000000..811063c --- /dev/null +++ b/rsyncd.service @@ -0,0 +1,9 @@ +[Unit] +Description=fast remote file copy program daemon +ConditionPathExists=/etc/rsyncd.conf + +[Service] +ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS" + +[Install] +WantedBy=multi-user.target diff --git a/rsyncd.socket b/rsyncd.socket new file mode 100644 index 0000000..7306ad0 --- /dev/null +++ b/rsyncd.socket @@ -0,0 +1,10 @@ +[Unit] +Description=Rsync Server Socket +Conflicts=rsyncd.service + +[Socket] +ListenStream=873 +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/rsyncd.sysconfig b/rsyncd.sysconfig new file mode 100644 index 0000000..90a5a43 --- /dev/null +++ b/rsyncd.sysconfig @@ -0,0 +1 @@ +OPTIONS=""