diff options
Diffstat (limited to 'sh')
-rwxr-xr-x | sh/net.sh | 2 | ||||
-rwxr-xr-x | sh/rc-help.sh | 10 | ||||
-rwxr-xr-x | sh/runscript.sh | 21 |
3 files changed, 26 insertions, 7 deletions
@@ -8,6 +8,8 @@ _config_vars="config routes" [ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND=false +description="Configures network interfaces." + depend() { local IFACE=${SVCNAME#*.} local IFVAR=$(echo -n "${IFACE}" | sed -e 's/[^[:alnum:]]/_/g') diff --git a/sh/rc-help.sh b/sh/rc-help.sh index 97ca53f4..8edbb8ef 100755 --- a/sh/rc-help.sh +++ b/sh/rc-help.sh @@ -32,7 +32,7 @@ else NL= fi -default_opts="start stop restart pause zap" +default_opts="describe start stop restart pause zap" extra_opts="$(. "${myscript}" 2>/dev/null ; echo "${opts}")" if [ "${BE_VERBOSE}" = "yes" ] ; then @@ -48,6 +48,9 @@ ${CYAN}Normal Options:${OFF}" if [ "${BE_VERBOSE}" = "yes" ] ; then printf " + ${GREEN}describe${OFF} + Describe what the service and any extra options do. + ${GREEN}start${OFF} Start service, as well as the services it depends on (if not already started). @@ -68,11 +71,6 @@ printf " ${GREEN}conditionalrestart|condrestart${OFF} Same as 'restart', but only if the service has already been started. - ${GREEN}pause${OFF} - Same as 'stop', but the services that depends on it, will not be - stopped. This is useful for stopping a network interface without - stopping all the network services that depend on 'net'. - ${GREEN}zap${OFF} Reset a service that is currently stopped, but still marked as started, to the stopped state. Basically for killing zombie services. diff --git a/sh/runscript.sh b/sh/runscript.sh index 6b679c21..1520db42 100755 --- a/sh/runscript.sh +++ b/sh/runscript.sh @@ -17,6 +17,25 @@ if [ -z "$1" -o -z "$2" ] ; then exit 1 fi +# Descript the init script to the user +describe() { + if [ -n "${description}" ] ; then + einfo "${description}" + else + ewarn "No description for ${SVCNAME}" + fi + + local svc= desc= + for svc in ${opts} ; do + eval desc=\$description_${svc} + if [ -n "${desc}" ] ; then + einfo "${HILITE}${svc}${NORMAL}: ${desc}" + else + ewarn "${HILITE}${svc}${NORMAL}: no description" + fi + done +} + [ "${RC_DEBUG}" = "yes" ] && set -x # If we're net.eth0 or openvpn.work then load net or openvpn config @@ -50,7 +69,7 @@ shift while [ -n "$1" ] ; do # See if we have the required function and run it - for rc_x in start stop ${opts} ; do + for rc_x in describe start stop ${opts} ; do if [ "${rc_x}" = "$1" ] ; then if type "$1" >/dev/null 2>/dev/null ; then unset rc_x |