]> git.pld-linux.org Git - projects/rc-scripts.git/blame - sysconfig/network-scripts/ifup-ppp
- check if DATAFORCHAT is not null before exporting it
[projects/rc-scripts.git] / sysconfig / network-scripts / ifup-ppp
CommitLineData
12de71be 1#!/bin/sh
b0443108 2#
b4df11d7 3# $Id: ifup-ppp,v 1.14 2001/03/22 21:50:36 qboosh Exp $
b0443108 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
7742e157
AF
21
22CONFIG=$1
f3002e12
JK
23. /etc/sysconfig/network
24. /etc/rc.d/init.d/functions
8b3e2b71 25. /etc/sysconfig/network-scripts/.functions
26
7742e157 27source_config
7b4e96e8
AM
28[ -z "$HOLDOFF" ] && HOLDOFF=30
29
dd4a755f 30if [ "$2" = "boot" ] && is_no "${ONBOOT}"; then
7742e157
AF
31 exit
32fi
33[ -x /usr/sbin/pppd ] || {
34 echo "/usr/sbin/pppd does not exist or is not executable"
35 echo "ifup-ppp for $DEVICE exiting"
36 logger -p daemon.info -t ifup-ppp \
37 "/usr/sbin/pppd does not exist or is not executable for $DEVICE"
38 exit 1
39}
3ed6009f 40
7742e157 41opts="lock"
dd4a755f 42if is_yes "${PERSIST}"; then
3ed6009f 43 if [ -z "${MAXFAIL}" ]; then
44 MAXFAIL="0"
45 fi
7b4e96e8 46 opts="$opts persist holdoff $HOLDOFF maxfail $MAXFAIL"
7742e157 47fi
dd4a755f 48if is_yes "${DEMAND}"; then
3ed6009f 49 if [ -z "${IDLE}" ]; then
50 IDLE="0"
51 fi
52 opts="$opts demand idle ${IDLE}"
7742e157 53fi
dd4a755f 54if is_yes "${HARDFLOWCTL}"; then
7742e157
AF
55 opts="$opts modem crtscts"
56fi
dd4a755f 57if is_yes "${ESCAPECHARS}"; then
d29c401a
AM
58 opts="$opts asyncmap FFFFFFFF"
59elif [ "${ESCAPECHARS}" = no ] ; then
7742e157
AF
60 opts="$opts asyncmap 00000000"
61fi
dd4a755f 62if is_yes "${DEFROUTE}" = yes; then
7742e157
AF
63 opts="$opts defaultroute"
64fi
65if [ -n "${MRU}" ] ; then
66 opts="$opts mru ${MRU}"
67fi
68if [ -n "${MTU}" ] ; then
69 opts="$opts mtu ${MTU}"
70fi
71if [ -n "${IPADDR}${REMIP}" ] ; then
72 # if either IP address is set, the following will work.
73 opts="$opts ${IPADDR}:${REMIP}"
74fi
75if [ -n "${PAPNAME}" ] ; then
76 opts="$opts name ${PAPNAME}"
77fi
200ca1e9
JK
78if [ -n "${REMOTENAME}" ] ; then
79 opts="$opts remotename ${REMOTENAME}"
80fi
dd4a755f 81if is_yes "${DEBUG}"; then
7742e157
AF
82 opts="$opts debug"
83 chatdbg="-v"
84fi
03f9cfee
JR
85case "${AUTH}" in
86 yes) opts="$opts auth"
87 ;;
88 no) opts="$opts noauth"
89 ;;
90 *)
91 ;;
92esac
7742e157
AF
93if [ -n "${REPORTFILE}" ] ; then
94 chatrpt="-r ${REPORTFILE}"
95fi
3ed6009f 96
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
b4df11d7
JB
101 if [ -n "${DATAFORCHAT}" ] ; then
102 export $DATAFORCHAT
103 fi
200ca1e9 104 /usr/sbin/pppd $opts $MODEMPORT $LINESPEED \
12de71be 105 connect 'eval /usr/sbin/chat $chatdbg $chatrpt \
106 `grep -v ^# ${CHATSCRIPT}`' \
200ca1e9
JK
107 linkname "${DEVICE}" ipparam "${CONFIG}" \
108 ${PPPOPTIONS}
7742e157 109else
200ca1e9
JK
110 /usr/sbin/pppd $opts $MODEMPORT $LINESPEED \
111 linkname "${DEVICE}" ipparam "${CONFIG}" \
112 ${PPPOPTIONS}
7742e157 113fi
7742e157 114
This page took 0.069522 seconds and 4 git commands to generate.