2008-02-28 01:59:32 +05:30
|
|
|
#!@SHELL@
|
2007-04-05 16:48:42 +05:30
|
|
|
# Shell wrapper to list our dependencies
|
2007-11-14 20:52:04 +05:30
|
|
|
|
2008-01-11 21:01:10 +05:30
|
|
|
# Copyright 2007-2008 Roy Marples <roy@marples.name>
|
|
|
|
# All rights reserved. Released under the 2-clause BSD license.
|
2007-11-14 20:52:04 +05:30
|
|
|
|
2008-03-05 17:57:11 +05:30
|
|
|
. @PREFIX@/@SYSCONFDIR@/init.d/functions.sh
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-08-15 20:19:41 +05:30
|
|
|
config() {
|
2008-03-20 01:27:24 +05:30
|
|
|
[ -n "$*" ] && echo "${RC_SVCNAME} config $*" >&3
|
2007-08-15 20:19:41 +05:30
|
|
|
}
|
2007-04-05 16:48:42 +05:30
|
|
|
need() {
|
2008-03-20 01:27:24 +05:30
|
|
|
[ -n "$*" ] && echo "${RC_SVCNAME} ineed $*" >&3
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
use() {
|
2008-03-20 01:27:24 +05:30
|
|
|
[ -n "$*" ] && echo "${RC_SVCNAME} iuse $*" >&3
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
before() {
|
2008-03-20 01:27:24 +05:30
|
|
|
[ -n "$*" ] && echo "${RC_SVCNAME} ibefore $*" >&3
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
after() {
|
2008-03-20 01:27:24 +05:30
|
|
|
[ -n "$*" ] && echo "${RC_SVCNAME} iafter $*" >&3
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
provide() {
|
2008-03-20 01:27:24 +05:30
|
|
|
[ -n "$*" ] && echo "${RC_SVCNAME} iprovide $*" >&3
|
2007-12-05 23:18:07 +05:30
|
|
|
}
|
2008-02-19 20:06:22 +05:30
|
|
|
keyword() {
|
2008-03-20 01:27:24 +05:30
|
|
|
[ -n "$*" ] && echo "${RC_SVCNAME} keyword $*" >&3
|
2007-12-05 23:18:07 +05:30
|
|
|
}
|
2007-04-05 16:48:42 +05:30
|
|
|
depend() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
2008-03-03 16:03:42 +05:30
|
|
|
_done_dirs=
|
|
|
|
for _dir in \
|
2008-03-05 17:57:11 +05:30
|
|
|
@PREFIX@/@SYSCONFDIR@/init.d \
|
|
|
|
@PKG_PREFIX@/@SYSCONFDIR@/init.d \
|
|
|
|
@LOCAL_PREFIX@/@SYSCONFDIR@/init.d
|
2008-03-03 16:03:42 +05:30
|
|
|
do
|
2007-12-14 17:54:16 +05:30
|
|
|
[ -d "${_dir}" ] || continue
|
2008-03-03 16:03:42 +05:30
|
|
|
|
|
|
|
# Don't do the same dir twice
|
|
|
|
for _d in ${_done_dirs}; do
|
|
|
|
[ "${_d}" = "${_dir}" ] && continue 2
|
|
|
|
done
|
|
|
|
unset _d
|
|
|
|
_done_dirs="${_done_dirs} ${_dir}"
|
|
|
|
|
2007-12-14 17:54:16 +05:30
|
|
|
cd "${_dir}"
|
2008-03-20 01:27:24 +05:30
|
|
|
for RC_SERVICE in *; do
|
|
|
|
[ -x "${RC_SERVICE}" ] || continue
|
2007-08-31 21:51:19 +05:30
|
|
|
|
2007-12-14 17:54:16 +05:30
|
|
|
# Only generate dependencies for runscripts
|
2008-03-20 01:27:24 +05:30
|
|
|
read one two < "${RC_SERVICE}"
|
2008-03-03 02:44:01 +05:30
|
|
|
[ "${one}" = "#!@PREFIX@/sbin/runscript" ] || continue
|
2007-12-14 17:54:16 +05:30
|
|
|
unset one two
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2008-03-20 01:27:24 +05:30
|
|
|
export RC_SVCNAME=${RC_SERVICE##*/}
|
|
|
|
|
|
|
|
# Compat
|
|
|
|
export SVCNAME=${RC_SVCNAME}
|
|
|
|
|
2007-12-14 17:54:16 +05:30
|
|
|
(
|
|
|
|
# Save stdout in fd3, then remap it to stderr
|
|
|
|
exec 3>&1 1>&2
|
2007-07-22 16:15:56 +05:30
|
|
|
|
2008-03-20 01:27:24 +05:30
|
|
|
_rc_c=${RC_SVCNAME%%.*}
|
|
|
|
if [ -n "${_rc_c}" -a "${_rc_c}" != "${RC_SVCNAME}" ]; then
|
2008-01-11 17:43:46 +05:30
|
|
|
if [ -e "${_dir}/../conf.d/${_rc_c}" ]; then
|
|
|
|
. "${_dir}/../conf.d/${_rc_c}"
|
|
|
|
fi
|
2007-12-14 17:54:16 +05:30
|
|
|
fi
|
|
|
|
unset _rc_c
|
2007-05-03 13:38:59 +05:30
|
|
|
|
2008-03-20 01:27:24 +05:30
|
|
|
if [ -e "${_dir}/../conf.d/${RC_SVCNAME}" ]; then
|
|
|
|
. "${_dir}/../conf.d/${RC_SVCNAME}"
|
2008-01-11 17:43:46 +05:30
|
|
|
fi
|
2007-07-22 16:58:38 +05:30
|
|
|
|
2008-03-05 17:57:11 +05:30
|
|
|
[ -e @PREFIX@/@SYSCONFDIR@/rc.conf ] && . @PREFIX@/@SYSCONFDIR@/rc.conf
|
2008-01-02 21:12:52 +05:30
|
|
|
|
2008-03-20 01:27:24 +05:30
|
|
|
if . "${_dir}/${RC_SVCNAME}"; then
|
|
|
|
echo "${RC_SVCNAME}" >&3
|
2007-12-14 17:54:16 +05:30
|
|
|
depend
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-12-14 17:54:16 +05:30
|
|
|
# Add any user defined depends
|
2008-03-10 17:03:39 +05:30
|
|
|
for _deptype in config:CONFIG need:NEED use:USE \
|
|
|
|
after:AFTER before:BEFORE \
|
|
|
|
provide:PROVIDE keyword:KEYWORD; do
|
|
|
|
IFS=:
|
|
|
|
set -- ${_deptype}
|
|
|
|
unset IFS
|
2008-03-20 01:27:24 +05:30
|
|
|
eval _depends=\$rc_$(shell_var "${RC_SVCNAME}")_$1
|
2008-03-10 17:03:39 +05:30
|
|
|
[ -z "${_depends}" ] && eval _depends=\$rc_$1
|
2008-03-20 01:27:24 +05:30
|
|
|
[ -z "${_depends}" ] && eval _depends=\$RC_$(shell_var "${RC_SVCNAME}")_$2
|
2008-03-10 17:03:39 +05:30
|
|
|
[ -z "${_depends}" ] && eval _depends=\$RC_$2
|
2008-03-08 20:52:29 +05:30
|
|
|
|
2008-03-10 17:03:39 +05:30
|
|
|
$1 ${_depends}
|
2008-03-08 20:52:29 +05:30
|
|
|
done
|
2007-12-14 17:54:16 +05:30
|
|
|
fi
|
|
|
|
)
|
|
|
|
done
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|