gluon-core, gluon-setup-mode: reset ifname sysconfigs on each update, introduce single_ifname

Allow interface names to change on updates to handle hwconfig -> DSA and
similar migrations.

On devices with only a single interface, a sysconfig single_ifname is
created instead of wan_ifname or lan_ifname to allow separate
configuration in site.conf.
This commit is contained in:
Matthias Schiffer 2021-12-28 20:47:26 +01:00
parent c779d12369
commit 316e96a467
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 7 additions and 22 deletions

View File

@ -1,15 +1,7 @@
#!/usr/bin/lua
local sysconfig = require 'gluon.sysconfig'
-- Are we already set up?
if sysconfig.lan_ifname or sysconfig.wan_ifname then
os.exit(0)
end
local platform = require 'gluon.platform'
local site = require 'gluon.site'
local sysconfig = require 'gluon.sysconfig'
local json = require 'jsonc'
local uci = require('simple-uci').cursor()
@ -69,13 +61,11 @@ end
if wan_ifname and lan_ifname then
sysconfig.wan_ifname = wan_ifname
sysconfig.lan_ifname = lan_ifname
sysconfig.single_ifname = nil
else
local single_ifname = lan_ifname or wan_ifname
if site.single_as_lan(false) then
sysconfig.lan_ifname = single_ifname
else
sysconfig.wan_ifname = single_ifname
end
sysconfig.wan_ifname = nil
sysconfig.lan_ifname = nil
sysconfig.single_ifname = lan_ifname or wan_ifname
end

View File

@ -3,13 +3,8 @@
local platform = require 'gluon.platform'
local sysconfig = require 'gluon.sysconfig'
if sysconfig.setup_ifname then
os.exit(0)
end
if platform.is_outdoor_device() then
sysconfig.setup_ifname = sysconfig.wan_ifname or sysconfig.lan_ifname
sysconfig.setup_ifname = sysconfig.single_ifname or sysconfig.wan_ifname
else
sysconfig.setup_ifname = sysconfig.lan_ifname or sysconfig.wan_ifname
sysconfig.setup_ifname = sysconfig.single_ifname or sysconfig.lan_ifname
end