bee4785
Name:           fsniper
bee4785
Version:        1.3.1
2f76c74
Release:        16%{?dist}
bee4785
Summary:        A tool that monitors directories for new files and invokes scripts on them
bee4785
bee4785
Group:          Applications/File
bee4785
License:        GPLv3+
50da0ef
URL:            https://github.com/l3ib/fsniper
bee4785
Source0:        http://projects.l3ib.org/fsniper/files/fsniper-%{version}.tar.gz
50da0ef
Source1:        fsniper.service
bee4785
Source2:        fsniper.conf
bee4785
Source3:        fsniper.sysconfig
bee4785
bee4785
# Fix umask permissions - http://bugs.l3ib.org/index.php?do=details&task_id=21
bee4785
Patch1:         fsniper-umask.patch
de8c39e
Patch2:         0001-Fix-an-error-message.patch
bee4785
bee4785
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
bee4785
bee4785
BuildRequires:  file-devel
bee4785
BuildRequires:  pcre-devel
50da0ef
BuildRequires:  systemd-units
bee4785
50da0ef
Requires(post):   systemd-units systemd-sysv
50da0ef
Requires(preun):  systemd-units
50da0ef
Requires(postun): systemd-units
bee4785
Requires(pre):    /usr/sbin/useradd /usr/sbin/groupadd
bee4785
50da0ef
%define servicename fsniper.service
bee4785
%define fsdir       %{_localstatedir}/lib/%{name}
bee4785
bee4785
%description
bee4785
fsniper is a tool that monitors a given set of directories for new
bee4785
files. Then, based on the new file's type or name, it invokes a script to
bee4785
be run (any executable via the shell) on that file.  Common uses include
bee4785
making a single drop directory for all things from a webbrowser etc, and
bee4785
having semi-intelligent scripts figure out what to do with those files. You
bee4785
write the scripts yourself.
bee4785
bee4785
bee4785
%prep
bee4785
%setup -q
bee4785
%patch1 -p1 -b .umask
de8c39e
%patch2 -p1 -b .errmessage
bee4785
bee4785
bee4785
%build
bee4785
%configure
bee4785
make %{?_smp_mflags}
bee4785
bee4785
bee4785
%install
bee4785
rm -rf $RPM_BUILD_ROOT
50da0ef
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
bee4785
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
bee4785
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
bee4785
mkdir -p $RPM_BUILD_ROOT%{fsdir}
bee4785
bee4785
make install DESTDIR=$RPM_BUILD_ROOT
bee4785
50da0ef
install -pm 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/%{servicename}
bee4785
install -pm 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/fsniper.conf
bee4785
install -pm 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/fsniper
bee4785
install -pm 0644 doc/doc.txt $RPM_BUILD_ROOT%{docdir}
bee4785
bee4785
%clean
bee4785
rm -rf $RPM_BUILD_ROOT
bee4785
bee4785
bee4785
%files
bee4785
%defattr(-,root,root,-)
bee4785
%{_bindir}/fsniper
50da0ef
%{_unitdir}/%{servicename}
bee4785
%attr(-,%{name},%{name}) %dir %{fsdir}/
bee4785
%config(noreplace) %{_sysconfdir}/fsniper.conf
bee4785
%config(noreplace) %{_sysconfdir}/sysconfig/fsniper
bee4785
%doc AUTHORS COPYING INSTALL README
bee4785
%doc doc/doc.txt doc/keyvalcfg.txt example.conf
bee4785
bee4785
%pre
bee4785
if [ $1 = 1 ]; then
bee4785
    getent group %{name} >/dev/null || groupadd -r %{name}
bee4785
    getent passwd %{name} >/dev/null || \
bee4785
           useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin \
bee4785
           -c "%{name} user" %{name}
bee4785
    exit 0
bee4785
fi
bee4785
bee4785
%post
50da0ef
if [ $1 -eq 1 ] ; then 
50da0ef
    # Initial installation 
50da0ef
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
50da0ef
fi
bee4785
bee4785
%preun
50da0ef
if [ $1 -eq 0 ] ; then
50da0ef
    # Package removal, not upgrade
50da0ef
    /bin/systemctl --no-reload disable %{servicename} > /dev/null 2>&1 || :
50da0ef
    /bin/systemctl stop %{servicename} > /dev/null 2>&1 || :
bee4785
fi
bee4785
bee4785
%postun
50da0ef
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
50da0ef
if [ $1 -ge 1 ] ; then
50da0ef
    # Package upgrade, not uninstall
50da0ef
    /bin/systemctl try-restart %{servicename} >/dev/null 2>&1 || :
bee4785
fi
bee4785
50da0ef
%triggerun -- fsniper < 1.0-2
50da0ef
# Save the current service runlevel info
50da0ef
# User must manually run systemd-sysv-convert --apply fsniper
50da0ef
# to migrate them to systemd targets
50da0ef
/usr/bin/systemd-sysv-convert --save fsniper >/dev/null 2>&1 ||:
50da0ef
50da0ef
# If the package is allowed to autostart:
50da0ef
/bin/systemctl --no-reload enable %{servicename} >/dev/null 2>&1 ||:
50da0ef
50da0ef
# Run these because the SysV package being removed won't do them
50da0ef
/sbin/chkconfig --del fsniper >/dev/null 2>&1 || :
50da0ef
/bin/systemctl try-restart %{servicename} >/dev/null 2>&1 || :
50da0ef
bee4785
%changelog
2f76c74
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-16
2f76c74
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
2f76c74
6a7c6fe
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-15
6a7c6fe
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
6a7c6fe
e71d139
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-14
e71d139
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
e71d139
aa359c0
* Tue Dec 03 2013 Jakub Hrozek <jhrozek@redhat.com> - 1.3.1-13
de8c39e
- Fix -Wformat-security warning (rhbz #1037073)
de8c39e
7527389
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-12
7527389
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
7527389
4cdaf94
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-11
4cdaf94
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
4cdaf94
c62586e
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-10
c62586e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
c62586e
4efd4f1
* Fri Feb 10 2012 Petr Pisar <ppisar@redhat.com> - 1.3.1-9
4efd4f1
- Rebuild against PCRE 8.30
4efd4f1
4ebd150
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-8
4ebd150
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
4ebd150
50da0ef
* Mon Jan 02 2012 Jakub Hrozek <jhrozek@redhat.com> 1.3.1-7
50da0ef
- systemd support
50da0ef
- fix the upstream URL. The source0 URL stays the same until upstream
50da0ef
  releases a new version
50da0ef
dbe31b7
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-6
dbe31b7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
dbe31b7
cf7a911
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-5
cf7a911
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
cf7a911
df32f5b
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-4
df32f5b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
df32f5b
bee4785
* Mon Jan 12 2009 Jakub Hrozek <jhrozek@redhat.com> 1.3.1-3
bee4785
- apply the correct patch from upstream VCS (Manuel Wolfshant)
bee4785
bee4785
* Wed Oct 22 2008 Jakub Hrozek <jhrozek@redhat.com> 1.3.1-2
bee4785
- issues found during review (#467627):
bee4785
- add link to upstream bugtracker for patch
bee4785
- exit with 0 after useradd
bee4785
bee4785
* Sun Oct 19 2008 Jakub Hrozek <jhrozek@redhat.com> 1.3.1-1
bee4785
- Initial packaging
bee4785