gluon/package/gluon-mesh-vpn-tunneldigger/luasrc/lib/gluon/upgrade/400-mesh-vpn-tunneldigger
Matthias Schiffer ee6afaced9
treewide: use new gluon.site Lua library
Some files have received some additional refactoring.
2017-08-11 22:07:34 +02:00

34 lines
846 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site'
local util = require 'gluon.util'
local uci = require('simple-uci').cursor()
local enabled
-- Delete old broker config section (remove in 2019)
if not uci:get('tunneldigger', 'mesh_vpn') then
if uci:get_first('tunneldigger', 'broker', 'interface') == 'mesh-vpn' then
enabled = uci:get_first('tunneldigger', 'broker', 'enabled')
end
-- In the usual case (no migration from old tunneldigger package), the
-- enabled state is set in the 500-mesh-vpn script
uci:delete_all('tunneldigger', 'broker')
end
uci:section('tunneldigger', 'broker', 'mesh_vpn', {
enabled = enabled,
uuid = util.node_id(),
interface = 'mesh-vpn',
bind_interface = 'br-wan',
group = 'gluon-mesh-vpn',
broker_selection = 'usage',
address = site.mesh_vpn.tunneldigger.brokers(),
})
uci:save('tunneldigger')