| 1 |
# Copyright 2004-2007 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
|
| 4 |
adsl_depend() {
|
| 5 |
program /usr/sbin/adsl-start /usr/sbin/pppoe-start
|
| 6 |
before dhcp
|
| 7 |
}
|
| 8 |
|
| 9 |
adsl_setup_vars() {
|
| 10 |
local startstop="$1" cfgexe=
|
| 11 |
|
| 12 |
if [ -x /usr/sbin/pppoe-start ]; then
|
| 13 |
exe="/usr/sbin/pppoe-${startstop}"
|
| 14 |
cfgexe=pppoe-setup
|
| 15 |
else
|
| 16 |
exe="/usr/sbin/adsl-${startstop}"
|
| 17 |
cfgexe=adsl-setup
|
| 18 |
fi
|
| 19 |
|
| 20 |
# Decide which configuration to use. Hopefully there is an
|
| 21 |
# interface-specific one
|
| 22 |
cfgfile="/etc/ppp/pppoe-${IFACE}.conf"
|
| 23 |
[ -f "${cfgfile}" ] || cfgfile="/etc/ppp/pppoe.conf"
|
| 24 |
|
| 25 |
if [ ! -f "${cfgfile}" ]; then
|
| 26 |
eerror "no pppoe.conf file found!"
|
| 27 |
eerror "Please run ${cfgexe} to create one"
|
| 28 |
return 1
|
| 29 |
fi
|
| 30 |
|
| 31 |
return 0
|
| 32 |
}
|
| 33 |
|
| 34 |
adsl_start() {
|
| 35 |
local exe= cfgfile= user=
|
| 36 |
|
| 37 |
adsl_setup_vars start || return 1
|
| 38 |
|
| 39 |
# Might or might not be set in conf.d/net
|
| 40 |
eval user=\$adsl_user_${IFVAR}
|
| 41 |
|
| 42 |
# Start ADSL with the cfgfile, but override ETH and PIDFILE
|
| 43 |
einfo "Starting ADSL for ${IFACE}"
|
| 44 |
(
|
| 45 |
cat "${cfgfile}";
|
| 46 |
echo "ETH=${IFACE}";
|
| 47 |
echo "PIDFILE=/var/run/rp-pppoe-${IFACE}.pid";
|
| 48 |
[ -n "${user}" ] && echo "USER=${user}";
|
| 49 |
) | ${exe} >/dev/null
|
| 50 |
eend $?
|
| 51 |
}
|
| 52 |
|
| 53 |
adsl_stop() {
|
| 54 |
local exe= cfgfile=
|
| 55 |
|
| 56 |
[ ! -f /var/run/rp-pppoe-"${IFACE}".pid ] && return 0
|
| 57 |
|
| 58 |
adsl_setup_vars stop || return 1
|
| 59 |
|
| 60 |
einfo "Stopping ADSL for ${IFACE}"
|
| 61 |
(
|
| 62 |
cat "${cfgfile}";
|
| 63 |
echo "ETH=${IFACE}";
|
| 64 |
echo "PIDFILE=/var/run/rp-pppoe-${IFACE}.pid";
|
| 65 |
) | ${exe} >/dev/null
|
| 66 |
eend $?
|
| 67 |
|
| 68 |
return 0
|
| 69 |
}
|
| 70 |
|
| 71 |
# vim: set ts=4 :
|