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