Summary: Live Syncing (Mirror) Daemon
Name: lsyncd
Version: 1.26
Release: 4%{?dist}
License: GPLv2+
Group: Applications/Internet
URL: http://code.google.com/p/lsyncd/
Source0: http://lsyncd.googlecode.com/files/lsyncd-%{version}.tar.gz
Source1: lsyncd.init
Source2: lsyncd.sysconfig
Source3: lsyncd.logrotate
Patch0: lsyncd-1.26-in_attrib.patch
Patch1: lsyncd-1.26-man5.patch
Patch2: lsyncd-1.26-defaultconf.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: libxml2-devel
# We patch Makefile.am
BuildRequires: autoconf, automake, libtool
%description
Live Syncing (Mirror) Daemon which uses inotify and rsync to synchronize local
directories to a remote location running rsyncd.
%prep
%setup -q
%patch0 -p1 -b .in_attrib
%patch1 -p1 -b .man5
%patch2 -p1 -b .defaultconf
# We patch Makefile.am
aclocal
autoheader
autoconf
automake -a -c
%build
%configure
%{__make} %{?_smp_mflags}
%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
# Directories which we use in our init script
%{__mkdir_p} %{buildroot}%{_sysconfdir}/lsyncd
%{__mkdir_p} %{buildroot}%{_var}/log/lsyncd
%{__mkdir_p} %{buildroot}%{_var}/run/lsyncd
# Our init script
%{__install} -D -p -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/lsyncd
%{__install} -D -p -m 0644 %{SOURCE2} \
%{buildroot}%{_sysconfdir}/sysconfig/lsyncd
# Log rotate for the default log file location
%{__install} -D -p -m 0644 %{SOURCE3} \
%{buildroot}%{_sysconfdir}/logrotate.d/lsyncd
%clean
%{__rm} -rf %{buildroot}
%post
if [ $1 -eq 1 ]; then
/sbin/chkconfig --add lsyncd
fi
%preun
if [ $1 -eq 0 ]; then
/sbin/service lsyncd stop >/dev/null 2>&1 || :
/sbin/chkconfig --del lsyncd
fi
%postun
#if [ $1 -ge 1 ]; then
# It's not a good idea to restart automatically upon upgrade, let the user
# decide to do that or not (and extra instances wouldn't be restarted).
#/sbin/service lsyncd condrestart >/dev/null 2>&1 || :
#fi
%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README TODO lsyncd.conf.xml
%{_sysconfdir}/init.d/lsyncd
%config(noreplace) %{_sysconfdir}/logrotate.d/lsyncd
%dir %{_sysconfdir}/lsyncd/
%config(noreplace) %{_sysconfdir}/sysconfig/lsyncd
%{_bindir}/lsyncd
%{_mandir}/man1/lsyncd.1*
%{_mandir}/man5/lsyncd.conf.xml.5*
%dir %{_var}/log/lsyncd/
%dir %{_var}/run/lsyncd/
%changelog
* Wed Mar 10 2010 Matthias Saou 1.26-4
- Remove optional sub-directories for log rotation, logrotate doesn't like it.
* Mon Jul 6 2009 Matthias Saou 1.26-3
- Include optional sub-directories for log rotation.
* Tue Jun 30 2009 Matthias Saou 1.26-2
- Include custom init script.
* Thu Jun 18 2009 Matthias Saou 1.26-1
- Initial RPM release.