]> git.pld-linux.org Git - projects/rc-scripts.git/blob - sysconfig/network-scripts/ifup-sl
massive :$
[projects/rc-scripts.git] / sysconfig / network-scripts / ifup-sl
1 #!/bin/sh
2 #
3 #       $Id: ifup-sl,v 1.7 1999/07/13 12:49:37 misiek Exp $
4 #
5 PATH=/sbin:/usr/sbin:/bin:/usr/bin
6
7 # ifup-post can't be done for slip :-( Solution: use PPP
8
9 # become a daemon in case we have to persist.
10 if [ "$1" != daemon ] ; then
11   # disconnect stdin, out, err to disassociate from controlling tty
12   # so that no HUPs will get through.
13   $0 daemon $*& </dev/null >/dev/null 2>/dev/null
14   exit 0
15 fi
16 shift
17
18 cd /etc/sysconfig/network-scripts
19 . /etc/rc.d/init.d/functions.network
20
21 CONFIG=$1
22 source_config
23
24 if [ "foo$2" = "fooboot" -a ${ONBOOT} = "no" ]
25 then
26   exit
27 fi
28
29 if [ -z "$RETRYTIMEOUT" ]; then
30   RETRYTIMEOUT=30
31 fi
32
33 # we can use dip or direct slip connection via slattach
34 if [ "$DIRECT_CONNECT" != "yes" ]; then
35
36 [ -x /usr/sbin/dip ] || {
37   echo "/usr/sbin/dip does not exist or is not executable"
38   echo "ifup-sl for $DEVICE exiting"
39   logger -p daemon.info -t ifup-sl \
40     "/usr/sbin/dip does not exist or is not executable for $DEVICE"
41   exit 1
42 }
43
44 DIPSCRIPT=/etc/sysconfig/network-scripts/dip-$DEVNAME
45 [ -f $DIPSCRIPT ] || {
46   DIPSCRIPT=/etc/sysconfig/network-scripts/dip-$PARENTDEVNAME
47 }
48 [ -f $DIPSCRIPT ] || {
49   echo "/etc/sysconfig/network-scripts/dip-$DEVICE does not exist"
50   echo "ifup-sl for $DEVICE exiting"
51   logger -p daemon.info -t ifup-sl \
52     "/etc/sysconfig/network-scripts/dip-$DEVICE does not exist for $DEVICE"
53   exit 1
54 }
55
56 while : ; do
57   echo > /var/run/sl-$DEVICE.dev
58   (logger -p daemon.info -t ifup-sl \
59     "dip started for $DEVICE on $MODEMPORT at $LINESPEED" &)&
60   doexec /usr/sbin/dip dip-$DEVICE $DIPSCRIPT
61   if [ "$PERSIST" != "yes" -o ! -f /var/run/sl-$DEVICE.dev ] ; then
62     exit 0
63   fi
64   rm -f /var/run/sl-$DEVICE.dev
65
66
67   sleep $RETRYTIMEOUT || {
68     # sleep was killed
69     exit 0
70   }
71 done
72
73 else
74 # direct connection via slattach
75 [ -z "$MTU" ] && MTU=1500
76 [ -z "$PROTOCOL" ] && PROTOCOL=slip
77
78 [ -x /sbin/slattach ] || {
79         echo "/sbin/slattach does not exist or is not executable"
80         echo "ifup-sl for $DEVICE exiting"
81         logger -p daemon.info -t ifup-sl \
82         "/sbin/slattach does not exist or is not executable for $DEVICE"
83         exit 1
84 }
85
86         echo > /var/run/sl-$DEVICE.dev
87         (logger -p daemon.info -t ifup-sl \
88         "slattach started for $DEVICE on $MODEMPORT at $LINESPEED" &)&
89
90         # Check if slattach (or other process) is using $MODEMPORT
91         # if not - execute slattach
92         if [ -x /usr/sbin/fuser ] && fuser -s $MODEMPORT; then
93         logger -p daemon.info -t ifup-sl "some process is currently using $MODEMPORT"
94         echo "some process is currently using $MODEMPORT - aborting..."
95         else
96         slattach -p $PROTOCOL -s $LINESPEED $MODEMPORT &
97         usleep 500
98         ip link set $DEVICE mtu $MTU up
99         ip addr add $IPADDR peer $REMIP dev $DEVICE
100 # routing chyba jest ustawiany przez g³ówny skrypt ifup ...
101 #                if [ "$DEFROUTE" = yes ] ; then
102 #                        route del $REMIP > /dev/null 2>&1
103 #                       ip route add 0.0.0.0/0 dev $DEVICE
104 #                fi
105         fi
106
107 fi
108
This page took 0.047823 seconds and 3 git commands to generate.