public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] eselect r477 - in trunk: . modules
@ 2009-04-20 16:55 Ulrich Mueller (ulm)
  0 siblings, 0 replies; only message in thread
From: Ulrich Mueller (ulm) @ 2009-04-20 16:55 UTC (permalink / raw
  To: gentoo-commits

Author: ulm
Date: 2009-04-20 16:55:51 +0000 (Mon, 20 Apr 2009)
New Revision: 477

Modified:
   trunk/ChangeLog
   trunk/modules/rc.eselect
Log:
Reintroduce optional "runlevels" parameter in do_show. Document it.

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-04-20 15:00:33 UTC (rev 476)
+++ trunk/ChangeLog	2009-04-20 16:55:51 UTC (rev 477)
@@ -6,6 +6,8 @@
 	(do_show): Function completely rewritten; use the common API
 	of baselayout-1 and OpenRC. Thanks to Sebastian Günther
 	<samson@guenther-roetgen.de> in bug 180966.
+	(describe_show, describe_show_parameters, describe_show_options):
+	Document optional "runlevel" parameter of do_show().
 
 	* libs/editor-variable.bash.in:
 	* modules/editor.eselect:

Modified: trunk/modules/rc.eselect
===================================================================
--- trunk/modules/rc.eselect	2009-04-20 15:00:33 UTC (rev 476)
+++ trunk/modules/rc.eselect	2009-04-20 16:55:51 UTC (rev 477)
@@ -205,9 +205,17 @@
 ### show action
 
 describe_show() {
-	echo "Show init script status for current runlevel"
+	echo "Show init script status"
 }
 
+describe_show_parameters() {
+	echo "<runlevels>"
+}
+
+describe_show_options() {
+	echo "runlevels : Runlevels to list (defaults to current runlevel)"
+}
+
 do_show() {
 	# subshell to avoid pollution of caller's environment
 	(
@@ -215,28 +223,36 @@
 		# functions.sh needs the bash builtin
 		unset -f eval
 		source_rc_functions
-		runlevel=$(get_runlevel)
-		write_list_start \
-			"Status of init scripts in runlevel \"${runlevel}\""
-		for script in $(find_scripts "${ROOT}/etc/runlevels/${runlevel}"); do
-			for x in stopping starting inactive started stopped; do
-				if service_${x} ${script}; then
-					case ${x} in
-						starting|inactive)
-							write_kv_list_entry ${script} \
-								"$(highlight_warning [${x}])"
-							;;
-						started)
-							write_kv_list_entry ${script} "$(highlight [${x}])"
-							;;
-						*)
-							write_kv_list_entry ${script} [${x}]
-							;;
-					esac
-					continue 2
-				fi
+		[[ -z $1 ]] && set - "$(get_runlevel)"
+
+		for runlevel in "$@"; do
+			[[ -d ${ROOT}/etc/runlevels/${runlevel} ]] \
+				|| die -q "${runlevel} is no valid runlevel"
+
+			write_list_start \
+				"Status of init scripts in runlevel \"${runlevel}\""
+			for script in $(find_scripts "${ROOT}/etc/runlevels/${runlevel}")
+			do
+				status=unknown
+				for x in stopping starting inactive started stopped; do
+					if service_${x} ${script}; then
+						status=${x}
+						break
+					fi
+				done
+				case ${status} in
+					starting|inactive|unknown)
+						write_kv_list_entry \
+							${script} "$(highlight_warning [${x}])"
+						;;
+					started)
+						write_kv_list_entry ${script} "$(highlight [${x}])"
+						;;
+					*)
+						write_kv_list_entry ${script} [${x}]
+						;;
+				esac
 			done
-			write_kv_list_entry ${script} "$(highlight_warning [unknown])"
 		done
 	)
 }




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-20 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-20 16:55 [gentoo-commits] eselect r477 - in trunk: . modules Ulrich Mueller (ulm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox