/[baselayout]/trunk/net-scripts/net.modules.d/adsl
Gentoo

Diff of /trunk/net-scripts/net.modules.d/adsl

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

Revision 1246 Revision 1247
37 37
38# bool adsl_setup_vars(char *iface) 38# bool adsl_setup_vars(char *iface)
39# 39#
40# Checks to see if the ADSL script has been created or not 40# Checks to see if the ADSL script has been created or not
41adsl_setup_vars() { 41adsl_setup_vars() {
42 local iface=$1 42 local iface="$1"
43 43
44 # Decide which configuration to use. Hopefully there is an 44 # Decide which configuration to use. Hopefully there is an
45 # interface-specific one 45 # interface-specific one
46 cfgfile="/etc/ppp/pppoe-${iface}.conf" 46 cfgfile="/etc/ppp/pppoe-${iface}.conf"
47 [[ -f ${cfgfile} ]] || cfgfile="/etc/ppp/pppoe.conf" 47 [[ -f ${cfgfile} ]] || cfgfile="/etc/ppp/pppoe.conf"
59# 59#
60# Start ADSL on an interface by calling adsl-start 60# Start ADSL on an interface by calling adsl-start
61# 61#
62# Returns 0 (true) when successful, non-zero otherwise 62# Returns 0 (true) when successful, non-zero otherwise
63adsl_start() { 63adsl_start() {
64 local iface=$1 user ifvar=$( bash_variable $1 ) cfgfile 64 local iface="$1" user ifvar=$( bash_variable "$1" ) cfgfile
65 65
66 adsl_setup_vars ${iface} || return 1 66 adsl_setup_vars "${iface}" || return 1
67 67
68 # Might or might not be set in conf.d/net 68 # Might or might not be set in conf.d/net
69 eval user=\"\$\{adsl_user_${ifvar}\}\" 69 eval user=\"\$\{adsl_user_${ifvar}\}\"
70 70
71 # Start ADSL with the cfgfile, but override ETH and PIDFILE 71 # Start ADSL with the cfgfile, but override ETH and PIDFILE
72 einfo "Starting ADSL for ${iface}" 72 einfo "Starting ADSL for ${iface}"
73 /usr/sbin/adsl-start <(cat ${cfgfile}; \ 73 /usr/sbin/adsl-start <(cat "${cfgfile}"; \
74 echo "ETH=${iface}"; \ 74 echo "ETH=${iface}"; \
75 echo "PIDFILE=/var/run/adsl-${iface}.pid"; \ 75 echo "PIDFILE=/var/run/adsl-${iface}.pid"; \
76 [[ -n ${user} ]] && echo "USER=${user}") \ 76 [[ -n ${user} ]] && echo "USER=${user}") \
77 >${devnull} 77 >/dev/null
78 eend $? 78 eend $?
79} 79}
80 80
81# bool adsl_stop(char *iface) 81# bool adsl_stop(char *iface)
82# 82#
83# Stop ADSL on an interface by calling adsl-stop 83# Stop ADSL on an interface by calling adsl-stop
84# Returns 0 when there is no ADSL to stop or we stop ADSL successfully 84# Returns 0 when there is no ADSL to stop or we stop ADSL successfully
85# Otherwise 1 85# Otherwise 1
86adsl_stop() { 86adsl_stop() {
87 local iface=$1 cfgfile 87 local iface="$1" cfgfile
88 88
89 adsl_check_installed || return 0 89 adsl_check_installed || return 0
90 [[ ! -f /var/run/adsl-${iface}.pid ]] && return 0 90 [[ ! -f "/var/run/adsl-${iface}.pid" ]] && return 0
91 91
92 adsl_setup_vars ${iface} || return 0 92 adsl_setup_vars "${iface}" || return 0
93 93
94 einfo "Stopping ADSL for ${iface}" 94 einfo "Stopping ADSL for ${iface}"
95 /usr/sbin/adsl-stop <(cat ${cfgfile}; \ 95 /usr/sbin/adsl-stop <(cat "${cfgfile}"; \
96 echo "ETH=${iface}"; echo "PIDFILE=/var/run/adsl-${iface}.pid") \ 96 echo "ETH=${iface}"; echo "PIDFILE=/var/run/adsl-${iface}.pid") \
97 >${devnull} 97 >/dev/null
98 eend $? 98 eend $?
99} 99}

Legend:
Removed from v.1246  
changed lines
  Added in v.1247

  ViewVC Help
Powered by ViewVC 1.1.20