summaryrefslogtreecommitdiffstats
path: root/rpm
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2015-10-23 20:24:19 +0200
committerDavid Sommerseth <davids@redhat.com>2015-10-23 20:24:19 +0200
commiteea95bcc2850a1370b50e2db7506bb3f9aaec557 (patch)
tree1f5d625459bbf067017134b41aab76aba0164bf8 /rpm
parentc27eb9090ab4262a4f49b4e96d21cc6fa524cf9e (diff)
downloadlogactio-eea95bcc2850a1370b50e2db7506bb3f9aaec557.tar.gz
logactio-eea95bcc2850a1370b50e2db7506bb3f9aaec557.tar.xz
logactio-eea95bcc2850a1370b50e2db7506bb3f9aaec557.zip
Final changes for packaging logactio-1.0v1.0
The .spec file have been massively modified, to comply with Fedora packaging guidelines as well as handling both RHEL6 with sysv init scripts and RHEL7 with systemd unit files. Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'rpm')
-rw-r--r--rpm/SPECS/logactio.spec103
-rwxr-xr-xrpm/mk-rpm.sh2
2 files changed, 97 insertions, 8 deletions
diff --git a/rpm/SPECS/logactio.spec b/rpm/SPECS/logactio.spec
index 68829c9..021212c 100644
--- a/rpm/SPECS/logactio.spec
+++ b/rpm/SPECS/logactio.spec
@@ -3,15 +3,44 @@
Summary: A simple log tracker which acts on certain events
Name: logactio
-Version: 0.01
+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
@@ -22,26 +51,84 @@ in Python and can easily be extended with specific actions.
%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 $RPM_BUILD_ROOT
-%{__python} setup.py install --root=$RPM_BUILD_ROOT
+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 $RPM_BUILD_ROOT
+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
+%doc COPYING docs/build/text/configuration.txt docs/build/text/starting.txt
+%{_mandir}/man7/*.gz
%{_bindir}/logactio
%{python_sitelib}/LogActio
-
-%if "%{python_ver}" >= "2.5"
%{python_sitelib}/*.egg-info
+%config(noreplace) /etc/sysconfig/%{name}
+%if 0%{systemd_avail} == 1
+%{_unitdir}/%{name}.service
+%else
+%{_initddir}/%{name}
%endif
+
%changelog
-* Wed Dec 25 2013 David Sommerseth <dazo@users.sourceforge.net> - 0.01-1
+* Fri Oct 23 2015 David Sommerseth <dazo@eurephia.org> - 1.0-1
+- Updated for final v1.0 with support for both systemd and sysv distros
+* Wed Dec 25 2013 David Sommerseth <dazo@eurephia.org> - 0.01-1
- Initial RPM packaging
diff --git a/rpm/mk-rpm.sh b/rpm/mk-rpm.sh
index d769309..9e50672 100755
--- a/rpm/mk-rpm.sh
+++ b/rpm/mk-rpm.sh
@@ -13,6 +13,8 @@
python2 setup.py sdist --formats=bztar
cp dist/logactio-*.tar.bz2 rpm/SOURCES
+ cp init/sysv/logactio rpm/SOURCES/logactio.sysv
+ cp init/systemd/logactio* rpm/SOURCES/
rpmbuild -ba --define "_topdir $(pwd)/rpm" rpm/SPECS/logactio.spec
popd