From: dhozac <dhozac@8c455092-636d-4788-adf5-e71def0336e8>
Date: Thu, 5 Nov 2009 23:17:13 +0000 (+0000)
Subject: Don't re-enable the initscript if it has been disabled.
X-Git-Tag: fprobe-ulog-1.1.3-3~12
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ce4923d5f22b67f3613b841e456262cc863a085d;p=fprobe-ulog.git

Don't re-enable the initscript if it has been disabled.


git-svn-id: http://svn.planet-lab.org/svn/fprobe-ulog/trunk@15664 8c455092-636d-4788-adf5-e71def0336e8
---

diff --git a/fprobe-initscript b/fprobe-initscript
index 17dc144..38b33f7 100644
--- a/fprobe-initscript
+++ b/fprobe-initscript
@@ -63,6 +63,15 @@ case "$1" in
             echo 'not running' && exit 1
         ;;
 
+    condrestart)
+        if check_status; then
+	    $0 restart
+	    RETVAL=$?
+	else
+	    RETVAL=0
+	fi
+	;;
+
     *)
         echo "Usage: $0 {start|stop|restart|status}"
         RETVAL=1
diff --git a/fprobe-ulog.spec b/fprobe-ulog.spec
index 08cdf79..e199944 100644
--- a/fprobe-ulog.spec
+++ b/fprobe-ulog.spec
@@ -55,10 +55,9 @@ rm -rf %{buildroot}
 
 %post
 chkconfig --add fprobe-ulog
-chkconfig fprobe-ulog on
 if [ "$PL_BOOTCD" != "1" ] ; then
-	service fprobe-ulog restart
-    fi
+    service fprobe-ulog condrestart
+fi
 
 %preun
 # 0 = erase, 1 = upgrade
@@ -66,7 +65,6 @@ if [ "$1" -eq 0 ]; then
     if [ "$PL_BOOTCD" != "1" ] ; then
 	service fprobe-ulog stop
     fi
-    chkconfig fprobe-ulog off
     chkconfig --del fprobe-ulog
 fi