diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig index 1e6c56d8..ea5ef0e2 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig @@ -2,18 +2,14 @@ local sysconfig = require 'gluon.sysconfig' local gluon_util = require 'gluon.util' +local platform = require 'gluon.platform' local fs = require 'luci.fs' local uci = require('luci.model.uci').cursor() local util = require 'luci.util' -local platform_info = require 'platform_info' - -local board_name = platform_info.get_board_name() - - -if board_name == 'tl-wdr3600' or board_name == 'tl-wdr4300' then +if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy1/macaddress')) else sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy0/macaddress')) @@ -29,7 +25,7 @@ local lan_ifname = uci:get('network', 'lan', 'ifname') local wan_ifname = uci:get('network', 'wan', 'ifname') -if board_name == 'nanostation-m' then +if platform.match('ar71xx', 'generic', {'nanostation-m'}) then lan_ifname, wan_ifname = wan_ifname, lan_ifname end diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 1bc3514f..851a8dc4 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -1,12 +1,12 @@ #!/usr/bin/lua local sysconfig = require 'gluon.sysconfig' +local platform = require 'gluon.platform' local uci = require('luci.model.uci').cursor() local util = require 'luci.util' local nixio = require 'nixio' -local platform_info = require 'platform_info' uci:delete('network', 'lan') @@ -21,7 +21,7 @@ uci:section('network', 'interface', 'wan', ) -if util.contains({'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}, platform_info.get_board_name()) then +if platform.match('ar71xx', 'generic', {'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}) then -- fix up duplicate mac addresses local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)') m1 = nixio.bit.bor(tonumber(m1, 16), 0x02) diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig index 52e91a3b..769309fb 100755 --- a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig +++ b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/001-sysconfig @@ -2,19 +2,14 @@ local sysconfig = require 'gluon.sysconfig' local gluon_util = require 'gluon.util' -local site = require 'gluon.site_config' +local platform = require 'gluon.platform' local fs = require 'luci.fs' local uci = require('luci.model.uci').cursor() local util = require 'luci.util' -local platform_info = require 'platform_info' - -local board_name = platform_info.get_board_name() - - -if board_name == 'tl-wdr3600' or board_name == 'tl-wdr4300' then +if platform.match('ar71xx', 'generic', {'tl-wdr3600', 'tl-wdr4300'}) then sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy1/macaddress')) else sysconfig.primary_mac = util.trim(fs.readfile('/sys/class/ieee80211/phy0/macaddress')) diff --git a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network index 79b63996..b6294371 100755 --- a/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network +++ b/package/gluon-legacy/files/lib/gluon/upgrade/core/legacy/011-gluon-network @@ -1,15 +1,15 @@ #!/usr/bin/lua local sysconfig = require 'gluon.sysconfig' +local platform = require 'gluon.platform' local uci = require('luci.model.uci').cursor() local util = require 'luci.util' local nixio = require 'nixio' -local platform_info = require 'platform_info' -if util.contains({'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}, platform_info.get_board_name()) then +if platform.match('ar71xx', 'generic', {'tl-wr1043nd', 'tl-wdr3600', 'tl-wdr4300'}) then -- fix up duplicate mac addresses local m1, m2, m3, m4, m5, m6 = string.match(sysconfig.primary_mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)') m1 = nixio.bit.bor(tonumber(m1, 16), 0x02) diff --git a/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname index 29757cdd..f1fef490 100755 --- a/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname +++ b/package/gluon-setup-mode/files/lib/gluon/upgrade/setup-mode/invariant/011-setup-ifname @@ -1,6 +1,6 @@ #!/usr/bin/lua -local platform_info = require 'platform_info' +local platform = require 'gluon.platform' local sysconfig = require 'gluon.sysconfig' @@ -8,7 +8,7 @@ if sysconfig.setup_ifname then os.exit(0) end -if platform_info.get_board_name() == 'nanostation-m' then +if platform.match('ar71xx', 'generic', {'nanostation-m'}) then sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.wan_ifname or sysconfig.lan_ifname else sysconfig.setup_ifname = sysconfig.config_ifname or sysconfig.lan_ifname or sysconfig.wan_ifname