The generic upgrade script is moved to run after the more specific scripts. In addition, the script will now remove the configuration sections of uninstalled VPN packages, so both positive and negative changes of the default enable state can be migrated correctly. Based-on-patch-by: Cyrus Fox <cyrus@lambdacore.de> Fixes: #1187
34 lines
851 B
Lua
Executable File
34 lines
851 B
Lua
Executable File
#!/usr/bin/lua
|
|
|
|
local site = require 'gluon.site_config'
|
|
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')
|