Summary:     Inotify cron system
Name:        incron
Version:     0.5.10
Release:     2%{?_dist_release}

Group:       System Environment/Base          
License:     GPLv2
URL:         http://inotify.aiken.cz
Source0:     http://inotify.aiken.cz/download/incron/%{name}-%{version}.tar.bz2
Source1:     incrond.init
#Patch0:      incron-gcc44.patch
Patch1:      incron-gcc47.patch
BuildRoot:   %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires(post):   /sbin/chkconfig
Requires(preun):  /sbin/chkconfig, /sbin/service

Vendor: Project Vine
Distribution: Vine Linux
Packager: tomop

%description
This program is an "inotify cron" system.
It consists of a daemon and a table manipulator.
You can use it a similar way as the regular cron.
The difference is that the inotify cron handles
filesystem events rather than time periods.

%prep
%setup -q
#%patch0 -p1 -b .orig
%patch1 -p0 -b .gcc47

%build
make %{?_smp_mflags} CXXFLAGS="%{optflags}"


%install
rm -rf %{buildroot}

#install files manually since source Makefile tries to do it as root
install -D -p incrond %{buildroot}%{_sbindir}/incrond
install -D -p -m 4755 incrontab %{buildroot}%{_bindir}/incrontab
install -d %{buildroot}%{_localstatedir}/spool/%{name}
install -d %{buildroot}%{_sysconfdir}/%{name}.d
install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_initdir}/incrond
install -D -p -m 0644 incron.conf.example %{buildroot}%{_sysconfdir}/%{name}.conf

# install manpages
make install-man MANPATH="%{buildroot}%{_mandir}" INSTALL="install -D -p"

%post
if [ $1 -eq 1 ]; then
    /sbin/chkconfig --add incrond
fi


%preun
if [ $1 -eq 0 ]; then
        /sbin/service %{name} stop >/dev/null 2>&1 || :
        /sbin/chkconfig --del incrond
fi


%postun
if [ $1 -ge 1 ]; then
        /sbin/service incrond condrestart >/dev/null 2>&1 || :
fi


%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%attr(4755,root,root) %{_bindir}/incrontab
%{_sbindir}/incrond
%{_initdir}/incrond
%config(noreplace) %{_sysconfdir}/%{name}.conf
%{_mandir}/man1/incrontab.1.gz
%{_mandir}/man5/incrontab.5.gz
%{_mandir}/man5/incron.conf.5.gz
%{_mandir}/man8/incrond.8.gz
%dir %{_localstatedir}/spool/%{name}
%dir %{_sysconfdir}/%{name}.d
%doc COPYING CHANGELOG README TODO LICENSE-GPL



%changelog
* Sun Jan 12 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.5.10-2
- rebuilt with current environment.

* Fri May 04 2012 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.5.10-1
- new upstream release.
- built for Vine Linux.

* Thu Feb 16 2012 Jon Ciesla <limburgher@gmail.com> - 0.5.9-4
- Migrate to systemd, BZ 789688.
- gcc47 patch.

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon Dec 21 2009 Ruben Kerkhof <ruben@rubenkerkhof.com> 0.5.9-1
- Upstream released new version

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Ruben Kerkhof <ruben@rubenkerkhof.com> 0.5.8-1
- Upstream released new version
- GCC 4.4 fixes
- Drop GCC 4.3 patch, fixed upstream

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Feb 09 2008 Ruben Kerkhof <ruben@rubenkerkhof.com> - 0.5.7-1
- Sync with upstream

* Tue Mar 13 2007 <ruben@rubenkerkhof.com> 0.5.5-1
- Sync with upstream
* Mon Feb 12 2007 <ruben@rubenkerkhof.com> 0.5.4-1
- Update to new upstream version
- Upstream fixed permissions on pidfile
- New manpage for incron.conf
- Upstream fixed example conf file
* Sun Feb 04 2007 <ruben@rubenkerkhof.com> 0.5.1-1
- Updated to new upstream version
- Upstream fixed the incorrect encoding of the LICENSE-GPL file
* Sat Jan 27 2007 <ruben@rubenkerkhof.com> 0.5.0-1
- Updated to new upstream version
- Changed the service name in the scriptlets
- Added a configuration file
- Included GPL License
* Sat Jan 27 2007 <ruben@rubenkerkhof.com> 0.4.0-1
- First try at packaging it up
