gluon-mesh-batman-adv: clean up config script

This commit is contained in:
Matthias Schiffer 2013-10-03 19:02:06 +02:00
parent 8b069954a0
commit 7edb775444

View File

@ -1,33 +1,20 @@
#!/bin/sh #!/bin/sh
. /lib/functions.sh
. /lib/gluon/functions/sysconfig.sh . /lib/gluon/functions/sysconfig.sh
uci -q batch <<EOF uci_remove batman-adv bat0
delete batman-adv.bat0 uci_add batman-adv mesh bat0
uci_set batman-adv bat0 orig_interval '5000'
uci_commit batman-adv
set batman-adv.bat0='mesh' uci_add network interface client
set batman-adv.bat0.orig_interval='5000' uci_set network client ifname "$(sysconfig lan_ifname) bat0"
uci_set network client type 'bridge'
uci_set network client proto 'dhcpv6'
uci_set network client reqprefix 'no'
uci_set network client peerdns '0'
uci_set network client macaddr "$(sysconfig primary_mac)"
commit batman-adv uci_commit network
set network.client='interface'
set network.client.ifname='$(sysconfig lan_ifname) bat0'
set network.client.type='bridge'
set network.client.proto='dhcpv6'
set network.client.reqprefix='no'
set network.client.peerdns='0'
EOF
local mainaddr=$(sysconfig primary_mac)
local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
local b2mask=0x02
local vpnaddr=$(printf "%02x:%s:%s:%02x:%s:%s" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $6)
uci set network.client.macaddr="$mainaddr"
uci set network.mesh_vpn.macaddr="$vpnaddr"
uci commit network