From 07861410268960e2ba432bf56f4fc6369e83f593 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 10 Nov 2008 12:31:20 +0000 Subject: Restore interface_exists, interface_up and interface_exists, #123. --- init.d/net.lo.in | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'init.d/net.lo.in') diff --git a/init.d/net.lo.in b/init.d/net.lo.in index 583c8958..6ca87098 100644 --- a/init.d/net.lo.in +++ b/init.d/net.lo.in @@ -445,6 +445,35 @@ _load_config() config_index=-1 } +# Support functions +_run_if() +{ + local cmd=$1 iface=$2 ifr=${IFACE} ifv=${IFVAR} + # Ensure that we don't stamp on real values + local IFACE= IFVAR= + shift + if [ -n "${iface}" ]; then + IFACE="${iface}" + [ "${iface}" != "${ifr}" ] && IFVAR=$(shell_var "${IFACE}") + else + IFACE=${ifr} + IFVAR=${ifv} + fi + ${cmd} +} +interface_exists() +{ + _run_if _exists "$@" +} +interface_up() +{ + _run_if _up "$@" +} +interface_down() +{ + _run_if _down "$@" +} + start() { local IFACE=${RC_SVCNAME#*.} oneworked=false module= -- cgit v1.2.3