1 |
Author: ulm |
2 |
Date: 2009-04-20 16:55:51 +0000 (Mon, 20 Apr 2009) |
3 |
New Revision: 477 |
4 |
|
5 |
Modified: |
6 |
trunk/ChangeLog |
7 |
trunk/modules/rc.eselect |
8 |
Log: |
9 |
Reintroduce optional "runlevels" parameter in do_show. Document it. |
10 |
|
11 |
Modified: trunk/ChangeLog |
12 |
=================================================================== |
13 |
--- trunk/ChangeLog 2009-04-20 15:00:33 UTC (rev 476) |
14 |
+++ trunk/ChangeLog 2009-04-20 16:55:51 UTC (rev 477) |
15 |
@@ -6,6 +6,8 @@ |
16 |
(do_show): Function completely rewritten; use the common API |
17 |
of baselayout-1 and OpenRC. Thanks to Sebastian Günther |
18 |
<samson@××××××××××××××××.de> in bug 180966. |
19 |
+ (describe_show, describe_show_parameters, describe_show_options): |
20 |
+ Document optional "runlevel" parameter of do_show(). |
21 |
|
22 |
* libs/editor-variable.bash.in: |
23 |
* modules/editor.eselect: |
24 |
|
25 |
Modified: trunk/modules/rc.eselect |
26 |
=================================================================== |
27 |
--- trunk/modules/rc.eselect 2009-04-20 15:00:33 UTC (rev 476) |
28 |
+++ trunk/modules/rc.eselect 2009-04-20 16:55:51 UTC (rev 477) |
29 |
@@ -205,9 +205,17 @@ |
30 |
### show action |
31 |
|
32 |
describe_show() { |
33 |
- echo "Show init script status for current runlevel" |
34 |
+ echo "Show init script status" |
35 |
} |
36 |
|
37 |
+describe_show_parameters() { |
38 |
+ echo "<runlevels>" |
39 |
+} |
40 |
+ |
41 |
+describe_show_options() { |
42 |
+ echo "runlevels : Runlevels to list (defaults to current runlevel)" |
43 |
+} |
44 |
+ |
45 |
do_show() { |
46 |
# subshell to avoid pollution of caller's environment |
47 |
( |
48 |
@@ -215,28 +223,36 @@ |
49 |
# functions.sh needs the bash builtin |
50 |
unset -f eval |
51 |
source_rc_functions |
52 |
- runlevel=$(get_runlevel) |
53 |
- write_list_start \ |
54 |
- "Status of init scripts in runlevel \"${runlevel}\"" |
55 |
- for script in $(find_scripts "${ROOT}/etc/runlevels/${runlevel}"); do |
56 |
- for x in stopping starting inactive started stopped; do |
57 |
- if service_${x} ${script}; then |
58 |
- case ${x} in |
59 |
- starting|inactive) |
60 |
- write_kv_list_entry ${script} \ |
61 |
- "$(highlight_warning [${x}])" |
62 |
- ;; |
63 |
- started) |
64 |
- write_kv_list_entry ${script} "$(highlight [${x}])" |
65 |
- ;; |
66 |
- *) |
67 |
- write_kv_list_entry ${script} [${x}] |
68 |
- ;; |
69 |
- esac |
70 |
- continue 2 |
71 |
- fi |
72 |
+ [[ -z $1 ]] && set - "$(get_runlevel)" |
73 |
+ |
74 |
+ for runlevel in "$@"; do |
75 |
+ [[ -d ${ROOT}/etc/runlevels/${runlevel} ]] \ |
76 |
+ || die -q "${runlevel} is no valid runlevel" |
77 |
+ |
78 |
+ write_list_start \ |
79 |
+ "Status of init scripts in runlevel \"${runlevel}\"" |
80 |
+ for script in $(find_scripts "${ROOT}/etc/runlevels/${runlevel}") |
81 |
+ do |
82 |
+ status=unknown |
83 |
+ for x in stopping starting inactive started stopped; do |
84 |
+ if service_${x} ${script}; then |
85 |
+ status=${x} |
86 |
+ break |
87 |
+ fi |
88 |
+ done |
89 |
+ case ${status} in |
90 |
+ starting|inactive|unknown) |
91 |
+ write_kv_list_entry \ |
92 |
+ ${script} "$(highlight_warning [${x}])" |
93 |
+ ;; |
94 |
+ started) |
95 |
+ write_kv_list_entry ${script} "$(highlight [${x}])" |
96 |
+ ;; |
97 |
+ *) |
98 |
+ write_kv_list_entry ${script} [${x}] |
99 |
+ ;; |
100 |
+ esac |
101 |
done |
102 |
- write_kv_list_entry ${script} "$(highlight_warning [unknown])" |
103 |
done |
104 |
) |
105 |
} |