diff options
author | Ulrich Müller <ulm@gentoo.org> | 2009-04-21 06:56:46 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2009-04-21 06:56:46 +0000 |
commit | fac3b5674b1c5bb54abc7d5816a2352f3e19a893 (patch) | |
tree | 1a212d8c521368f5e6e405d5ff9d9eef5ca14574 /modules/rc.eselect | |
parent | Fix expansion of positional parameters in has(). (diff) | |
download | eselect-fac3b5674b1c5bb54abc7d5816a2352f3e19a893.tar.gz eselect-fac3b5674b1c5bb54abc7d5816a2352f3e19a893.tar.bz2 eselect-fac3b5674b1c5bb54abc7d5816a2352f3e19a893.zip |
Add --all option to show action of rc module.
svn path=/trunk/; revision=482
Diffstat (limited to 'modules/rc.eselect')
-rw-r--r-- | modules/rc.eselect | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/rc.eselect b/modules/rc.eselect index d743e18..e7c19cd 100644 --- a/modules/rc.eselect +++ b/modules/rc.eselect @@ -215,6 +215,7 @@ describe_show_parameters() { describe_show_options() { echo "runlevels : Runlevels to list (defaults to current runlevel)" + echo "--all : List all runlevels" } do_show() { @@ -224,7 +225,15 @@ do_show() { # functions.sh needs the bash builtin unset -f eval source_rc_functions - [[ $# -eq 0 ]] && set - "$(get_runlevel)" + + if [[ $# -eq 0 ]]; then + set - "$(get_runlevel)" + elif [[ $1 = --all ]]; then + for x in "${ROOT}"/etc/runlevels/*; do + [[ -d "${x}" ]] && runlevels=("${runlevels[@]}" "${x##*/}") + done + set - "${runlevels[@]}" + fi for runlevel in "$@"; do [[ -n ${runlevel} && -d ${ROOT}/etc/runlevels/${runlevel} ]] \ @@ -232,6 +241,7 @@ do_show() { write_list_start \ "Status of init scripts in runlevel \"${runlevel}\"" + n=0 for script in $(find_scripts "${ROOT}/etc/runlevels/${runlevel}") do status=unknown @@ -253,7 +263,9 @@ do_show() { write_kv_list_entry ${script} [${x}] ;; esac + ((n++)) done + [[ ${n} -eq 0 ]] && write_kv_list_entry "(none found)" "" done ) } |