gluon/package/gluon-mesh-babel/files/lib/gluon/upgrade/330-gluon-mesh-babel-interfaces
Christof Schulze 7f66481a70 pretty-print
2016-09-09 00:22:45 +02:00

34 lines
861 B
Lua
Executable File

#!/usr/bin/lua
local uci = require('luci.model.uci').cursor()
local site = require 'gluon.site_config'
local interfaces='/lib/gluon/core/mesh_interfaces'
if site.mesh_on_wan then
uci:section('babeld', 'interface', 'mesh_wan',
{
ifname = 'br-wan',
}
)
uci:add_to_set('firewall', 'mesh_babel', 'network', 'wan')
end
uci:delete_all('babeld', 'interface')
pcall(function()
for interface in io.lines(interfaces) do
int = string.gsub(interface,'[.-]','_')
uci:section('babeld', 'interface', 'interface_' .. int, { ifname = interface })
end
end)
uci:add_to_set('firewall', 'mesh_babel', 'network', 'client')
uci:add_to_set('firewall', 'mesh_babel', 'network', 'local_node4')
uci:add_to_set('firewall', 'mesh_babel', 'network', 'local_node6')
uci:save('babeld')
uci:save('firewall')
uci:commit('babeld')
uci:commit('firewall')