diff options
author | Roy Marples <roy@marples.name> | 2008-04-18 23:00:43 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-04-18 23:00:43 +0000 |
commit | e96347523f7bfa7da55c34c34af6dcdedd939ba9 (patch) | |
tree | 181b118e8ad7640d6c6ffe33263d401657b8b3d1 /sh/runscript.sh.in | |
parent | f0aacec02eb04f1843cc5c729fd5510c2342660c (diff) |
We should check type output to ensure that we're really calling a shell function and not some badly named binary like stop from boinc, Gentoo #218063.
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 4492888b..a45e41d1 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 ! type start >/dev/null 2>&1; then + if ! is_function 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 ! type stop >/dev/null 2>&1; then + if ! is_function 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 type "$1" >/dev/null 2>&1; then + if is_function "$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 type "$1"_pre >/dev/null 2>&1; then + if is_function "$1"_pre >/dev/null 2>&1; then "$1"_pre || exit $? fi "$1" || exit $? - if type "$1"_post >/dev/null 2>&1; then + if is_function "$1"_post >/dev/null 2>&1; then "$1"_post || exit $? fi shift |