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

Contents of /trunk/net.Linux/adsl.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2547 - (show annotations) (download) (as text)
Thu Apr 5 11:18:42 2007 UTC (7 years, 3 months ago) by uberlord
File MIME type: text/x-sh
File size: 1473 byte(s)
    Rewrite the core parts in C. We now provide librc so other programs can
    query runlevels, services and state without using bash. We also provide
    libeinfo so other programs can easily use our informational functions.

    As such, we have dropped the requirement of using bash as the init script
    shell. We now use /bin/sh and have strived to make the scripts as portable
    as possible. Shells that work are bash and dash. busybox works provided
    you disable s-s-d. If you have WIPE_TMP set to yes in conf.d/bootmisc you
    should disable find too.
    zsh and ksh do not work at this time.

    Networking support is currently being re-vamped also as it was heavily bash
    array based. As such, a new config format is available like so
    config_eth0="1.2.3.4/24 5.6.7.8/16"
    or like so
    config_eth0="'1.2.3.4 netmask 255.255.255.0' '5.6.7.8 netmask 255.255.0.0'"

    We will still support the old bash array format provided that /bin/sh IS
    a link it bash.

    ChangeLog for baselayout-1 can be found in our SVN repo.
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="$2" 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 :

  ViewVC Help
Powered by ViewVC 1.1.20