Gentoo Archives: gentoo-commits

From: "Ulrich Mueller (ulm)" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] eselect r482 - in trunk: . modules
Date: Tue, 21 Apr 2009 07:05:41
Message-Id: E1Lw9uR-0005T7-5L@stork.gentoo.org
1 Author: ulm
2 Date: 2009-04-21 06:56:46 +0000 (Tue, 21 Apr 2009)
3 New Revision: 482
4
5 Modified:
6 trunk/ChangeLog
7 trunk/modules/rc.eselect
8 Log:
9 Add --all option to show action of rc module.
10
11 Modified: trunk/ChangeLog
12 ===================================================================
13 --- trunk/ChangeLog 2009-04-20 21:16:26 UTC (rev 481)
14 +++ trunk/ChangeLog 2009-04-21 06:56:46 UTC (rev 482)
15 @@ -1,3 +1,8 @@
16 +2009-04-21 Ulrich Mueller <ulm@g.o>
17 +
18 + * modules/rc.eselect (do_show): Add --all option.
19 + (describe_show_options): Document it.
20 +
21 2009-04-20 Ulrich Mueller <ulm@g.o>
22
23 * libs/tests.bash.in (has): Quote $@ in order to expand positional
24
25 Modified: trunk/modules/rc.eselect
26 ===================================================================
27 --- trunk/modules/rc.eselect 2009-04-20 21:16:26 UTC (rev 481)
28 +++ trunk/modules/rc.eselect 2009-04-21 06:56:46 UTC (rev 482)
29 @@ -215,6 +215,7 @@
30
31 describe_show_options() {
32 echo "runlevels : Runlevels to list (defaults to current runlevel)"
33 + echo "--all : List all runlevels"
34 }
35
36 do_show() {
37 @@ -224,14 +225,23 @@
38 # functions.sh needs the bash builtin
39 unset -f eval
40 source_rc_functions
41 - [[ $# -eq 0 ]] && set - "$(get_runlevel)"
42
43 + if [[ $# -eq 0 ]]; then
44 + set - "$(get_runlevel)"
45 + elif [[ $1 = --all ]]; then
46 + for x in "${ROOT}"/etc/runlevels/*; do
47 + [[ -d "${x}" ]] && runlevels=("${runlevels[@]}" "${x##*/}")
48 + done
49 + set - "${runlevels[@]}"
50 + fi
51 +
52 for runlevel in "$@"; do
53 [[ -n ${runlevel} && -d ${ROOT}/etc/runlevels/${runlevel} ]] \
54 || die -q "\"${runlevel}\" is no valid runlevel"
55
56 write_list_start \
57 "Status of init scripts in runlevel \"${runlevel}\""
58 + n=0
59 for script in $(find_scripts "${ROOT}/etc/runlevels/${runlevel}")
60 do
61 status=unknown
62 @@ -253,7 +263,9 @@
63 write_kv_list_entry ${script} [${x}]
64 ;;
65 esac
66 + ((n++))
67 done
68 + [[ ${n} -eq 0 ]] && write_kv_list_entry "(none found)" ""
69 done
70 )
71 }