Skip to content
Snippets Groups Projects
Commit 317478e2 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-mesh-batman-adv-core: don't break network configuration on upgrades with mesh_on_lan=true

parent a42db7a7
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require 'luci.model.uci'
local util = require 'gluon.util'
local sysconfig = require 'gluon.sysconfig'
local c = uci.cursor()
local uci = require('luci.model.uci').cursor()
local lutil = require 'luci.util'
if sysconfig.lan_ifname then
if not c:get('network', 'mesh_lan') then
c:section('network', 'interface', 'mesh_lan',
if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then
local enable = site.mesh_on_lan
if enable then
local interfaces = uci:get('network', 'client', 'ifname')
if interfaces and lutil.contains(interfaces:split(' '), sysconfig.lan_ifname) then
enable = false
end
end
uci:section('network', 'interface', 'mesh_lan',
{ ifname = sysconfig.lan_ifname
, proto = 'batadv'
, mesh = 'bat0'
, macaddr = util.generate_mac(1, 1)
, auto = site.mesh_on_lan and 1 or 0
})
end
, auto = enable and 1 or 0
})
uci:save('network')
uci:commit('network')
end
c:save('network')
c:commit('network')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment