fix nonhotpluggable networks not being brought up. Closes #2781
[lede.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=40
6
7 config_cb() {
8         local cfg_type="$1"
9
10         case "$cfg_type" in
11                 interface)
12                         append networks "$2" "$N"
13                 ;;
14         esac
15 }
16
17 boot() {
18         uci_load network
19         setup_switch() { return 0; }
20
21         include /lib/network
22         setup_switch
23         [ -s /etc/config/wireless ] || \
24                 /sbin/wifi detect > /etc/config/wireless
25         /sbin/wifi up
26         for network in $networks; do
27                 config_get startupcheck $network started
28                 [ "$startupcheck" = "" ] && ifup $network
29         done
30 }
31
32 start() {
33         ifup -a
34         /sbin/wifi up
35 }
36
37 restart() {
38         setup_switch() { return 0; }
39         
40         include /lib/network
41         setup_switch
42         ifup -a
43         /sbin/wifi up
44 }
45
46 stop() {
47         ifdown -a
48 }