summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-11-10 12:31:20 +0000
committerRoy Marples <roy@marples.name>2008-11-10 12:31:20 +0000
commit07861410268960e2ba432bf56f4fc6369e83f593 (patch)
treeebdaeb9808f7617bbda07328224715e5aa04001f
parent90d175ae278c9b27fec954abacbb5ddbb8c5fcc7 (diff)
downloadopenrc-07861410268960e2ba432bf56f4fc6369e83f593.tar.gz
openrc-07861410268960e2ba432bf56f4fc6369e83f593.tar.bz2
openrc-07861410268960e2ba432bf56f4fc6369e83f593.tar.xz
Restore interface_exists, interface_up and interface_exists, #123.
-rw-r--r--init.d/net.lo.in29
1 files changed, 29 insertions, 0 deletions
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 583c895..6ca8709 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=