Blob Blame History Raw
Name:           fsniper
Version:        1.3.1
Release:        5%{?dist}
Summary:        A tool that monitors directories for new files and invokes scripts on them

Group:          Applications/File
License:        GPLv3+
URL:            http://projects.l3ib.org/trac/fsniper
Source0:        http://projects.l3ib.org/fsniper/files/fsniper-%{version}.tar.gz
Source1:        fsniper.initscript
Source2:        fsniper.conf
Source3:        fsniper.sysconfig

# Fix umask permissions - http://bugs.l3ib.org/index.php?do=details&task_id=21
Patch1:         fsniper-umask.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  file-devel
BuildRequires:  pcre-devel

Requires(preun):  initscripts chkconfig
Requires(post):   chkconfig
Requires(postun): initscripts
Requires(pre):    /usr/sbin/useradd /usr/sbin/groupadd

%define servicename fsniper
%define fsdir       %{_localstatedir}/lib/%{name}

%description
fsniper is a tool that monitors a given set of directories for new
files. Then, based on the new file's type or name, it invokes a script to
be run (any executable via the shell) on that file.  Common uses include
making a single drop directory for all things from a webbrowser etc, and
having semi-intelligent scripts figure out what to do with those files. You
write the scripts yourself.


%prep
%setup -q
%patch1 -p1 -b .umask


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
mkdir -p $RPM_BUILD_ROOT%{fsdir}

make install DESTDIR=$RPM_BUILD_ROOT

install -pm 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/fsniper
install -pm 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/fsniper.conf
install -pm 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/fsniper
install -pm 0644 doc/doc.txt $RPM_BUILD_ROOT%{docdir}

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{_bindir}/fsniper
%{_initrddir}/%{name}
%attr(-,%{name},%{name}) %dir %{fsdir}/
%config(noreplace) %{_sysconfdir}/fsniper.conf
%config(noreplace) %{_sysconfdir}/sysconfig/fsniper
%doc AUTHORS COPYING INSTALL README
%doc doc/doc.txt doc/keyvalcfg.txt example.conf

%pre
if [ $1 = 1 ]; then
    getent group %{name} >/dev/null || groupadd -r %{name}
    getent passwd %{name} >/dev/null || \
           useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin \
           -c "%{name} user" %{name}
    exit 0
fi

%post
/sbin/chkconfig --add %{servicename}

%preun
if [ $1 = 0 ]; then
    /sbin/service %{servicename} stop >/dev/null 2>&1
    /sbin/chkconfig --del %{servicename} 
fi

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

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

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

* Mon Jan 12 2009 Jakub Hrozek <jhrozek@redhat.com> 1.3.1-3
- apply the correct patch from upstream VCS (Manuel Wolfshant)

* Wed Oct 22 2008 Jakub Hrozek <jhrozek@redhat.com> 1.3.1-2
- issues found during review (#467627):
- add link to upstream bugtracker for patch
- exit with 0 after useradd

* Sun Oct 19 2008 Jakub Hrozek <jhrozek@redhat.com> 1.3.1-1
- Initial packaging