aboutsummaryrefslogtreecommitdiff
path: root/net.Linux/pppd.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/pppd.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/pppd.sh')
-rw-r--r--net.Linux/pppd.sh35
1 files changed, 20 insertions, 15 deletions
diff --git a/net.Linux/pppd.sh b/net.Linux/pppd.sh
index 47d7dae3..07ac6b1f 100644
--- a/net.Linux/pppd.sh
+++ b/net.Linux/pppd.sh
@@ -33,7 +33,7 @@ pppd_pre_start() {
return 0
fi
- local link= i= opts= unit="${IFACE#ppp}" mtu=
+ local link= i= unit="${IFACE#ppp}" opts=
# PPP requires a link to communicate over - normally a serial port
# PPPoE communicates over Ethernet
@@ -57,16 +57,14 @@ pppd_pre_start() {
return 1
fi
- eval $(_get_array "pppd_${IFVAR}")
- opts="$@"
+ eval opts=\$pppd_${IFVAR}
local mtu= hasmtu=false hasmru=false hasmaxfail=false haspersist=false
local hasupdetach=false hasdefaultmetric=false
- for i in "$@" ; do
- set -- ${i}
- case "$1" in
+ for i in ${opts}; do
+ case "${i}" in
unit|nodetach|linkname)
- eerror "The option \"$1\" is not allowed in pppd_${IFVAR}"
+ eerror "The option \"${i}\" is not allowed in pppd_${IFVAR}"
return 1
;;
defaultmetric) hasdefaultmetric=true ;;
@@ -113,25 +111,31 @@ pppd_pre_start() {
# Load a custom interface configuration file if it exists
[ -f "/etc/ppp/options.${IFACE}" ] \
- && opts="${opts} file /etc/ppp/options.${IFACE}"
+ && opts="${opts} file '/etc/ppp/options.${IFACE}'"
# Set unit
opts="unit ${unit} ${opts}"
# Setup connect script
- local chatopts="/usr/sbin/chat -e -E -v"
- eval $(_get_array "phone_number_${IFVAR}")
+ local chatopts="/usr/sbin/chat -e -E -v" phone=
+ eval phone=\$phone_number_${IFVAR}
+ set -- ${phone}
[ -n "$1" ] && chatopts="${chatopts} -T '$1'"
[ -n "$2" ] && chatopts="${chatopts} -U '$2'"
- eval $(_get_array "chat_${IFVAR}")
- if [ $# != 0 ] ; then
+ local chat="$(_get_array "chat_${IFVAR}")"
+ if [ "${chat}" ] ; then
+ local IFS="
+"
opts="${opts} connect $(printf "\\'%s\\'" "${chatopts} $(printf "\\'\\\\'\\'%s\\'\\\'' " "$@")")"
+ unset IFS
fi
# Add plugins
- local haspppoa=false haspppoe=false
- eval $(_get_array "plugins_${IFVAR}")
- for i in "$@" ; do
+ local haspppoa=false haspppoe=false plugins="$(_get_array "plugins_${IFVAR}")"
+ local IFS="
+"
+ for i in ${plugins}; do
+ unset IFS
set -- ${i}
case "$1" in
passwordfd) continue;;
@@ -151,6 +155,7 @@ pppd_pre_start() {
shift
opts="${opts} $@"
done
+ unset IFS
#Specialized stuff. Insert here actions particular to connection type (pppoe,pppoa,capi)
local insert_link_in_opts=1