[package] base-files: also regenerate wifi config if existing config contains only...
[openwrt.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
20 start() {
21         setup_switch() { return 0; }
22         
23         include /lib/network
24         setup_switch
25         ifup -a
26         /sbin/wifi up
27 }
28
29 stop() {
30         ifdown -a
31 }
32
33 restart() {
34         start
35 }