applications/luci-ffwizzard: prevent infinite shell loop when compiling LuCI SDK
[project/luci.git] / applications / luci-ffwizard / root / etc / uci-defaults / device-defaults
1 #!/bin/sh
2
3 # prevent running on sdk
4 type config_get >/dev/null 2>/dev/null || exit 0
5
6 set_default_config()
7 {
8 local cfg="$1"
9 config_get type "$cfg" "type"
10 case $type in
11 atheros)
12 uci -q batch <<-EOF
13 set freifunk.wifi_device.channel=1
14 set freifunk.wifi_device.diversity=1
15 set freifunk.wifi_device.disabled=0
16 set freifunk.wifi_device.txpower=""
17 set freifunk.wifi_device.hwmode=11g
18 set freifunk.wifi_device.distance=1000
19 set freifunk.wifi_iface=defaults
20 set freifunk.wifi_iface.mode=adhoc
21 set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
22 set freifunk.wifi_iface.sw_merge=1
23 set freifunk.wifi_iface.mcast_rate=5500
24 set freifunk.wifi_iface.probereq=1
25 commit freifunk
26 EOF
27 ;;
28 mac80211)
29 uci -q batch <<-EOF
30 set freifunk.wifi_device.channel=1
31 set freifunk.wifi_device.diversity=1
32 set freifunk.wifi_device.disabled=0
33 set freifunk.wifi_device.txpower=""
34 set freifunk.wifi_device.distance=1000
35 set freifunk.wifi_device.htmode='HT40-'
36 set freifunk.wifi_device.hwmode=11ng
37 set freifunk.wifi_iface=defaults
38 set freifunk.wifi_iface.mode=adhoc
39 set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
40 set freifunk.wifi_iface.sw_merge=""
41 commit freifunk
42 EOF
43 ;;
44 broadcom)
45 uci -q batch <<-EOF
46 set freifunk.wifi_device.channel=1
47 set freifunk.wifi_device.diversity=1
48 set freifunk.wifi_device.disabled=0
49 set freifunk.wifi_device.txpower=""
50 set freifunk.wifi_device.hwmode=11g
51 set freifunk.wifi_device.distance=1000
52 set freifunk.wifi_iface=defaults
53 set freifunk.wifi_iface.encryption=none
54 set freifunk.wifi_iface.mode=adhoc
55 set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
56 set freifunk.wifi_iface.sw_merge=""
57 commit freifunk
58 EOF
59 ;;
60 esac
61 }
62
63
64
65 (
66 while true ; do
67 sleep 30
68 wifie=0
69
70 config_load wireless && wifie=1
71
72 if [ $wifie -eq 1 ] ; then
73 config_foreach set_default_config wifi-device
74
75 uci set freifunk.interface.dns="88.198.178.18 141.54.1.1 212.204.49.83 8.8.8.8 8.8.4.4"
76 uci commit freifunk
77 exit 0
78 fi
79 done
80 ) >/dev/null &