%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_ver: %define python_ver %(%{__python} -c "import sys ; print sys.version[:3]")} Summary: A simple log tracker which acts on certain events Name: logactio Version: 1.0 Release: 1 License: GPLv2 Group: System Environment/Daemons URL: http://fedorapeople.org/cgit/dsommers/public_git/logactio.git/ Source0: %{name}-%{version}.tar.bz2 Source1: logactio.sysconf Source2: logactio.service Source3: logactio.sysv BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch %define systemd_avail 0 %if 0%{?rhel} >= 7 %define systemd_avail 1 %endif %if 0%{?fedora} >= 15 %define systemd_avail 1 %endif %if 0%{systemd_avail} == 1 Requires(post): systemd Requires(preun): systemd Requires(postun): systemd BuildRequires: systemd %else Requires(post): chkconfig Requires(preun): chkconfig Requires(preun): initscripts %endif %if 0%{rhel} <= 6 BuildRequires: python-sphinx10 %else BuildRequires: python-sphinx %endif %description LogActio is a modular log tracker, which observes changes and acts through different modules based on the event. It is purely written in Python and can easily be extended with specific actions. %prep %setup -q %build %{__python} setup.py build pushd docs %if 0%{rhel} > 6 make text man %else make text man SPHINXBUILD=sphinx-1.0-build %endif popd %install rm -rf %{buildroot} # Install logactio code %{__python} setup.py install --root=%{buildroot} # Install man pages mkdir -p %{buildroot}/%{_mandir}/man7 install -m644 docs/build/man/%{name}.7 %{buildroot}/%{_mandir}/man7/ # Install sysv-initd/systemd related stuff mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig install -m644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name} %if 0%{systemd_avail} == 1 mkdir -p %{buildroot}/%{_unitdir}/ install -m644 %{SOURCE2} %{buildroot}/%{_unitdir}/ %else mkdir -p %{buildroot}/%{_initddir}/ install -m755 %{SOURCE3} %{buildroot}/%{_initddir}/%{name} %endif %clean rm -rf %{buildroot} %post %if 0%{systemd_avail} == 1 %systemd_post logactio.service %else /sbin/chkconfig --add %{name} %endif %preun %if 0%{systemd_avail} == 1 %systemd_preun logactio.service %else if [ $1 -eq 0 ] ; then /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} fi %endif %postun %if 0%{systemd_avail} == 1 %systemd_postun_with_restart logactio.service %else if [ "$1" -ge "1" ] ; then /sbin/service %{name} condrestart >/dev/null 2>&1 || : fi %endif %files %defattr(-,root,root,-) %doc COPYING docs/build/text/configuration.txt docs/build/text/starting.txt %{_mandir}/man7/*.gz %{_bindir}/logactio %{python_sitelib}/LogActio %{python_sitelib}/*.egg-info %config(noreplace) /etc/sysconfig/%{name} %if 0%{systemd_avail} == 1 %{_unitdir}/%{name}.service %else %{_initddir}/%{name} %endif %changelog * Fri Oct 23 2015 David Sommerseth - 1.0-1 - Updated for final v1.0 with support for both systemd and sysv distros * Wed Dec 25 2013 David Sommerseth - 0.01-1 - Initial RPM packaging