]> git.pld-linux.org Git - projects/rc-scripts.git/blob - sysconfig/network-scripts/ifup-ppp
massive :$
[projects/rc-scripts.git] / sysconfig / network-scripts / ifup-ppp
1 #!/bin/sh
2 #
3 #       $Id: ifup-ppp,v 1.6 1999/07/13 12:49:37 misiek Exp $
4 #
5 # ifup-ppp script for pppd-2.3.5 (with persist & demand options) ver 0.2
6 # Grzegorz Stanislawski <stangrze@open.net.pl>
7 # Features:
8 #  - since persist option is included to pppd it''s no need to do werid loops
9 #    ifup-ppp script. This also makes your logfile grow slower when Your link
10 #    is down.
11 #  - chat-ppp? file with script for chat is now parsed by shell, so You can
12 #    include in it shell variables (for example $PHONE, $USERNAME)
13 #    You can define any variable in ifcfg-ppp? file and use it in chat-ppp?
14 #    You only have to add it's name into DATAFORCHAT variable
15 #    Note, that chat-ppp file is now parsed by shell, so you have to escape
16 #    with "\" all shell special characters like \$;:)(& etc.
17  
18 PATH=/sbin:/usr/sbin:/bin:/usr/bin
19
20 # ifup-post for PPP is handled through /etc/ppp/ip-up
21 if [ "$1" != daemon ] ; then
22   # disconnect stdin, out, err to disassociate from controlling tty
23   # so that no HUPs will get through.
24   $0 daemon $* </dev/null >/dev/null 2>/dev/null &
25   exit 0
26 fi
27 shift
28
29 CONFIG=$1
30 cd /etc/sysconfig/network-scripts
31 . /etc/rc.d/init.d/functions.network
32 source_config
33 if [ -z "$HOLDOFF" ]; then
34   HOLDOFF=30
35 fi
36 if [ "$2" = "boot" -a "${ONBOOT}" = "no" ]; then
37   exit
38 fi
39 [ -x /usr/sbin/pppd ] || {
40   echo "/usr/sbin/pppd does not exist or is not executable"
41   echo "ifup-ppp for $DEVICE exiting"
42     logger -p daemon.info -t ifup-ppp \
43     "/usr/sbin/pppd does not exist or is not executable for $DEVICE"
44   exit 1
45 }
46 #[ -f /etc/sysconfig/network-scripts/chat-$DEVICE ] || {
47 #  echo "/etc/sysconfig/network-scripts/chat-$DEVICE does not exist"
48 #  echo "ifup-ppp for $DEVICE exiting"
49 #  logger -p daemon.info -t ifup-ppp \
50 #    "/etc/sysconfig/network-scripts/chat-$DEVICE does not exist for $DEVICE"
51 #  exit 1
52 #}
53 opts="lock"
54 if [ "${PERSIST}" = "yes" ]; then
55   opts="$opts persist holdoff $HOLDOFF"
56 fi
57 if [ "${DEMAND}" = "yes" ]; then
58 #opts="$opts demand active-filter $ACTIVEFILTER idle $IDLE"
59 opts="$opts demand "
60 fi
61 if [ "${HARDFLOWCTL}" = yes ] ; then
62   opts="$opts modem crtscts"
63 fi
64 if [ "${ESCAPECHARS}" = yes ] ; then
65   opts="$opts asyncmap FFFFFFFF"
66 elif [ "${ESCAPECHARS}" = no ] ; then
67   opts="$opts asyncmap 00000000"
68 fi
69 if [ "${DEFROUTE}" = yes ] ; then
70   opts="$opts defaultroute"
71 fi
72 if [ -n "${MRU}" ] ; then
73   opts="$opts mru ${MRU}"
74 fi
75 if [ -n "${MTU}" ] ; then
76   opts="$opts mtu ${MTU}"
77 fi
78 if [ -n "${IPADDR}${REMIP}" ] ; then
79   # if either IP address is set, the following will work.
80   opts="$opts ${IPADDR}:${REMIP}"
81 fi
82 if [ -n "${PAPNAME}" ] ; then
83   opts="$opts name ${PAPNAME}"
84 fi
85 if [ "${DEBUG}" = yes ] ; then
86   opts="$opts debug"
87   chatdbg="-v"
88 fi
89 if [ -n "${REPORTFILE}"  ] ; then
90   chatrpt="-r ${REPORTFILE}"
91 fi
92 #CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$DEVNAMR
93 #[ -f $CHATSCRIPT ] || {
94 #  CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$PARENTDEVNAME
95 #}
96 > /var/run/ppp-$DEVICE.dev
97 (logger -p daemon.info -t ifup-ppp \
98     "pppd started for $DEVICE on $MODEMPORT at $LINESPEED" &)&
99 if [ -n "${CHATSCRIPT}"  ] ; then
100   export chatdbg chatrpt CHATSCRIPT
101   export $DATAFORCHAT
102   /usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
103     connect 'eval /usr/sbin/chat $chatdbg $chatrpt \
104     `grep -v ^# ${CHATSCRIPT}`' \
105     remotename $DEVICE ipparam $DEVICE \
106     ${PPPOPTIONS} &
107 else
108   /usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
109     remotename $DEVICE ipparam $DEVICE \
110     ${PPPOPTIONS} &
111 fi
112  echo "$!" > /var/run/ppp-$DEVICE.pid
113
This page took 0.030123 seconds and 3 git commands to generate.