]> git.pld-linux.org Git - projects/rc-scripts.git/blame - sysconfig/network-scripts/ifup-ppp
massive :$
[projects/rc-scripts.git] / sysconfig / network-scripts / ifup-ppp
CommitLineData
12de71be 1#!/bin/sh
b0443108
AM
2#
3# $Id: ifup-ppp,v 1.6 1999/07/13 12:49:37 misiek Exp $
4#
7742e157
AF
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
18PATH=/sbin:/usr/sbin:/bin:/usr/bin
19
20# ifup-post for PPP is handled through /etc/ppp/ip-up
21if [ "$1" != daemon ] ; then
22 # disconnect stdin, out, err to disassociate from controlling tty
23 # so that no HUPs will get through.
d29c401a 24 $0 daemon $* </dev/null >/dev/null 2>/dev/null &
7742e157
AF
25 exit 0
26fi
27shift
28
29CONFIG=$1
30cd /etc/sysconfig/network-scripts
7e04fe0e 31. /etc/rc.d/init.d/functions.network
7742e157
AF
32source_config
33if [ -z "$HOLDOFF" ]; then
34 HOLDOFF=30
35fi
36if [ "$2" = "boot" -a "${ONBOOT}" = "no" ]; then
37 exit
38fi
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}
12de71be 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#}
7742e157
AF
53opts="lock"
54if [ "${PERSIST}" = "yes" ]; then
55 opts="$opts persist holdoff $HOLDOFF"
56fi
57if [ "${DEMAND}" = "yes" ]; then
58#opts="$opts demand active-filter $ACTIVEFILTER idle $IDLE"
59opts="$opts demand "
60fi
61if [ "${HARDFLOWCTL}" = yes ] ; then
62 opts="$opts modem crtscts"
63fi
64if [ "${ESCAPECHARS}" = yes ] ; then
d29c401a
AM
65 opts="$opts asyncmap FFFFFFFF"
66elif [ "${ESCAPECHARS}" = no ] ; then
7742e157
AF
67 opts="$opts asyncmap 00000000"
68fi
69if [ "${DEFROUTE}" = yes ] ; then
70 opts="$opts defaultroute"
71fi
72if [ -n "${MRU}" ] ; then
73 opts="$opts mru ${MRU}"
74fi
75if [ -n "${MTU}" ] ; then
76 opts="$opts mtu ${MTU}"
77fi
78if [ -n "${IPADDR}${REMIP}" ] ; then
79 # if either IP address is set, the following will work.
80 opts="$opts ${IPADDR}:${REMIP}"
81fi
82if [ -n "${PAPNAME}" ] ; then
83 opts="$opts name ${PAPNAME}"
84fi
85if [ "${DEBUG}" = yes ] ; then
86 opts="$opts debug"
87 chatdbg="-v"
88fi
89if [ -n "${REPORTFILE}" ] ; then
90 chatrpt="-r ${REPORTFILE}"
91fi
12de71be 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
7742e157
AF
97(logger -p daemon.info -t ifup-ppp \
98 "pppd started for $DEVICE on $MODEMPORT at $LINESPEED" &)&
7742e157
AF
99if [ -n "${CHATSCRIPT}" ] ; then
100 export chatdbg chatrpt CHATSCRIPT
101 export $DATAFORCHAT
102 /usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
12de71be 103 connect 'eval /usr/sbin/chat $chatdbg $chatrpt \
104 `grep -v ^# ${CHATSCRIPT}`' \
7742e157
AF
105 remotename $DEVICE ipparam $DEVICE \
106 ${PPPOPTIONS} &
107else
108 /usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
109 remotename $DEVICE ipparam $DEVICE \
110 ${PPPOPTIONS} &
111fi
112 echo "$!" > /var/run/ppp-$DEVICE.pid
113
This page took 0.037301 seconds and 4 git commands to generate.