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:
parent
c779d12369
commit
316e96a467
@ -1,15 +1,7 @@
|
|||||||
#!/usr/bin/lua
|
#!/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 platform = require 'gluon.platform'
|
||||||
local site = require 'gluon.site'
|
local sysconfig = require 'gluon.sysconfig'
|
||||||
|
|
||||||
local json = require 'jsonc'
|
local json = require 'jsonc'
|
||||||
local uci = require('simple-uci').cursor()
|
local uci = require('simple-uci').cursor()
|
||||||
@ -69,13 +61,11 @@ end
|
|||||||
if wan_ifname and lan_ifname then
|
if wan_ifname and lan_ifname then
|
||||||
sysconfig.wan_ifname = wan_ifname
|
sysconfig.wan_ifname = wan_ifname
|
||||||
sysconfig.lan_ifname = lan_ifname
|
sysconfig.lan_ifname = lan_ifname
|
||||||
|
sysconfig.single_ifname = nil
|
||||||
else
|
else
|
||||||
local single_ifname = lan_ifname or wan_ifname
|
sysconfig.wan_ifname = nil
|
||||||
if site.single_as_lan(false) then
|
sysconfig.lan_ifname = nil
|
||||||
sysconfig.lan_ifname = single_ifname
|
sysconfig.single_ifname = lan_ifname or wan_ifname
|
||||||
else
|
|
||||||
sysconfig.wan_ifname = single_ifname
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,13 +3,8 @@
|
|||||||
local platform = require 'gluon.platform'
|
local platform = require 'gluon.platform'
|
||||||
local sysconfig = require 'gluon.sysconfig'
|
local sysconfig = require 'gluon.sysconfig'
|
||||||
|
|
||||||
|
|
||||||
if sysconfig.setup_ifname then
|
|
||||||
os.exit(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
if platform.is_outdoor_device() then
|
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
|
else
|
||||||
sysconfig.setup_ifname = sysconfig.lan_ifname or sysconfig.wan_ifname
|
sysconfig.setup_ifname = sysconfig.single_ifname or sysconfig.lan_ifname
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user