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