summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-ffwizard/root/etc/uci-defaults/device-defaults
blob: bbad46ea2ea5c98e2dea29b7ddae3fd5baf6744c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/sh

set_default_config()
{
	local cfg="$1"
	config_get type "$cfg" "type"
	case $type in
		atheros)
			uci -q batch <<-EOF
				set freifunk.wifi_device.channel=1
				set freifunk.wifi_device.diversity=0
				set freifunk.wifi_device.txantenna=1
				set freifunk.wifi_device.rxantenna=1
				set freifunk.wifi_device.disabled=0
				set freifunk.wifi_device.txpower=""
				set freifunk.wifi_device.country=276
				set freifunk.wifi_device.regdomain="0x37"
				set freifunk.wifi_device.outdoor="1"
				set freifunk.wifi_device.hwmode=11g
				set freifunk.wifi_device.distance=1000
				set freifunk.wifi_iface=defaults
				set freifunk.wifi_iface.mode=adhoc
				set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
				set freifunk.wifi_iface.sw_merge=1
				set freifunk.wifi_iface.mcast_rate=5500
				set freifunk.wifi_iface.probereq=1
				commit freifunk
			EOF
		;;
		mac80211)
			uci -q batch <<-EOF
				set freifunk.wifi_device.channel=1
				set freifunk.wifi_device.diversity=""
				set freifunk.wifi_device.disabled=0
				set freifunk.wifi_device.txpower=""
				set freifunk.wifi_device.country=DE
				set freifunk.wifi_device.distance=1000
				set freifunk.wifi_device.htmode='HT40-'
				set freifunk.wifi_device.hwmode=11ng
				set freifunk.wifi_iface=defaults
				set freifunk.wifi_iface.mode=adhoc
				set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
				set freifunk.wifi_iface.sw_merge=""
				commit freifunk
			EOF
		;;
		broadcom)
			uci -q batch <<-EOF
				set freifunk.wifi_device.channel=1
				set freifunk.wifi_device.diversity=""
				set freifunk.wifi_device.disabled=0
				set freifunk.wifi_device.txpower=""
				set freifunk.wifi_device.country=DE
				set freifunk.wifi_device.txantenna=0
				set freifunk.wifi_device.rxantenna=0
				set freifunk.wifi_device.hwmode=11g
				set freifunk.wifi_device.distance=1000
				set freifunk.wifi_iface=defaults
				set freifunk.wifi_iface.encryption=none
				set freifunk.wifi_iface.mode=adhoc
				set freifunk.wifi_iface.bssid="02:CA:FF:EE:BA:BE"
				set freifunk.wifi_iface.sw_merge=""
				commit freifunk
			EOF
		;;
	esac
}



(
while true ; do
	sleep 30
	wifie=0

	config_load wireless && wifie=1

	if [ $wifie -eq 1 ] ; then
		config_foreach set_default_config wifi-device

		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"
		uci commit freifunk
		exit 0
	fi
done
) >/dev/null &