|
Lines 3-8
Link Here
|
| 3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
| 4 |
# Author: Martin Schlemmer <azarah@gentoo.org> |
4 |
# Author: Martin Schlemmer <azarah@gentoo.org> |
| 5 |
# Credits: To all those I got ideas from :) |
5 |
# Credits: To all those I got ideas from :) |
|
|
6 |
# Modified by HS |
| 6 |
# |
7 |
# |
| 7 |
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/net.ppp0,v 1.14 2003/05/18 21:51:34 azarah Exp $ |
8 |
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/net.ppp0,v 1.14 2003/05/18 21:51:34 azarah Exp $ |
| 8 |
|
9 |
|
|
Lines 25-31
Link Here
|
| 25 |
if [ -e "/var/run/ppp-${IFACE}.pid" -o -e "/var/run/${IFACE}.pid" ] && \ |
26 |
if [ -e "/var/run/ppp-${IFACE}.pid" -o -e "/var/run/${IFACE}.pid" ] && \ |
| 26 |
[ "${FUNCT}" = "start" ] |
27 |
[ "${FUNCT}" = "start" ] |
| 27 |
then |
28 |
then |
| 28 |
eerror "ppp0 is already up" |
29 |
eerror "${IFACE} is already up" |
| 29 |
return 1 |
30 |
return 1 |
| 30 |
fi |
31 |
fi |
| 31 |
} |
32 |
} |
|
Lines 61-83
Link Here
|
| 61 |
if [ -x "$(which ifconfig)" ] |
62 |
if [ -x "$(which ifconfig)" ] |
| 62 |
then |
63 |
then |
| 63 |
|
64 |
|
| 64 |
if [ -z "$(/sbin/ifconfig | egrep "${IFACE}")" ] |
65 |
# Obtain interface name from pid file (IFACE is actually linkname) |
|
|
66 |
if [ -e /var/run/ppp-${IFACE}.pid ] |
| 67 |
then |
| 68 |
IFNAME=$(egrep "ppp" /var/run/ppp-${IFACE}.pid) |
| 69 |
fi |
| 70 |
if [ -z "${IFNAME}" ] |
| 65 |
then |
71 |
then |
|
|
72 |
IFNAME=${IFACE} |
| 73 |
fi |
| 74 |
|
| 75 |
if [ -z "$(/sbin/ifconfig | egrep "${IFNAME}")" ] |
| 76 |
then |
| 77 |
|
| 78 |
# Link is not up but pppd may be running |
| 66 |
ewarn "Interface seems to be down already" |
79 |
ewarn "Interface seems to be down already" |
| 67 |
# We should return 0 here, else svc_stop() will not remove |
|
|
| 68 |
# the 'started' symlink ... |
| 69 |
return 0 |
| 70 |
fi |
80 |
fi |
| 71 |
|
81 |
|
| 72 |
# /sbin/ifconfig ${IFACE} down |
82 |
# /sbin/ifconfig ${IFACE} down |
| 73 |
if [ -e /var/run/ppp-${IFACE}.pid ] |
83 |
if [ -e /var/run/ppp-${IFACE}.pid ] |
| 74 |
then |
84 |
then |
| 75 |
kill $(egrep -v "${IFACE}" /var/run/ppp-${IFACE}.pid) |
85 |
PID=$(egrep -v "${IFNAME}" /var/run/ppp-${IFACE}.pid) |
| 76 |
|
|
|
| 77 |
elif [ -e /var/run/${IFACE}.pid ] |
86 |
elif [ -e /var/run/${IFACE}.pid ] |
| 78 |
then |
87 |
then |
| 79 |
kill $(egrep -v "${IFACE}" /var/run/${IFACE}.pid) |
88 |
PID=$(egrep -v "${IFNAME}" /var/run/${IFACE}.pid) |
| 80 |
fi |
89 |
fi |
|
|
90 |
|
| 91 |
kill ${PID} |
| 92 |
|
| 93 |
# Check if pppd is not running (check it 10 times because pppd |
| 94 |
# sometimes do not finish so fast) |
| 95 |
PID=`pstree -p ${PID} | sed -e 's:^.*pppd::'` |
| 96 |
PID=${PID:1:${#PID}-2} |
| 97 |
COUNT=0 |
| 98 |
while [ -n "${PID}" ] && [ ${COUNT} -lt 10 ] |
| 99 |
do |
| 100 |
sleep 0.5 |
| 101 |
PID=`pstree -p ${PID} | sed -e 's:^.*pppd::'` |
| 102 |
PID=${PID:1:${#PID}-2} |
| 103 |
let COUNT++ |
| 104 |
done |
| 105 |
|
| 106 |
if [ -n "${PID}" ] |
| 107 |
then |
| 108 |
eend 1 "Error stopping pppd" |
| 109 |
fi |
| 110 |
|
| 81 |
fi |
111 |
fi |
| 82 |
eend |
112 |
eend |
| 83 |
} |
113 |
} |
|
Lines 163-178
Link Here
|
| 163 |
chmod 600 /etc/ppp/pap-secrets |
193 |
chmod 600 /etc/ppp/pap-secrets |
| 164 |
|
194 |
|
| 165 |
# Setup the chat file |
195 |
# Setup the chat file |
| 166 |
if [ -n "${INITSTRING}" ] |
196 |
if [ "${AUTOCHATSCRIPT}" = "yes" ] |
| 167 |
then |
197 |
then |
| 168 |
sed -e "9i\\'OK\' \'${INITSTRING}\'" \ |
198 |
if [ -n "${INITSTRING}" ] |
| 169 |
-e "s:\$NUMBER:${NUMBER}:" \ |
199 |
then |
| 170 |
${TEMPLATEDIR}/chat-default \ |
200 |
sed -e "9i\\'OK\' \'${INITSTRING}\'" \ |
| 171 |
>/etc/ppp/chat-${PEER} |
201 |
-e "s:\$NUMBER:${NUMBER}:" \ |
| 172 |
else |
202 |
${TEMPLATEDIR}/chat-default \ |
| 173 |
sed -e "s:\$NUMBER:${NUMBER}:" \ |
203 |
>/etc/ppp/chat-${PEER} |
| 174 |
${TEMPLATEDIR}/chat-default \ |
204 |
else |
| 175 |
>/etc/ppp/chat-${PEER} |
205 |
sed -e "s:\$NUMBER:${NUMBER}:" \ |
|
|
206 |
${TEMPLATEDIR}/chat-default \ |
| 207 |
>/etc/ppp/chat-${PEER} |
| 208 |
fi |
| 176 |
fi |
209 |
fi |
| 177 |
|
210 |
|
| 178 |
# Setup the ip-scripts so long |
211 |
# Setup the ip-scripts so long |