]> git.pld-linux.org Git - projects/rc-scripts.git/blob - sysconfig/network-scripts/ifup-sl
- merge from TOTALNEW branch (see NEWS for more info)
[projects/rc-scripts.git] / sysconfig / network-scripts / ifup-sl
1 #!/bin/sh
2 #
3 #       $Id: ifup-sl,v 1.18 2001/05/15 16:03:44 baggins 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 . /etc/sysconfig/network
10 . /etc/rc.d/init.d/functions
11 . /etc/sysconfig/network-scripts/.functions
12
13 # become a daemon in case we have to persist.
14 if [ "$1" != daemon ] ; then
15   # disconnect stdin, out, err to disassociate from controlling tty
16   # so that no HUPs will get through.
17   $0 daemon $*& </dev/null >/dev/null 2>/dev/null
18   exit 0
19 fi
20 shift
21
22 CONFIG=$1
23 source_config
24
25 if [ "foo$2" = "fooboot" ] && is_no ${ONBOOT}; then
26   exit
27 fi
28
29 # set all major variables
30 setup_ip_param
31
32 if [ -z "$RETRYTIMEOUT" ]; then
33   RETRYTIMEOUT=30
34 fi
35
36 # Try to load slip module
37 if is_module "slip"; then
38         /sbin/modprobe -s -k slip
39 fi
40
41 # we can use dip or direct slip connection via slattach
42 if is_no "$DIRECT_CONNECT"; then
43
44 [ -x /usr/sbin/dip ] || {
45   nls "/usr/sbin/dip does not exist or is not executable"
46   nls "ifup-sl for %s exiting" "$DEVICE"
47   logger -p daemon.info -t ifup-sl \
48     "`nls '/usr/sbin/dip does not exist or is not executable for'` $DEVICE"
49   exit 1
50 }
51
52 DIPSCRIPT=/etc/sysconfig/interfaces/data/dip-$DEVNAME
53 [ -f $DIPSCRIPT ] || {
54   DIPSCRIPT=/etc/sysconfig/interfaces/data/dip-$PARENTDEVNAME
55 }
56 [ -f $DIPSCRIPT ] || {
57   echo "/etc/sysconfig/interfaces/data/dip-$DEVICE $(nls 'does not exist')"
58   echo "ifup-sl for $DEVICE exiting"
59   logger -p daemon.info -t ifup-sl \
60     "/etc/sysconfig/interfaces/data/dip-$DEVICE $(nls 'does not exist for') $DEVICE"
61   exit 1
62 }
63
64 while : ; do
65   echo > /var/run/sl-$DEVICE.dev
66   (logger -p daemon.info -t ifup-sl \
67     "$(nls 'dip started for %s on %s at %s' "$DEVICE" "$MODEMPORT" "$LINESPEED")" &)&
68   doexec /usr/sbin/dip dip-$DEVICE $DIPSCRIPT
69   if is_no "$PERSIST" || [ ! -f /var/run/sl-$DEVICE.dev ] ; then
70     exit 0
71   fi
72   rm -f /var/run/sl-$DEVICE.dev
73
74
75   sleep $RETRYTIMEOUT || {
76     # sleep was killed
77     exit 0
78   }
79 done
80
81 else
82
83 # direct connection via slattach
84 [ -z "$MTU" ] && MTU=1500
85 [ -z "$PROTOCOL" ] && PROTOCOL=slip
86
87 [ -x /sbin/slattach ] || {
88         nls "%s is missing. Can't continue." "/sbin/slattach"
89         echo "ifup-sl - $DEVICE $(nls exiting)"
90         logger -p daemon.info -t ifup-sl \
91         "$(nls '/sbin/slattach does not exist or is not executable for %s' "$DEVICE")"
92         exit 1
93 }
94
95         echo > /var/run/sl-$DEVICE.dev
96         (logger -p daemon.info -t ifup-sl \
97         "$(nls 'slattach started for %s on %s at %s' "$DEVICE" "$MODEMPORT" "$LINESPEED")" &)&
98
99          slattach -p $PROTOCOL -s $LINESPEED $MODEMPORT &
100          usleep 1500
101          
102          if is_yes "$IPV4_NETWORKING"; then
103                 if [ -n "$IP4ADDR" -a -n "$REMIP" ]; then
104                         # Peer is only for IPv4
105                         ip -4 addr add $IP4ADDR peer $REMIP dev $DEVICE
106                 fi
107          fi
108
109          if is_yes "$IPV6_NETWORKING"; then
110                  if [ -n "$IP6ADDR" ]; then
111                          ip -6 addr add $IP6ADDR dev $DEVICE
112                  fi
113          fi
114          
115          ip link set $DEVICE mtu $MTU up
116
117          # IPv4/6 gateways and default routes
118          setup_ip_gw_ro
119                 
120          /etc/sysconfig/network-scripts/ifup-post $1
121
122 fi
123
124
125 # This must be last line !
126 # vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.093911 seconds and 3 git commands to generate.