gluon-core: clean up uci config

This commit is contained in:
Matthias Schiffer 2013-10-03 18:46:54 +02:00
parent 6729bf37ef
commit 8b069954a0
3 changed files with 16 additions and 46 deletions

View File

@ -17,4 +17,5 @@ get_primary_mac() {
sysconfig_set lan_ifname "$(uci get network.lan.ifname)"
sysconfig_set wan_ifname "$(uci get network.wan.ifname)"
sysconfig_set primary_mac "$(get_primary_mac)"

View File

@ -1,20 +1,19 @@
#!/bin/sh
. /lib/functions.sh
. /lib/gluon/functions/sysconfig.sh
uci -q batch <<EOF
delete network.lan
uci_remove network lan
set network.wan.type='bridge'
set network.wan.proto='dhcp'
set network.wan.auto='1'
uci_set network wan type 'bridge'
uci_set network wan proto 'dhcp'
EOF
local mainaddr=$(sysconfig primary_mac)
local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
local b2mask=0x02
mainaddr=$(sysconfig primary_mac)
oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
b2mask=0x02
case "$board" in
tl-wr1043nd|\
@ -22,8 +21,8 @@ tl-wdr3600|\
tl-wdr4300) # fix up duplicate mac addresses
local wanaddr=$(printf "%02x:%s:%s:%02x:%s:%02x" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $(( (0x$6 + 1) % 0x100 )) )
uci set network.wan.macaddr="$wanaddr"
uci_set network wan macaddr "$wanaddr"
;;
esac
uci commit network
uci_commit network

View File

@ -1,40 +1,10 @@
#!/bin/sh
. /lib/ar71xx.sh
. /lib/functions.sh
. /lib/gluon/functions/sysconfig.sh
board="$(ar71xx_board_name)"
macaddr=$(sysconfig primary_mac)
case "$board" in
tl-wdr3600|\
tl-wdr4300)
macaddr="$(cat /sys/class/ieee80211/phy1/macaddress)"
uci -q batch <<EOF
set system.led_wlan2g.trigger='netdev'
set system.led_wlan2g.dev='wlan0'
set system.led_wlan2g.mode='link'
set system.led_wlan5='led'
set system.led_wlan5.name='WLAN5'
set system.led_wlan5.sysfs='ath9k-phy1'
set system.led_wlan5.trigger='netdev'
set system.led_wlan5.dev='wlan1'
set system.led_wlan5.mode='link'
EOF
;;
*)
macaddr="$(cat /sys/class/ieee80211/phy0/macaddress)"
uci -q batch <<EOF
set system.led_wlan.trigger='netdev'
set system.led_wlan.dev='wlan0'
set system.led_wlan.mode='link'
EOF
;;
esac
uci -q batch <<EOF
set system.@system[0].hostname='@hostname_prefix@-${macaddr//:/}'
set system.@system[0].timezone='CET-1CEST,M3.5.0,M10.5.0/3'
commit system
EOF
uci_set system '@system[0]' hostname "@hostname_prefix@-${macaddr//:/}"
uci_set system '@system[0]' timezone '@timezone@'
uci_commit system