SVN: rc-scripts/branches/upstart_native/rc.d/init.d/functions

jajcus jajcus at pld-linux.org
Fri May 7 14:13:20 CEST 2010


Author: jajcus
Date: Fri May  7 14:13:20 2010
New Revision: 11398

Modified:
   rc-scripts/branches/upstart_native/rc.d/init.d/functions
Log:
- --except option for upstart_controlled to simplify init scripts

Modified: rc-scripts/branches/upstart_native/rc.d/init.d/functions
==============================================================================
--- rc-scripts/branches/upstart_native/rc.d/init.d/functions	(original)
+++ rc-scripts/branches/upstart_native/rc.d/init.d/functions	Fri May  7 14:13:20 2010
@@ -1190,12 +1190,29 @@
 	shift
 	local command=$1
 	shift
-	local commands="$*"
 	local name=$(basename "$script")
 	if [ ! -f /etc/init/${name}.conf ] ; then
 		return 0
 	fi
-	if [ -n "$commands" ] ; then
+	local commands
+	local extra_commands
+	if [ "$1" = "--except" ] ; then
+		shift
+		commands="$*"
+		for cmd in $commands ; do
+			if [ "$command" = "$cmd" ] ; then
+				return 0
+			fi
+			case "$cmd" in
+				start|stop|status|reload|restart|try-restart|force-reload)
+					;;
+				*)
+					extra_commands="|$cmd"
+					;;
+			esac
+		done
+	elif [ -n "$*" ] ; then
+		commands="$*"
 		local cmd
 		local found=0
 		# is there a better way
@@ -1256,7 +1273,7 @@
 			fi
 			;;
 		*)
-		        msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+		        msg_usage "$0 {start|stop|restart|reload|force-reload|status$extra_commands}"
 			exit 3
 			;;
 	esac


More information about the pld-cvs-commit mailing list