f60a6cf
%global _hardened_build 1
f60a6cf
f60a6cf
Name:           fido
f60a6cf
Version:        1.0.7
d8c448c
Release:        6%{?dist}
f60a6cf
Summary:        Multi-threaded file watch utility
f60a6cf
Group:          System Environment/Daemons
f60a6cf
f60a6cf
License:        GPLv2+ and LGPLv2+
f60a6cf
URL:            http://www.joedog.org/%{name}-home/
f60a6cf
Source0:        http://www.joedog.org/pub/%{name}/%{name}-%{version}.tar.gz
f60a6cf
f60a6cf
#Patch0-2: Sent upstream via email 20130206
f60a6cf
Patch0:         %{name}-support_destdir_in_doc.patch
f60a6cf
Patch1:         %{name}-fix-fsf-address.patch
f60a6cf
Patch2:         %{name}-systemd.patch
f60a6cf
f60a6cf
#fixing some memory leaks
f60a6cf
#Sent upstream via email 20130906
f60a6cf
Patch3:         %{name}-segfault.patch
f60a6cf
f60a6cf
#drop supplementary groups of calling user when switching to a non-privileged
f60a6cf
#user.
f60a6cf
#Sent upstream via email 20130906
f60a6cf
Patch4:         %{name}-setgroups.patch
f60a6cf
f60a6cf
#another overflow showed up because of the hardened build
f60a6cf
#Sent upstream via email 20131206
f60a6cf
Patch5:         %{name}-overflow.patch
f60a6cf
f60a6cf
#Upstream whants to keep the static library
f60a6cf
Patch6:         %{name}-shared-library.patch
f60a6cf
f60a6cf
%{?el5:BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)}
f60a6cf
f60a6cf
Requires: libjoedog
f60a6cf
%if 0%{?fedora} || 0%{?rhel} >= 7
f60a6cf
BuildRequires:    systemd
28e126c
%{?systemd_requires}
f60a6cf
%else
f60a6cf
Requires(post):  /sbin/chkconfig
f60a6cf
Requires(preun): /sbin/chkconfig
f60a6cf
Requires(preun): initscripts
f60a6cf
%endif
f60a6cf
BuildRequires:   libtool, libjoedog-devel
f60a6cf
f60a6cf
f60a6cf
%description
f60a6cf
A multi-threaded file watch utility. It can monitor files for changes in
f60a6cf
content or modification times. If it notices a change, it will kick off a
f60a6cf
user-defined script.
f60a6cf
f60a6cf
f60a6cf
%prep
f60a6cf
%setup -q
f60a6cf
f60a6cf
%patch0
f60a6cf
%patch1
f60a6cf
%patch2
f60a6cf
%patch3
f60a6cf
%patch4
f60a6cf
%patch5
f60a6cf
%patch6
f60a6cf
f60a6cf
rm -f *.m4
f60a6cf
rm -rf include/joedog/*.h
f60a6cf
sed -i -e 's/AC_PROG_SHELL//' configure.in
f60a6cf
autoreconf --install --force
f60a6cf
f60a6cf
f60a6cf
%build
f60a6cf
%configure
f60a6cf
make %{?_smp_mflags}
f60a6cf
f60a6cf
f60a6cf
%install
f60a6cf
%if 0%{?el5}
f60a6cf
rm -rf %{buildroot}
f60a6cf
make install DESTDIR=%{buildroot}
f60a6cf
%else
f60a6cf
%make_install
f60a6cf
%endif
f60a6cf
f60a6cf
%if 0%{?fedora} || 0%{?rhel} >= 7
f60a6cf
#systemd
f60a6cf
install -D -p -m 0644 %{name}.service %{buildroot}%{_unitdir}/%{name}.service
f60a6cf
%else
f60a6cf
#SysVinit
f60a6cf
install -D -p -m 0644 utils/%{name}-redhat-config %{buildroot}%{_sysconfdir}/sysconfig/%{name}
d8c448c
%{?el6:install -D -p -m 0755 utils/%{name}-redhat-start %{buildroot}%{_initddir}/%{name}}
d8c448c
%{?el5:install -D -p -m 0755 utils/%{name}-redhat-start %{buildroot}%{_initrddir}/%{name}}
f60a6cf
%endif
f60a6cf
f60a6cf
#prepare sample configs for doc
f60a6cf
for _file in doc/*.conf
f60a6cf
do
f60a6cf
    ln -f "${_file}" "${_file}.sample"
f60a6cf
done
f60a6cf
f60a6cf
#provide a reasonable minimal config as starting point
f60a6cf
sed -e 's/^verbose  = true/verbose = false/' \
f60a6cf
  %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf.sample \
f60a6cf
  > %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
f60a6cf
rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf.sample
f60a6cf
f60a6cf
f60a6cf
%clean
f60a6cf
%{?el5:rm -rf %{buildroot}}
f60a6cf
f60a6cf
f60a6cf
%files
f60a6cf
%doc ChangeLog README COPYING
f60a6cf
%doc doc/*.sample
f60a6cf
%{_sbindir}/%{name}
f60a6cf
%{_mandir}/man*/*
f60a6cf
%{_sysconfdir}/%{name}/rules
f60a6cf
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
f60a6cf
f60a6cf
%if 0%{?fedora} || 0%{?rhel} >= 7
f60a6cf
#systemd
f60a6cf
%{_unitdir}/%{name}.service
f60a6cf
f60a6cf
f60a6cf
%post
f60a6cf
%systemd_post %{name}.service
f60a6cf
f60a6cf
%preun
f60a6cf
%systemd_preun %{name}.service
f60a6cf
f60a6cf
%postun
f60a6cf
%systemd_postun_with_restart %{name}.service
f60a6cf
%else
f60a6cf
#SysVinit
f60a6cf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
f60a6cf
d8c448c
%{?el6:%{_initddir}/%{name}}
d8c448c
%{?el5:%{_initrddir}/%{name}}
f60a6cf
f60a6cf
%post
f60a6cf
/sbin/chkconfig --add %{name}
f60a6cf
f60a6cf
%preun
f60a6cf
if [ $1 -eq 0 ] ; then
f60a6cf
    /sbin/service %{name} stop >/dev/null 2>&1
