gluon/package/gluon-client-bridge/luasrc/lib/gluon/upgrade/300-gluon-client-bridge-network
Matthias Schiffer 9a5a8e0ab0
gluon-client-bridge: add LAN interfaces to client bridge by default (instead of doing this in the batman-adv-specific scripts)
This allows to weaken the gluon-mesh-batman-adv-core dependency of
gluon-luci-portconfig to gluon-client-bridge.
2016-09-07 02:14:42 +02:00

34 lines
773 B
Lua
Executable File

#!/usr/bin/lua
local sysconfig = require 'gluon.sysconfig'
local lutil = require 'luci.util'
local uci = require('luci.model.uci').cursor()
uci:section('network', 'interface', 'client',
{
type = 'bridge',
}
)
local ifname = uci:get('network', 'client', 'ifname')
if type(ifname) == 'string' then
uci:delete('network', 'client', 'ifname')
for x in ifname:gmatch("[^%s]+") do
uci:add_to_set('network', 'client', 'ifname', x)
end
end
if sysconfig.lan_ifname and not ifname and not uci:get_bool('network', 'mesh_lan', 'auto') then
for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
uci:add_to_set('network', 'client', 'ifname', lanif)
end
end
uci:set('network', 'client', 'macaddr', sysconfig.primary_mac)
uci:save('network')