[ntop] add missing systemd scriptlets

Tom Callaway spot at fedoraproject.org
Fri Sep 9 16:19:21 UTC 2011


commit 1263966efca812ec2b610b93ee1e9146364eaa76
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Fri Sep 9 12:19:10 2011 -0400

    add missing systemd scriptlets

 ntop.spec |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/ntop.spec b/ntop.spec
index 8574103..901bf43 100644
--- a/ntop.spec
+++ b/ntop.spec
@@ -1,6 +1,6 @@
 Name:           ntop
 Version:        3.4
-Release:        0.8.pre3%{?dist}
+Release:        0.9.pre3%{?dist}
 Summary:        A network traffic probe similar to the UNIX top command
 Group:          Applications/Internet
 # Confirmed from fedora legal 488717
@@ -27,7 +27,9 @@ BuildRequires:	systemd-units
 Requires:       initscripts, graphviz
 Requires(post): systemd-sysv
 Requires(post): openssl >= 0.9.7f-4, /bin/cat
-
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description
 ntop is a network traffic probe that shows the network usage, similar to what
@@ -117,6 +119,10 @@ if [ $1 = 1 ]; then
 fi
 
 %post
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 /sbin/ldconfig
 # create new self-signed certificate
 %define sslcert %{_sysconfdir}/ntop/ntop-cert.pem
@@ -138,7 +144,19 @@ root@${FQDN}
 EOF
 fi
 
-%postun -p /sbin/ldconfig
+%preun
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable ntop.service > /dev/null 2>&1 || :
+    /bin/systemctl stop ntop.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart ntop.service >/dev/null 2>&1 || :
+fi
 /sbin/ldconfig
 
 %triggerun -- ntop < 3.4-0.8.pre3
@@ -152,7 +170,6 @@ fi
 /bin/systemctl try-restart ntop.service >/dev/null 2>&1 || :
 
 %files
-%defattr(-,root,root,-)
 %doc AUTHORS ChangeLog COPYING MANIFESTO
 %doc docs/BUG_REPORT docs/database/README docs/database/README
 %doc docs/FAQarchive docs/FAQ docs/HACKING docs/KNOWN_BUGS docs/TODO
@@ -181,6 +198,9 @@ fi
 %{_localstatedir}/lib/ntop/rrd
 
 %changelog
+* Fri Sep  9 2011 Tom Callaway <spot at fedoraproject.org> - 3.4-0.9.pre3
+- add missing systemd scriptlets
+
 * Thu Sep  8 2011 Tom Callaway <spot at fedoraproject.org> - 3.4-0.8.pre3
 - convert to systemd
 


More information about the scm-commits mailing list