base-files: add a default /etc/services files (backport of r26142)
[openwrt-10.03/.git] / package / base-files / files / etc / init.d / network
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3
4 START=40
5 STOP=90
6
7 boot() {
8         setup_switch() { return 0; }
9
10         include /lib/network
11         setup_switch
12         grep -qs config /etc/config/wireless && {
13                 /sbin/wifi up
14         } || {
15                 rm -f /etc/config/wireless
16                 /sbin/wifi detect > /etc/config/wireless
17         }
18
19         scan_interfaces
20
21         local ifc
22         for ifc in $interfaces; do
23                 local proto
24                 config_get proto "$ifc" proto
25
26                 local auto
27                 config_get_bool auto "$ifc" auto 1
28
29                 type "coldplug_interface_$proto" >/dev/null && [ "$auto" = 1 ] && \
30                         coldplug_interface_$proto "$ifc"
31         done
32 }
33
34 start() {
35         setup_switch() { return 0; }
36         
37         include /lib/network
38         setup_switch
39         ifup -a
40         /sbin/wifi up
41 }
42
43 stop() {
44         ifdown -a
45 }
46
47 restart() {
48         start
49 }