Gentoo Archives: gentoo-commits

From: "Ulrich Mueller (ulm)" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] eselect r489 - in trunk: . modules
Date: Wed, 22 Apr 2009 06:35:42
Message-Id: E1LwW3X-0000aE-LJ@stork.gentoo.org
1 Author: ulm
2 Date: 2009-04-22 06:35:39 +0000 (Wed, 22 Apr 2009)
3 New Revision: 489
4
5 Modified:
6 trunk/ChangeLog
7 trunk/modules/rc.eselect
8 Log:
9 Remove unnecessary subshell.
10
11 Modified: trunk/ChangeLog
12 ===================================================================
13 --- trunk/ChangeLog 2009-04-22 06:23:38 UTC (rev 488)
14 +++ trunk/ChangeLog 2009-04-22 06:35:39 UTC (rev 489)
15 @@ -10,7 +10,8 @@
16
17 * modules/compiler.eselect.in: Remove dead module.
18
19 - * modules/rc.eselect (do_show): Add --all option.
20 + * modules/rc.eselect (do_show): Add --all option. No need for an
21 + extra subshell; do_action already calls us from one.
22 (describe_show_options): Document it.
23
24 2009-04-20 Ulrich Mueller <ulm@g.o>
25
26 Modified: trunk/modules/rc.eselect
27 ===================================================================
28 --- trunk/modules/rc.eselect 2009-04-22 06:23:38 UTC (rev 488)
29 +++ trunk/modules/rc.eselect 2009-04-22 06:35:39 UTC (rev 489)
30 @@ -219,55 +219,52 @@
31 }
32
33 do_show() {
34 - # subshell to avoid pollution of caller's environment
35 - (
36 - # core.bash redefines eval; unset it because OpenRC's
37 - # functions.sh needs the bash builtin
38 - unset -f eval
39 - source_rc_functions
40 + local runlevel status n x
41
42 - if [[ $# -eq 0 ]]; then
43 - set - "$(get_runlevel)"
44 - elif [[ $1 = --all ]]; then
45 - for x in "${ROOT}"/etc/runlevels/*; do
46 - [[ -d "${x}" ]] && runlevels=("${runlevels[@]}" "${x##*/}")
47 - done
48 - set - "${runlevels[@]}"
49 - fi
50 + # core.bash redefines eval; unset it because OpenRC's
51 + # functions.sh needs the bash builtin
52 + unset -f eval
53 + source_rc_functions
54
55 - for runlevel in "$@"; do
56 - [[ -n ${runlevel} && -d ${ROOT}/etc/runlevels/${runlevel} ]] \
57 - || die -q "\"${runlevel}\" is no valid runlevel"
58 + if [[ $# -eq 0 ]]; then
59 + set - "$(get_runlevel)"
60 + elif [[ $1 = --all ]]; then
61 + for x in "${ROOT}"/etc/runlevels/*; do
62 + [[ -d "${x}" ]] && runlevels=("${runlevels[@]}" "${x##*/}")
63 + done
64 + set - "${runlevels[@]}"
65 + fi
66
67 - write_list_start \
68 - "Status of init scripts in runlevel \"${runlevel}\""
69 - n=0
70 - for script in $(find_scripts "${ROOT}/etc/runlevels/${runlevel}")
71 - do
72 - status=unknown
73 - for x in stopping starting inactive started stopped; do
74 - if service_${x} ${script}; then
75 - status=${x}
76 - break
77 - fi
78 - done
79 - case ${status} in
80 - starting|inactive|unknown)
81 - write_kv_list_entry \
82 - ${script} "$(highlight_warning [${x}])"
83 - ;;
84 - started)
85 - write_kv_list_entry ${script} "$(highlight [${x}])"
86 - ;;
87 - *)
88 - write_kv_list_entry ${script} [${x}]
89 - ;;
90 - esac
91 - ((n++))
92 + for runlevel in "$@"; do
93 + [[ -n ${runlevel} && -d ${ROOT}/etc/runlevels/${runlevel} ]] \
94 + || die -q "\"${runlevel}\" is no valid runlevel"
95 +
96 + write_list_start \
97 + "Status of init scripts in runlevel \"${runlevel}\""
98 + n=0
99 + for script in $(find_scripts "${ROOT}/etc/runlevels/${runlevel}"); do
100 + status=unknown
101 + for x in stopping starting inactive started stopped; do
102 + if service_${x} ${script}; then
103 + status=${x}
104 + break
105 + fi
106 done
107 - [[ ${n} -eq 0 ]] && write_kv_list_entry "(none found)" ""
108 + case ${status} in
109 + starting|inactive|unknown)
110 + write_kv_list_entry ${script} "$(highlight_warning [${x}])"
111 + ;;
112 + started)
113 + write_kv_list_entry ${script} "$(highlight [${x}])"
114 + ;;
115 + *)
116 + write_kv_list_entry ${script} [${x}]
117 + ;;
118 + esac
119 + ((n++))
120 done
121 - )
122 + [[ ${n} -eq 0 ]] && write_kv_list_entry "(none found)" ""
123 + done
124 }
125
126 ### start action