aboutsummaryrefslogtreecommitdiff
path: root/net.Linux/vlan.sh
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-29 09:45:49 +0000
committerRoy Marples <roy@marples.name>2007-10-29 09:45:49 +0000
commite372729b8cc489af7b1b2305d6fd9c1895b9c8d4 (patch)
tree5ffa0e392d92a03bd23fe8f00aa2d6a26d41ffbb /net.Linux/vlan.sh
parent42c231d7609447cb96d98cbebdc12a197324fb99 (diff)
Network config arrays are now split by embedded new lines instead of being evaled into space separated values. This makes it easier to read, maintain and document as discussed on gentoo-dev.
Diffstat (limited to 'net.Linux/vlan.sh')
-rw-r--r--net.Linux/vlan.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/net.Linux/vlan.sh b/net.Linux/vlan.sh
index 1542d4c0..23cdf777 100644
--- a/net.Linux/vlan.sh
+++ b/net.Linux/vlan.sh
@@ -31,14 +31,17 @@ _check_vlan() {
}
vlan_pre_start() {
- eval $(_get_array "vconfig_${IFVAR}")
- [ $# = "0" ] && return 0
+ local vc="$(_get_array "vconfig_${IFVAR}")"
+ [ -z "${vc}" ] && return 0
_check_vlan || return 1
_exists || return 1
local v= x= e=
- for v in "$@" ; do
+ local IFS="
+"
+ for v in ${vc}; do
+ unset IFS
case "${v}" in
set_name_type" "*) x=${v} ;;
*) x="$(echo "${v}" | sed -e "s/ / ${IFACE} /g")"
@@ -56,14 +59,15 @@ vlan_pre_start() {
}
vlan_post_start() {
- eval $(_get_array "vlans_${IFVAR}")
- [ $# = "0" ] && return 0
+ local vlans=
+ eval vlans=\$vlans_${IFACE}
+ [ -z "${vlans}" ] && return 0
_check_vlan || return 1
_exists || return 1
local vlan= e= s=
- for vlan in "$@" ; do
+ for vlan in ${vlans}; do
einfo "Adding VLAN ${vlan} to ${IFACE}"
e="$(vconfig add "${IFACE}" "${vlan}" 2>&1 1>/dev/null)"
if [ -n "${e}" ] ; then
@@ -92,7 +96,7 @@ vlan_post_start() {
vlan_post_stop() {
local vlan=
- for vlan in $(_get_vlans) ; do
+ for vlan in $(_get_vlans); do
einfo "Removing VLAN ${vlan##*.} from ${IFACE}"
(
export SVCNAME="net.${vlan}"