/[baselayout]/trunk/sh/net.sh
Gentoo

Diff of /trunk/sh/net.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 3071 Revision 3072
7_config_vars="config routes" 7_config_vars="config routes"
8 8
9[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND=false 9[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND=false
10 10
11description="Configures network interfaces." 11description="Configures network interfaces."
12
13# Handy var so we don't have to embed new lines everywhere for array splitting
14__IFS="
15"
12 16
13depend() { 17depend() {
14 local IFACE=${SVCNAME#*.} 18 local IFACE=${SVCNAME#*.}
15 local IFVAR=$(echo -n "${IFACE}" | sed -e 's/[^[:alnum:]]/_/g') 19 local IFVAR=$(echo -n "${IFACE}" | sed -e 's/[^[:alnum:]]/_/g')
16 20
55 esac 59 esac
56 fi 60 fi
57 61
58 eval _a=\$$1 62 eval _a=\$$1
59 printf "%s" "${_a}" 63 printf "%s" "${_a}"
64 printf "\n"
60 [ -n "${_a}" ] 65 [ -n "${_a}" ]
61} 66}
62 67
63_wait_for_carrier() { 68_wait_for_carrier() {
64 local timeout= efunc=einfon 69 local timeout= efunc=einfon
216 i=0 221 i=0
217 for MODULE in ${SORTED} ; do 222 for MODULE in ${SORTED} ; do
218 eval PROGRAM=\$${MODULE}_program 223 eval PROGRAM=\$${MODULE}_program
219 eval PROGRAM_START=\$${MODULE}_program_start 224 eval PROGRAM_START=\$${MODULE}_program_start
220 eval PROGRAM_STOP=\$${MODULE}_program_stop 225 eval PROGRAM_STOP=\$${MODULE}_program_stop
221 #for x in ${PROGRAM} ; do
222 # [ -x "${x}" ] || continue 2
223 #done
224 eval PROVIDE=\$${MODULE}_provide 226 eval PROVIDE=\$${MODULE}_provide
225 echo "module_${i}='${MODULE}'" >> "${MODULESLIST}" 227 echo "module_${i}='${MODULE}'" >> "${MODULESLIST}"
226 echo "module_${i}_program='${PROGRAM}'" >> "${MODULESLIST}" 228 echo "module_${i}_program='${PROGRAM}'" >> "${MODULESLIST}"
227 echo "module_${i}_program_start='${PROGRAM_START}'" >> "${MODULESLIST}" 229 echo "module_${i}_program_start='${PROGRAM_START}'" >> "${MODULESLIST}"
228 echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${MODULESLIST}" 230 echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${MODULESLIST}"
357 fi 359 fi
358 360
359 # We store our config in an array like vars 361 # We store our config in an array like vars
360 # so modules can influence it 362 # so modules can influence it
361 config_index=0 363 config_index=0
362 local IFS=" 364 local IFS="$__IFS"
363"
364 for cmd in ${config}; do 365 for cmd in ${config}; do
365 eval config_${config_index}="'${cmd}'" 366 eval config_${config_index}="'${cmd}'"
366 config_index=$((${config_index} + 1)) 367 config_index=$((${config_index} + 1))
367 done 368 done
368 # Terminate the list 369 # Terminate the list
369 eval config_${config_index}= 370 eval config_${config_index}=
370 371
371 config_index=0 372 config_index=0
372 for cmd in ${fallback}; do 373 for cmd in ${fallback}; do
373 eval fallback_${config_index}="'${cmd}'"
374 config_index=$((${config_index} + 1)) 374 config_index=$((${config_index} + 1))
375 done 375 done
376 # Terminate the list 376 # Terminate the list
377 eval fallback_${config_index}= 377 eval fallback_${config_index}=
378 378
496 if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then 496 if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
497 routes="127.0.0.0/8 via 127.0.0.1 497 routes="127.0.0.0/8 via 127.0.0.1
498${routes}" 498${routes}"
499 hidefirstroute=true 499 hidefirstroute=true
500 fi 500 fi
501 local IFS=" 501 local IFS="$__IFS"
502"
503 for cmd in ${routes}; do 502 for cmd in ${routes}; do
504 unset IFS 503 unset IFS
505 if ${first}; then 504 if ${first}; then
506 first=false 505 first=false
507 einfo "Adding routes" 506 einfo "Adding routes"
527 _add_route ${cmd} >/dev/null 526 _add_route ${cmd} >/dev/null
528 fi 527 fi
529 eend $? 528 eend $?
530 eoutdent 529 eoutdent
531 done 530 done
531 unset IFS
532 532
533 for module in ${MODULES} ; do 533 for module in ${MODULES} ; do
534 if type "${module}_post_start" >/dev/null 2>/dev/null ; then 534 if type "${module}_post_start" >/dev/null 2>/dev/null ; then
535 if ! ${module}_post_start ; then 535 if ! ${module}_post_start ; then
536 eend 1 536 eend 1

Legend:
Removed from v.3071  
changed lines
  Added in v.3072

  ViewVC Help
Powered by ViewVC 1.1.20