2019-02-08 04:38:12 +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
|
|
|
|
2015-12-05 04:22:19 +05:30
|
|
|
# Copyright (c) 2007-2015 The OpenRC Authors.
|
|
|
|
# See the Authors file at the top-level directory of this distribution and
|
|
|
|
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
|
|
|
#
|
|
|
|
# This file is part of OpenRC. It is subject to the license terms in
|
|
|
|
# the LICENSE file found in the top-level directory of this
|
|
|
|
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
|
|
|
# This file may not be copied, modified, propagated, or distributed
|
|
|
|
# except according to the terms contained in the LICENSE file.
|
2007-11-14 20:52:04 +05:30
|
|
|
|
2012-04-26 23:26:44 +05:30
|
|
|
. @LIBEXECDIR@/sh/functions.sh
|
2010-02-21 03:18:06 +05:30
|
|
|
. @LIBEXECDIR@/sh/rc-functions.sh
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-08-15 20:19:41 +05:30
|
|
|
config() {
|
2009-04-27 02:43:26 +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() {
|
2009-04-27 02:43:26 +05:30
|
|
|
[ -n "$*" ] && echo "$RC_SVCNAME ineed $*" >&3
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
use() {
|
2009-04-27 02:43:26 +05:30
|
|
|
[ -n "$*" ] && echo "$RC_SVCNAME iuse $*" >&3
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
2015-10-27 00:50:58 +05:30
|
|
|
want() {
|
|
|
|
[ -n "$*" ] && echo "$RC_SVCNAME iwant $*" >&3
|
|
|
|
}
|
2007-04-05 16:48:42 +05:30
|
|
|
before() {
|
2009-04-27 02:43:26 +05:30
|
|
|
[ -n "$*" ] && echo "$RC_SVCNAME ibefore $*" >&3
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
after() {
|
2009-04-27 02:43:26 +05:30
|
|
|
[ -n "$*" ] && echo "$RC_SVCNAME iafter $*" >&3
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
provide() {
|
2009-04-27 02:43:26 +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() {
|
2015-12-04 01:39:38 +05:30
|
|
|
local c x
|
|
|
|
set -- $*
|
|
|
|
while [ -n "$*" ]; do
|
|
|
|
case "$1" in
|
|
|
|
-containers) x="$(_get_containers)" ;;
|
|
|
|
!-containers) x="$(_get_containers_remove)" ;;
|
|
|
|
*) x=$1 ;;
|
|
|
|
esac
|
|
|
|
c="${c}${x} "
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
[ -n "$c" ] && echo "$RC_SVCNAME keyword $c" >&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-26 00:03:45 +05:30
|
|
|
@SYSCONFDIR@/init.d \
|
|
|
|
@PKG_PREFIX@/etc/init.d \
|
|
|
|
@LOCAL_PREFIX@/etc/init.d
|
2008-03-03 16:03:42 +05:30
|
|
|
do
|
2009-04-27 02:43:26 +05:30
|
|
|
[ -d "$_dir" ] || continue
|
2008-03-03 16:03:42 +05:30
|
|
|
|
|
|
|
# Don't do the same dir twice
|
2009-04-27 02:43:26 +05:30
|
|
|
for _d in $_done_dirs; do
|
|
|
|
[ "$_d" = "$_dir" ] && continue 2
|
2008-03-03 16:03:42 +05:30
|
|
|
done
|
|
|
|
unset _d
|
2009-04-27 02:43:26 +05:30
|
|
|
_done_dirs="$_done_dirs $_dir"
|
2008-03-03 16:03:42 +05:30
|
|
|
|
2009-04-27 02:43:26 +05:30
|
|
|
cd "$_dir"
|
2008-03-20 01:27:24 +05:30
|
|
|
for RC_SERVICE in *; do
|
2009-04-27 02:43:26 +05:30
|
|
|
[ -x "$RC_SERVICE" -a -f "$RC_SERVICE" ] || continue
|
2007-08-31 21:51:19 +05:30
|
|
|
|
2013-12-22 02:21:11 +05:30
|
|
|
# Only generate dependencies for OpenRC scripts
|
2009-04-27 02:43:26 +05:30
|
|
|
read one two three <"$RC_SERVICE"
|
2017-03-23 23:47:11 +05:30
|
|
|
case "$one" in
|
|
|
|
\#*/openrc-run) ;;
|
|
|
|
\#*/runscript) ;;
|
|
|
|
\#!)
|
|
|
|
case "$two" in
|
|
|
|
*/openrc-run) ;;
|
|
|
|
*/runscript) ;;
|
|
|
|
*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
2008-05-01 20:48:34 +05:30
|
|
|
unset one two three
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2012-11-07 05:52:33 +05:30
|
|
|
RC_SVCNAME=${RC_SERVICE##*/} ; export RC_SVCNAME
|
2008-03-20 01:27:24 +05:30
|
|
|
|
|
|
|
# Compat
|
2012-11-07 05:52:33 +05:30
|
|
|
SVCNAME=$RC_SVCNAME ; export SVCNAME
|
2008-03-20 01:27:24 +05:30
|
|
|
|
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%%.*}
|
2009-04-27 02:43:26 +05:30
|
|
|
if [ -n "$_rc_c" -a "$_rc_c" != "$RC_SVCNAME" ]; then
|
|
|
|
if [ -e "$_dir/../conf.d/$_rc_c" ]; then
|
|
|
|
. "$_dir/../conf.d/$_rc_c"
|
2008-01-11 17:43:46 +05:30
|
|
|
fi
|
2007-12-14 17:54:16 +05:30
|
|
|
fi
|
|
|
|
unset _rc_c
|
2007-05-03 13:38:59 +05:30
|
|
|
|
2009-04-27 02:43:26 +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-26 00:03:45 +05:30
|
|
|
[ -e @SYSCONFDIR@/rc.conf ] && . @SYSCONFDIR@/rc.conf
|
2015-12-10 00:08:10 +05:30
|
|
|
if [ -d "@SYSCONFDIR@/rc.conf.d" ]; then
|
|
|
|
for _f in "@SYSCONFDIR@"/rc.conf.d/*.conf; do
|
|
|
|
[ -e "$_f" ] && . "$_f"
|
|
|
|
done
|
|
|
|
fi
|
2008-01-02 21:12:52 +05:30
|
|
|
|
2009-04-27 02:43:26 +05:30
|
|
|
if . "$_dir/$RC_SVCNAME"; then
|
|
|
|
echo "$RC_SVCNAME" >&3
|
2010-02-21 03:18:06 +05:30
|
|
|
_depend
|
2007-12-14 17:54:16 +05:30
|
|
|
fi
|
|
|
|
)
|
|
|
|
done
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|