aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.d/net.lo.in40
-rw-r--r--net/br2684ctl.sh13
-rw-r--r--net/bridge.sh2
-rw-r--r--net/ethtool.sh5
-rw-r--r--net/ip6to4.sh1
-rw-r--r--net/iproute2.sh5
-rw-r--r--net/macchanger.sh1
-rw-r--r--net/macvlan.sh5
-rw-r--r--net/tuntap.sh1
-rw-r--r--net/vlan.sh5
10 files changed, 36 insertions, 42 deletions
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index de393bd1..29135614 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -172,7 +172,9 @@ _configure_variables()
_which()
{
local i OIFS
+ # Empty
[ -z "$1" ] && return
+ # check paths
OIFS="$IFS"
IFS=:
for i in $PATH ; do
@@ -181,6 +183,22 @@ _which()
IFS=$OIFS
}
+# Like _which, but also consider shell builtins, and multiple alternatives
+_program_available()
+{
+ [ -z "$1" ] && return 0
+ local x=
+ for x; do
+ case "${x}" in
+ /*) [ -x "${x}" ] && break;;
+ *) type "${x}" >/dev/null 2>&1 && break;;
+ esac
+ unset x
+ done
+ [ -n "${x}" ] && echo $x && return 0
+ return 1
+}
+
_show_address()
{
einfo "received address $(_get_inet_address "${IFACE}")"
@@ -323,11 +341,10 @@ _load_modules()
eval set -- \$module_${i}_program
if [ -n "$1" ]; then
- x=
- for x; do
- [ -x "${x}" ] && break
- done
- [ -x "${x}" ] || continue
+ if ! _program_available "$@" >/dev/null; then
+ vewarn "Skipping module $mod due to missing program: $@"
+ continue
+ fi
fi
if ${starting}; then
eval set -- \$module_${i}_program_start
@@ -335,15 +352,10 @@ _load_modules()
eval set -- \$module_${i}_program_stop
fi
if [ -n "$1" ]; then
- x=
- for x; do
- case "${x}" in
- /*) [ -x "${x}" ] && break;;
- *) type "${x}" >/dev/null 2>&1 && break;;
- esac
- unset x
- done
- [ -n "${x}" ] || continue
+ if ! _program_available "$@" >/dev/null; then
+ vewarn "Skipping module $mod due to missing program: $@"
+ continue
+ fi
fi
eval provides=\$module_${i}_provide
diff --git a/net/br2684ctl.sh b/net/br2684ctl.sh
index d6055796..b3f61196 100644
--- a/net/br2684ctl.sh
+++ b/net/br2684ctl.sh
@@ -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 $?
diff --git a/net/bridge.sh b/net/bridge.sh
index 7b80ec0a..4f3618aa 100644
--- a/net/bridge.sh
+++ b/net/bridge.sh
@@ -4,7 +4,7 @@
bridge_depend()
{
before interface macnet
- program /sbin/brctl
+ program brctl
}
_config_vars="$_config_vars bridge bridge_add brctl"
diff --git a/net/ethtool.sh b/net/ethtool.sh
index ba5719d1..4e104092 100644
--- a/net/ethtool.sh
+++ b/net/ethtool.sh
@@ -3,10 +3,7 @@
ethtool_depend()
{
- local x
- x=$(_which ethtool)
- [ -z "$x" ] && return 1
- program $x
+ program ethtool
before interface
}
diff --git a/net/ip6to4.sh b/net/ip6to4.sh
index 959a2a0b..51b38581 100644
--- a/net/ip6to4.sh
+++ b/net/ip6to4.sh
@@ -6,6 +6,7 @@ _config_vars="$_config_vars link suffix relay"
ip6to4_depend()
{
after interface
+ program ip
}
ip6to4_pre_start()
diff --git a/net/iproute2.sh b/net/iproute2.sh
index 16d9a604..9b89352c 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -3,10 +3,7 @@
iproute2_depend()
{
- local x
- x=$(_which ip)
- [ -z "$x" ] && return 1
- program $x
+ program ip
provide interface
after ifconfig
}
diff --git a/net/macchanger.sh b/net/macchanger.sh
index ad413090..4e535ec3 100644
--- a/net/macchanger.sh
+++ b/net/macchanger.sh
@@ -4,6 +4,7 @@
macchanger_depend()
{
before macnet
+ # no program 'macchanger', as we have partial functionality without it
}
_config_vars="$_config_vars mac"
diff --git a/net/macvlan.sh b/net/macvlan.sh
index ccb28ea7..86a659c4 100644
--- a/net/macvlan.sh
+++ b/net/macvlan.sh
@@ -5,10 +5,7 @@
macvlan_depend()
{
- local x
- x=$(_which ip)
- [ -z "${X}" ] && return 1
- program $x
+ program ip
after interface
before dhcp macchanger
}
diff --git a/net/tuntap.sh b/net/tuntap.sh
index 679b0978..d0f24c58 100644
--- a/net/tuntap.sh
+++ b/net/tuntap.sh
@@ -4,6 +4,7 @@
tuntap_depend()
{
before bridge interface macchanger
+ program ip openvpn tunctl
}
_config_vars="$_config_vars iproute2 openvpn tunctl"
diff --git a/net/vlan.sh b/net/vlan.sh
index ec30dd65..ff63dfd0 100644
--- a/net/vlan.sh
+++ b/net/vlan.sh
@@ -3,10 +3,7 @@
vlan_depend()
{
- local x
- x=$(_which ip)
- [ -z "$x" ] && return 1
- program $x
+ program ip
after interface
before dhcp
}