diff options
author | Roy Marples <roy@marples.name> | 2008-04-21 17:32:17 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-04-21 17:32:17 +0000 |
commit | df8eeba2fb5b0dc460b5f6aac5dafc380e17242e (patch) | |
tree | b45e915b1a7a1be69b75a118b7ea677cc469c996 /sh/runscript.sh.in | |
parent | 54fce42c6f1ef8f834f5878b35e9dcab0cfe0b08 (diff) | |
download | openrc-df8eeba2fb5b0dc460b5f6aac5dafc380e17242e.tar.gz openrc-df8eeba2fb5b0dc460b5f6aac5dafc380e17242e.tar.bz2 openrc-df8eeba2fb5b0dc460b5f6aac5dafc380e17242e.tar.xz |
Punt is_function in favour of POSIX shell builtin command, thanks to Harald van Dijk for the idea.
Diffstat (limited to 'sh/runscript.sh.in')
-rw-r--r-- | sh/runscript.sh.in | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index a45e41d..33804bc 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -94,7 +94,7 @@ unset _f # If we have a default command then supply a default start function if [ -n "${command}" ]; then - if ! is_function start; then + if ! [ "$(command -v start)" != "start" ]; then start() { local _background= ebegin "Starting ${name:-${RC_SVCNAME}}" @@ -126,7 +126,7 @@ fi # If we have a default command, procname or pidfile then supply a default stop # function if [ -n "${command}" -o -n "${procname}" -o -n "${pidfile}" ]; then - if ! is_function stop; then + if ! [ "$(command -v stop)" != "stop" ]; then stop() { ebegin "Stopping ${name:-${RC_SVCNAME}}" start-stop-daemon --stop \ @@ -143,7 +143,7 @@ while [ -n "$1" ]; do for _cmd in describe start stop ${extra_commands:-${opts}} \ ${extra_started_commands}; do if [ "${_cmd}" = "$1" ]; then - if is_function "$1"; then + if [ "$(command -v "$1")" = "$1" ]; then # If we're in the background, we may wish to # fake some commands. We do this so we can # "start" ourselves from inactive which then @@ -168,11 +168,11 @@ while [ -n "$1" ]; do fi done unset _cmd - if is_function "$1"_pre >/dev/null 2>&1; then + if [ "$(command -v "$1_pre")" = "$1_pre" ]; then "$1"_pre || exit $? fi "$1" || exit $? - if is_function "$1"_post >/dev/null 2>&1; then + if [ "$(command -v "$1_post")" = "$1_post" ]; then "$1"_post || exit $? fi shift |