Fix rc_${rc_svcname}_need.

Display config depends in service depend function also.
This commit is contained in:
Roy Marples 2010-02-20 21:48:06 +00:00
parent c0f5f2122c
commit 5c52e5beb5
3 changed files with 30 additions and 19 deletions

View File

@ -5,6 +5,7 @@
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
. @SYSCONFDIR@/init.d/functions.sh . @SYSCONFDIR@/init.d/functions.sh
. @LIBEXECDIR@/sh/rc-functions.sh
config() { config() {
[ -n "$*" ] && echo "$RC_SVCNAME config $*" >&3 [ -n "$*" ] && echo "$RC_SVCNAME config $*" >&3
@ -82,24 +83,7 @@ do
if . "$_dir/$RC_SVCNAME"; then if . "$_dir/$RC_SVCNAME"; then
echo "$RC_SVCNAME" >&3 echo "$RC_SVCNAME" >&3
depend _depend
_rc_svcname=$(shell_var "$RC_SVCNAME")
# Add any user defined depends
for _deptype in config:CONFIG need:NEED use:USE \
after:AFTER before:BEFORE \
provide:PROVIDE keyword:KEYWORD; do
IFS=:
set -- $_deptype
unset IFS
eval _depends=\$rc_$_rc_svcname_$1
[ -z "$_depends" ] && eval _depends=\$rc_$1
[ -z "$_depends" ] && \
eval _depends=\$RC_$_rc_svcname_$2
[ -z "$_depends" ] && eval _depends=\$RC_$2
$1 ${_depends}
done
fi fi
) )
done done

View File

@ -84,6 +84,27 @@ get_bootparam()
return 1 return 1
} }
# Called from runscript.sh or gendepends.sh
_depend() {
depend
local _rc_svcname=$(shell_var "$RC_SVCNAME") _deptype= _depends=
# Add any user defined depends
for _deptype in config:CONFIG need:NEED use:USE \
after:AFTER before:BEFORE \
provide:PROVIDE keyword:KEYWORD; do
IFS=:
set -- $_deptype
unset IFS
eval _depends=\$rc_${_rc_svcname}_$1
[ -z "$_depends" ] && eval _depends=\$rc_$1
[ -z "$_depends" ] && eval _depends=\$RC_${_rc_svcname}_$2
[ -z "$_depends" ] && eval _depends=\$RC_$2
$1 $_depends
done
}
# Add our sbin to $PATH # Add our sbin to $PATH
case "$PATH" in case "$PATH" in
"$RC_LIBEXECDIR"/sbin|"$RC_LIBEXECDIR"/sbin:*);; "$RC_LIBEXECDIR"/sbin|"$RC_LIBEXECDIR"/sbin:*);;

View File

@ -187,8 +187,14 @@ done
unset _f unset _f
while [ -n "$1" ]; do while [ -n "$1" ]; do
# Sepcial case depend
if [ "$1" = depend ]; then
shift
_depend
continue
fi
# See if we have the required function and run it # See if we have the required function and run it
for _cmd in describe start stop status depend ${extra_commands:-$opts} \ for _cmd in describe start stop status ${extra_commands:-$opts} \
$extra_started_commands $extra_started_commands
do do
if [ "$_cmd" = "$1" ]; then if [ "$_cmd" = "$1" ]; then