forked from FreifunkFranken/firmware
/
98-configure-fff
39 lines (29 loc) · 1.09 KB
/
98-configure-fff
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
# Copyright 2017 Adrian Schmutzler
# License GPLv3
# Apply configuration
FFF_hostname=$(uci -q get "fff.system.hostname")
test -n "${FFF_hostname}" && uci set "system.@system[0].hostname=${FFF_hostname}"
test -n "${FFF_hostname}" && echo "${FFF_hostname}" > /proc/sys/kernel/hostname
uci commit system
# run configuration scripts
poe_passthrough=$(uci -q get "fff.poe_passthrough.active")
if [ "$poe_passthrough" = "1" ] && [ -s /usr/lib/fff-support/activate_poe_passthrough.sh ] ; then
/usr/lib/fff-support/activate_poe_passthrough.sh
fi
. /lib/functions/fff/wireless
if [ "$(uci -q get 'fff.wifi.disable24ghz')" = "1" ] ; then
radio="$(wifiGetPhy "2")"
[ -n "$radio" ] && uci set "wireless.${radio}.disabled=1"
fi
if [ "$(uci -q get 'fff.wifi.disable5ghz')" = "1" ] ; then
radio="$(wifiGetPhy "5")"
[ -n "$radio" ] && uci set "wireless.${radio}.disabled=1"
fi
if [ "$(uci -q get 'fff.wifi.disablewifi')" = "1" ] ; then
for phy in $(iw phy | awk '/^Wiphy/{ print $2 }'); do
radio="radio$(echo "$phy" | tr -d -C "0-9")"
uci set "wireless.${radio}.disabled=1"
done
fi
uci commit wireless
exit 0