summaryrefslogtreecommitdiff
path: root/net.Linux/arping.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/arping.sh
parent42c231d7609447cb96d98cbebdc12a197324fb99 (diff)
downloadopenrc-e372729b8cc489af7b1b2305d6fd9c1895b9c8d4.tar.gz
openrc-e372729b8cc489af7b1b2305d6fd9c1895b9c8d4.tar.bz2
openrc-e372729b8cc489af7b1b2305d6fd9c1895b9c8d4.tar.xz
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/arping.sh')
-rw-r--r--net.Linux/arping.sh28
1 files changed, 17 insertions, 11 deletions
diff --git a/net.Linux/arping.sh b/net.Linux/arping.sh
index 817f8b2..68d0421 100644
--- a/net.Linux/arping.sh
+++ b/net.Linux/arping.sh
@@ -39,21 +39,30 @@ arping_address() {
return 0
}
+_arping_in_config() {
+ _get_array "config_${IFVAR}" | while read i; do
+ [ "${i}" = "arping" ] && return 0
+ done
+ return 1
+}
+
arping_start() {
local gateways= x= conf= i=
einfo "Pinging gateways on ${IFACE} for configuration"
- eval $(_get_array "gateways_${IFVAR}")
- if [ $# = 0 ] ; then
+ eval gateways=\$gateways_${IFVAR}
+ if [ -n "${gateways}" ] ; then
eerror "No gateways have been defined (gateways_${IFVAR}=\"...\")"
return 1
fi
eindent
- for x in "$@"; do
- eval set -- "${x}"
+ for x in ${gateways}; do
+ local IFS=,
+ set -- ${x}
local ip=$1 mac=$2 extra=
+ unset IFS
if [ -n "${mac}" ] ; then
mac="$(echo "${mac}" | tr '[:lower:]' '[:upper:]')"
@@ -90,13 +99,10 @@ arping_start() {
system_pre_start
# Ensure that we have a valid config - ie arping is no longer there
- eval $(_get_array "config_${IFVAR}")
- for i in "$@" ; do
- if [ "${i}" = "arping" ] ; then
- veend 1 "No config found for ${ip} (config_${conf}=\"...\")"
- continue 2
- fi
- done
+ if _arping_in_config; then
+ veend 1 "No config found for ${ip} (config_${conf}=\"...\")"
+ continue 2
+ fi
_load_config
return 0