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

Last change on this file since 4230d00 was f25bf53, checked in by Jim Gifford <clfs@…>, 16 years ago

Formatting change to embedded

  • Property mode set to 100755
File size: 1.5 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.*; do
19 if [ -r "$i" ]; then
20 . $i
21 if [ "$DHCP" = "yes" ]; then
22 echo -n "Starting DHCP for interface $INTERFACE: "
23 udhcpc -b -i "$INTERFACE" \
24 -p "/var/run/udhcpc.$INTERFACE.pid" \
25 > /dev/null
26 else
27 echo -n "Setting up interface $INTERFACE: "
28 ifconfig "$INTERFACE" "$IPADDRESS" \
29 netmask "$NETMASK" \
30 broadcast "$BROADCAST" up
31 fi
32 check_status
33 fi
34 done
35
36 if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
37 echo -n "Setting default route: "
38 route add default gw $GATEWAY
39 check_status
40 fi
41;;
42stop)
43 if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
44 echo -n "Removing default route: "
45 route del -net 0.0.0.0
46 check_status
47 fi
48
49 for i in /etc/network.d/interface.*; do
50 if [ -r "$i" ]; then
51 . $i
52 echo -n "Shutting down interface $INTERFACE: "
53 ifconfig $INTERFACE down
54 check_status
55 if [ "$DHCP" = "yes" ]; then
56 kill `cat "/var/run/udhcpc.$INTERFACE.pid"`
57 sleep 1
58 fi
59 fi
60 done
61;;
62restart)
63 $0 stop
64 $0 start
65;;
66status)
67 ifconfig
68 route
69;;
70*)
71 echo "Usage: $0 {start|stop|restart|status}"
72 exit 1
73esac
Note: See TracBrowser for help on using the repository browser.