gluon-core: clean up uci config

This commit is contained in:
Matthias Schiffer 2013-10-03 18:46:54 +02:00
parent f0e56caa3c
commit 171fafc2ff
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 lan_ifname "$(uci get network.lan.ifname)"
sysconfig_set wan_ifname "$(uci get network.wan.ifname)"
sysconfig_set primary_mac "$(get_primary_mac)" sysconfig_set primary_mac "$(get_primary_mac)"

View File

@ -1,20 +1,19 @@
#!/bin/sh #!/bin/sh
. /lib/functions.sh
. /lib/gluon/functions/sysconfig.sh . /lib/gluon/functions/sysconfig.sh
uci -q batch <<EOF uci_remove network lan
delete network.lan
set network.wan.type='bridge' uci_set network wan type 'bridge'
set network.wan.proto='dhcp' uci_set network wan proto 'dhcp'
set network.wan.auto='1'
EOF EOF
local mainaddr=$(sysconfig primary_mac) mainaddr=$(sysconfig primary_mac)
local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS" oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
local b2mask=0x02 b2mask=0x02
case "$board" in case "$board" in
tl-wr1043nd|\ tl-wr1043nd|\
@ -22,8 +21,8 @@ tl-wdr3600|\
tl-wdr4300) # fix up duplicate mac addresses 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 )) ) 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 esac
uci commit network uci_commit network

View File

@ -1,40 +1,10 @@
#!/bin/sh #!/bin/sh
. /lib/ar71xx.sh . /lib/functions.sh
. /lib/gluon/functions/sysconfig.sh
board="$(ar71xx_board_name)" macaddr=$(sysconfig primary_mac)
case "$board" in uci_set system '@system[0]' hostname "@hostname_prefix@-${macaddr//:/}"
tl-wdr3600|\ uci_set system '@system[0]' timezone '@timezone@'
tl-wdr4300) uci_commit system
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