packages: avahi/avahi-daemon - add try-restart, unify

glen glen at pld-linux.org
Sat Feb 27 23:52:32 CET 2010


Author: glen                         Date: Sat Feb 27 22:52:32 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add try-restart, unify

---- Files affected:
packages/avahi:
   avahi-daemon (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: packages/avahi/avahi-daemon
diff -u packages/avahi/avahi-daemon:1.8 packages/avahi/avahi-daemon:1.9
--- packages/avahi/avahi-daemon:1.8	Sat Feb 27 23:49:39 2010
+++ packages/avahi/avahi-daemon	Sat Feb 27 23:52:27 2010
@@ -28,27 +28,52 @@
 
 start() {
 	# Check if the service is already running?
-	if [ ! -f /var/lock/subsys/avahi-daemon ]; then
-		msg_starting "avahi-daemon"
-		_modprobe capability
-		daemon /usr/sbin/avahi-daemon -D
-		RETVAL=$?
-		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/avahi-daemon
-	else
+	if [ -f /var/lock/subsys/avahi-daemon ]; then
 		msg_already_running "avahi-daemon"
+		return
 	fi
+
+	msg_starting "avahi-daemon"
+	_modprobe capability
+	daemon /usr/sbin/avahi-daemon -D
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/avahi-daemon
 }
 
 stop() {
-	if [ -f /var/lock/subsys/avahi-daemon ]; then
-		# Stop daemons.
-		msg_stopping "avahi-daemon"
-		avahi-daemon -k
-		rm -f /var/lock/subsys/avahi-daemon
-		ok
-	else
+	if [ ! -f /var/lock/subsys/avahi-daemon ]; then
+		msg_not_running "avahi-daemon"
+		return
+	fi
+
+	# Stop daemons.
+	msg_stopping "avahi-daemon"
+	avahi-daemon -k
+	rm -f /var/lock/subsys/avahi-daemon
+	ok
+}
+
+reload() {
+	if [ ! -f /var/lock/subsys/avahi-daemon ]; then
+		msg_not_running "avahi-daemon"
+		RETVAL=7
+		return
+	fi
+
+	msg_reloading "avahi-daemon"
+	avahi-daemon -r
+	RETVAL=$?
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/avahi-daemon ]; then
 		msg_not_running "avahi-daemon"
+		RETVAL=$1
+		return
 	fi
+
+	stop
+	start
 }
 
 RETVAL=0
@@ -64,22 +89,18 @@
 	stop
 	start
 	;;
+  try-restart)
+	condrestart 0
+	;;
   reload|force-reload)
-	if [ -f /var/lock/subsys/avahi-daemon ]; then
-		msg_reloading "avahi-daemon"
-		avahi-daemon -r
-		RETVAL=$?
-	else
-		msg_not_running "avahi-daemon"
-		RETVAL=7
-	fi
+  	reload
 	;;
   status)
 	status avahi-daemon
 	RETVAL=$?
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
 	exit 3
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/avahi/avahi-daemon?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list