net: net.lo, lots of scripts

The program function in depend blocks is now able to search paths by
itself. If passed multiple arguments or multiple calls, at least one of
the arguments passed must be a program or a shell builtin (eg ip built
into busybox). If a qualified path is specified, only that path will be
checked, otherwise it will be checked as a builtin, then $PATH will be
checked for the named binary (via type).

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Robin H. Johnson
2012-01-08 16:24:03 -08:00
parent d02d3af02e
commit 4255ba175b
10 changed files with 36 additions and 42 deletions

View File

@@ -1,19 +1,10 @@
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
_br2684ctl()
{
if [ -x /usr/sbin/br2684ctl ]; then
echo /usr/sbin/br2684ctl
else
echo /sbin/br2684ctl
fi
}
br2684ctl_depend()
{
before ppp
program start $(_br2684ctl)
program start br2684ctl
}
_config_vars="$_config_vars bridge bridge_add brctl"
@@ -42,7 +33,7 @@ br2684ctl_pre_start()
esac
einfo "Starting RFC 2684 Bridge control on ${IFACE}"
start-stop-daemon --start --exec $(_br2684ctl) --background \
start-stop-daemon --start --exec $(_which br2684ctl) --background \
--make-pidfile --pidfile "/var/run/br2684ctl-${IFACE}.pid" \
-- -c "${IFACE#nas*}" ${opts}
eend $?

View File

@@ -4,7 +4,7 @@
bridge_depend()
{
before interface macnet
program /sbin/brctl
program brctl
}
_config_vars="$_config_vars bridge bridge_add brctl"

View File

@@ -3,10 +3,7 @@
ethtool_depend()
{
local x
x=$(_which ethtool)
[ -z "$x" ] && return 1
program $x
program ethtool
before interface
}

View File

@@ -6,6 +6,7 @@ _config_vars="$_config_vars link suffix relay"
ip6to4_depend()
{
after interface
program ip
}
ip6to4_pre_start()

View File

@@ -3,10 +3,7 @@
iproute2_depend()
{
local x
x=$(_which ip)
[ -z "$x" ] && return 1
program $x
program ip
provide interface
after ifconfig
}

View File

@@ -4,6 +4,7 @@
macchanger_depend()
{
before macnet
# no program 'macchanger', as we have partial functionality without it
}
_config_vars="$_config_vars mac"

View File

@@ -5,10 +5,7 @@
macvlan_depend()
{
local x
x=$(_which ip)
[ -z "${X}" ] && return 1
program $x
program ip
after interface
before dhcp macchanger
}

View File

@@ -4,6 +4,7 @@
tuntap_depend()
{
before bridge interface macchanger
program ip openvpn tunctl
}
_config_vars="$_config_vars iproute2 openvpn tunctl"

View File

@@ -3,10 +3,7 @@
vlan_depend()
{
local x
x=$(_which ip)
[ -z "$x" ] && return 1
program $x
program ip
after interface
before dhcp
}