[argus/el6] Make specfile work on pre-systemd releases of Fedora/RHEL.

Jan-Frode Myklebust janfrode at fedoraproject.org
Wed Mar 7 20:34:31 UTC 2012


commit c652ee97a2da16e8edfd30b5e23204ce1de526e7
Author: Jan-Frode Myklebust <janfrode at tanso.net>
Date:   Wed Mar 7 21:34:19 2012 +0100

    Make specfile work on pre-systemd releases of Fedora/RHEL.

 argus.spec |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/argus.spec b/argus.spec
index 454b52f..22a78c6 100644
--- a/argus.spec
+++ b/argus.spec
@@ -1,6 +1,6 @@
 Name: argus
 Version: 2.0.6.fixes.1
-Release: 23%{?dist}
+Release: 24%{?dist}
 Summary: Network transaction audit tool
 License: GPLv2+
 Group: Applications/Internet
@@ -9,6 +9,7 @@ Source0: ftp://ftp.qosient.com/dev/argus-2.0/%{name}-%{version}.tar.gz
 Source1: ftp://ftp.qosient.com/dev/argus-2.0/%{name}-clients-%{version}.tar.gz
 Source2: argus.service
 Source3: README.fedora
+Source4: argus.init
 Patch0: argus-2.0.6.fixes.1-makefile.patch
 Patch1: argus-2.0.6.fixes.1-build.patch
 # bpf_dump conflicts with a function with slightly different prototype (added
@@ -17,13 +18,20 @@ Patch2: argus-2.0.6.fixes.1-libpcap10.patch
 Patch3: argus-clients-2.0.6.fixes.1-makefile.patch
 Patch4: argus-clients-2.0.6.fixes.1-build.patch
 Patch5: argus-clients-2.0.6.fixes.1-print.patch
+
+%if %{?fedora}0 > 140 || %{?rhel}0 > 60
 Requires(post): systemd-sysv
 Requires(post): systemd-units
 Requires(preun): systemd-units
 Requires(postun): systemd-units
+BuildRequires: systemd-units
+%else
+Requires(post): /sbin/chkconfig
+Requires(preun): /sbin/chkconfig
+%endif
+
 BuildRequires: cyrus-sasl-devel tcp_wrappers flex bison ncurses-devel
 BuildRequires: libpcap-devel
-BuildRequires: systemd-units
 
 %package clients
 Summary: Client tools for argus network audit
@@ -70,7 +78,11 @@ popd
 %{__rm} -rf %{buildroot}/%{_bindir}/ragraph
 %{__install} -d -m 0755 %{buildroot}/%{_localstatedir}/lib/argus/archive
 %{__install} -D -m 0644 support/Config/argus.conf %{buildroot}/%{_sysconfdir}/argus.conf
+%if %{?fedora}0 > 140 || %{?rhel}0 > 60
 %{__install} -D -m 0755 %{SOURCE2} %{buildroot}/%{_unitdir}/argus.service
+%else
+%{__install} -D -m 0755 %{SOURCE2} %{buildroot}/%{_initrddir}/argus
+%endif
 # fix up argus.conf to a good default
 %{__sed} -i 's|var/log/argus|var/lib/argus|' %{buildroot}/%{_sysconfdir}/argus.conf
 %{__sed} -i 's|#ARGUS_BIND_IP|ARGUS_BIND_IP|' %{buildroot}/%{_sysconfdir}/argus.conf
@@ -79,25 +91,45 @@ popd
 find support -type f -exec chmod a-x '{}' \;
 
 %post
+%if %{?fedora}0 > 140 || %{?rhel}0 > 60
 if [ $1 -eq 1 ] ; then 
     # Initial installation 
     /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 fi
+%else
+if [ $1 -le 1 ]; then
+       /sbin/chkconfig --add argus
+fi
+%endif
 
 %preun
+%if %{?fedora}0 > 140 || %{?rhel}0 > 60
 if [ $1 -eq 0 ] ; then
     # Package removal, not upgrade
     /bin/systemctl --no-reload disable argus.service > /dev/null 2>&1 || :
     /bin/systemctl stop argus.service > /dev/null 2>&1 || :
 fi
+%else
+if [ $1 -eq 0 ]; then
+       /sbin/service argus stop >/dev/null 2>&1
+       /sbin/chkconfig --del argus
+fi
+%endif
 
 %postun
+%if %{?fedora}0 > 140 || %{?rhel}0 > 60
 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ $1 -ge 1 ] ; then
     # Package upgrade, not uninstall
     /bin/systemctl try-restart argus.service >/dev/null 2>&1 || :
 fi
+%else
+if [ $1 -ge 1 ]; then
+       /sbin/service argus condrestart >/dev/null 2>&1
+fi
+%endif
 
+%if %{?fedora}0 > 140 || %{?rhel}0 > 60
 %triggerun -- argus < 2.0.6.fixes.1-21
 # Save the current service runlevel info
 # User must manually run systemd-sysv-convert --apply argus
@@ -107,12 +139,17 @@ fi
 # Run these because the SysV package being removed won't do them
 /sbin/chkconfig --del argus >/dev/null 2>&1 || :
 /bin/systemctl try-restart argus.service >/dev/null 2>&1 || :
+%endif
 
 %files
 %doc support doc/CHANGES doc/FAQ doc/HOW-TO doc/html bin/argusbug
 %doc COPYING CREDITS INSTALL README VERSION
 %config(noreplace) %{_sysconfdir}/argus.conf
+%if %{?fedora}0 > 140 || %{?rhel}0 > 60
 %{_unitdir}/argus.service
+%else
+%{_initrddir}/argus
+%endif
 %{_sbindir}/argus*
 %{_mandir}/man5/argus*
 %{_mandir}/man8/argus*
@@ -135,6 +172,9 @@ fi
 %{_mandir}/man5/ra*
 
 %changelog
+* Wed Mar  7 2012 Jan-Frode Myklebust <janfrode at tanso.net> - 2.0.6.fixes.1-24
+- Make specfile work on pre-systemd releases of Fedora/RHEL.
+
 * Thu Jan 12 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.0.6.fixes.1-23
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list