f60a6cf
    /sbin/chkconfig --del %{name}
f60a6cf
fi
f60a6cf
f60a6cf
%postun
f60a6cf
if [ "$1" -ge "1" ] ; then
f60a6cf
    /sbin/service %{name} condrestart >/dev/null 2>&1 || :
f60a6cf
fi
f60a6cf
%endif
f60a6cf
f60a6cf
f60a6cf
%changelog
d8c448c
* Wed Jun 26 2013 Roman Mohr <roman@fenkhuber.at> - 1.0.7-6
d8c448c
- Use %%{_initrddir} instead of %%{_initddir} for el5
d8c448c
f60a6cf
* Mon Jun 24 2013 Roman Mohr <roman@fenkhuber.at> - 1.0.7-5
f60a6cf
- trimmed/rearranged BuildRequires
f60a6cf
- nuked explicit Requires: libjoedog
f60a6cf
- removed article from Summary
f60a6cf
f60a6cf
* Mon Jun 24 2013 Roman Mohr <roman@fenkhuber.at> - 1.0.7-4
f60a6cf
- Use libjoedog instead of the bundled satic library
f60a6cf
- Fixed hardening build
f60a6cf
- Added missing Group for EPEL5
f60a6cf
f60a6cf
* Tue Jun 11 2013 Roman Mohr <roman@fenkhuber.at> - 1.0.7-3
f60a6cf
- Refactoring spec to support EPEL builds
f60a6cf
- Hunting down some more memory leaks
f60a6cf
f60a6cf
* Sun Jun 09 2013 Roman Mohr <roman@fenkhuber.at> - 1.0.7-2
f60a6cf
- Added systemd unit file
f60a6cf
- Fixed some memory leaks
f60a6cf
- Fixed a security issue when switching to a non-privileged user
f60a6cf
f60a6cf
* Mon May 20 2013 Roman Mohr <roman@fenkhuber.at> - 1.0.7-1
f60a6cf
- Fixed custom rules in Makefile.in to support DESTDIR
f60a6cf
- Fixed incorrect-fsf-address errors