Last change
on this file since 334e4cf was ae024d6, checked in by Jim Gifford <clfs@…>, 18 years ago |
Bootscripts Updates
|
-
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 | PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
---|
9 |
|
---|
10 | . /etc/rc.d/init.d/functions
|
---|
11 | . /etc/network.conf
|
---|
12 |
|
---|
13 | if [ "$NETWORKING" != "yes" ]; then
|
---|
14 | echo "Networking is disabled in /etc/network.conf"
|
---|
15 | exit 0
|
---|
16 | fi
|
---|
17 |
|
---|
18 | case "$1" in
|
---|
19 | start)
|
---|
20 | for i in /etc/network.d/interface.*
|
---|
21 | do
|
---|
22 | if [ -r "$i" ]; then
|
---|
23 | . $i
|
---|
24 | if [ "$DHCP" = "yes" ]; then
|
---|
25 | echo -n "Starting DHCP for interface $INTERFACE: "
|
---|
26 | udhcpc -b -i "$INTERFACE" \
|
---|
27 | -p "/var/run/udhcpc.$INTERFACE.pid" \
|
---|
28 | > /dev/null
|
---|
29 | else
|
---|
30 | echo -n "Setting up interface $INTERFACE: "
|
---|
31 | ifconfig "$INTERFACE" "$IPADDRESS" \
|
---|
32 | netmask "$NETMASK" \
|
---|
33 | broadcast "$BROADCAST" up
|
---|
34 | fi
|
---|
35 | check_status
|
---|
36 | fi
|
---|
37 | done
|
---|
38 |
|
---|
39 | if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
|
---|
40 | echo -n "Setting default route: "
|
---|
41 | route add default gw $GATEWAY
|
---|
42 | check_status
|
---|
43 | fi
|
---|
44 | ;;
|
---|
45 | stop)
|
---|
46 | if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
|
---|
47 | echo -n "Removing default route: "
|
---|
48 | route del -net 0.0.0.0
|
---|
49 | check_status
|
---|
50 | fi
|
---|
51 |
|
---|
52 | for i in /etc/network.d/interface.*
|
---|
53 | do
|
---|
54 | if [ -r "$i" ]; then
|
---|
55 | . $i
|
---|
56 | echo -n "Shutting down interface $INTERFACE: "
|
---|
57 | ifconfig $INTERFACE down
|
---|
58 | check_status
|
---|
59 | if [ "$DHCP" = "yes" ]; then
|
---|
60 | kill `cat "/var/run/udhcpc.$INTERFACE.pid"`
|
---|
61 | sleep 1
|
---|
62 | fi
|
---|
63 | fi
|
---|
64 | done
|
---|
65 | ;;
|
---|
66 | restart)
|
---|
67 | $0 stop
|
---|
68 | $0 start
|
---|
69 | ;;
|
---|
70 | status)
|
---|
71 | ifconfig
|
---|
72 | route
|
---|
73 | ;;
|
---|
74 | *)
|
---|
75 | echo "Usage: $0 {start|stop|restart|status}"
|
---|
76 | exit 1
|
---|
77 | esac
|
---|
Note:
See
TracBrowser
for help on using the repository browser.