source: clfs-embedded/bootscripts/clfs/rc.d/init.d/network@ e5cc0ec

Last change on this file since e5cc0ec was 381c53b, checked in by Jim Gifford <clfs@…>, 18 years ago

Updates to bootscripts

  • Property mode set to 100755
File size: 1.4 KB
Line 
1#!/bin/ash
2#
3# Network interface(s) init script
4#
5# config: /etc/network.conf
6# /etc/network.d/interface.[devname]
7
8. /etc/rc.d/init.d/functions
9. /etc/network.conf
10
11if [ "$NETWORKING" != "yes" ]; then
12 echo "Networking is disabled in /etc/network.conf"
13 exit 0
14fi
15
16case "$1" in
17start)
18 for i in /etc/network.d/interface.*
19 do
20 if [ -r "$i" ]; then
21 . $i
22 if [ "$DHCP" = "yes" ]; then
23 echo -n "Starting DHCP for interface $INTERFACE: "
24 udhcpc -b -i "$INTERFACE" \
25 -p "/var/run/udhcpc.$INTERFACE.pid" \
26 > /dev/null
27 else
28 echo -n "Setting up interface $INTERFACE: "
29 ifconfig "$INTERFACE" "$IPADDRESS" \
30 netmask "$NETMASK" \
31 broadcast "$BROADCAST" up
32 fi
33 check_status
34 fi
35 done
36
37 if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
38 echo -n "Setting default route: "
39 route add default gw $GATEWAY
40 check_status
41 fi
42 ;;
43stop)
44 if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
45 echo -n "Removing default route: "
46 route del -net 0.0.0.0
47 check_status
48 fi
49
50 for i in /etc/network.d/interface.*
51 do
52 if [ -r "$i" ]; then
53 . $i
54 echo -n "Shutting down interface $INTERFACE: "
55 ifconfig $INTERFACE down
56 check_status
57 if [ "$DHCP" = "yes" ]; then
58 kill `cat "/var/run/udhcpc.$INTERFACE.pid"`
59 sleep 1
60 fi
61 fi
62 done
63 ;;
64restart)
65 $0 stop
66 $0 start
67 ;;
68status)
69 ifconfig
70 route
71 ;;
72*)
73 echo "Usage: $0 {start|stop|restart|status}"
74 exit 1
75esac
Note: See TracBrowser for help on using the repository browser.