From 0c75e888fcc71599f3a695ae54a7a0b1beb16f0f Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 30 Jan 2008 13:20:47 +0000 Subject: Allow rc_need to work with net scripts, and allow for loopback also. --- doc.Linux/net.example | 10 +++++----- sh/net.sh | 31 ++++++++++++++----------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/doc.Linux/net.example b/doc.Linux/net.example index 49e608e0..80d50479 100644 --- a/doc.Linux/net.example +++ b/doc.Linux/net.example @@ -559,7 +559,7 @@ #vlan_start_eth0="no" # If you do the above then you may want to depend on eth0 like so -# RC_NEED_vlan1="net.eth0" +# rc_need_vlan1="net.eth0" # NOTE: depend functions only work in /etc/conf.d/net # and not in profile configs such as /etc/conf.d/net.foo @@ -573,7 +573,7 @@ # If any of the slaves require extra configuration - for example wireless or # ppp devices - we need to depend function on the bonded interfaces -#RC_NEED_bond0="net.eth0 net.eth1" +#rc_need_bond0="net.eth0 net.eth1" #----------------------------------------------------------------------------- @@ -690,7 +690,7 @@ # If the link require extra configuration - for example wireless or # RFC 268 bridge - we need to depend on the bridge so they get # configured correctly. -#RC_NEED_ppp0="net.nas0" +#rc_need_ppp0="net.nas0" #WARNING: if MTU of the PPP interface is less than 1500 and you use this #machine as a router, you should add the following rule to your firewall @@ -792,7 +792,7 @@ # If any of the ports require extra configuration - for example wireless or # ppp devices - we need to depend on them like so. -#RC_NEED_br0="net.eth0 net.eth1" +#rc_need_br0="net.eth0 net.eth1" # Below is an example of configuring the bridge # Consult "man brctl" for more details @@ -836,7 +836,7 @@ # link_6to4="eth0" # Interface to base it's addresses on # config_6to4="ip6to4" # You may want to depend on eth0 like so -#RC_NEED_6to4="net.eth0" +#rc_need_6to4="net.eth0" # To ensure that eth0 is configured before 6to4. Of course, the tunnel could be # any name and this also works for any configured interface. # NOTE: If you're not using iproute2 then your 6to4 tunnel has to be called diff --git a/sh/net.sh b/sh/net.sh index 7a304363..4b4469c9 100755 --- a/sh/net.sh +++ b/sh/net.sh @@ -21,26 +21,23 @@ depend() need localmount after bootmisc provide net + case "${IFACE}" in lo|lo0);; - *) - after net.lo net.lo0 - if type depend_${IFVAR} >/dev/null 2>&1; then - depend_${IFVAR} - fi - local prov= - eval prov=\$RC_NEED_${IFVAR} - [ -n "${prov}" ] && need ${prov} - eval prov=\$RC_USE_${IFVAR} - [ -n "${prov}" ] && use ${prov} - eval prov=\$RC_BEFORE_${IFVAR} - [ -n "${prov}" ] && before ${prov} - eval prov=\$RC_AFTER_${IFVAR} - [ -n "${prov}" ] && after ${prov} - eval prov=\$RC_PROVIDE_${IFVAR} - [ -n "${prov}" ] && provide ${prov} - ;; + *) after net.lo net.lo0;; esac + + if type depend_${IFVAR} >/dev/null 2>&1; then + depend_${IFVAR} + fi + + local dep= prov= + for dep in need use before after provide keywords; do + eval prov=\$rc_${dep}_${IFVAR} + if [ -n "${prov}" ]; then + ${dep} ${prov} + fi + done } # Support bash arrays - sigh -- cgit v1.2.3