autocore: add ethtool back for x86

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2022-03-22 01:26:41 +08:00
parent 771deecb70
commit fb77c8a51a
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 3 additions and 5 deletions

View File

@ -27,7 +27,7 @@ endef
define Package/autocore-x86
TITLE:=x86/x64 auto core loadbalance script
MAINTAINER:=Lean
DEPENDS:=@TARGET_x86 +lm-sensors
DEPENDS:=@TARGET_x86 +lm-sensors +ethtool
VARIANT:=x86
endef

View File

@ -4,11 +4,10 @@
local util = require "luci.util"
local jsonc = require "luci.jsonc"
local eth_info = {}
local ifname, stat
for ifname, stat in pairs(util.ubus("network.device", "status")) do
if ifname:match("^(eth[0-9]+)$") == ifname then
if ifname:match("^(eth%d+)$") == ifname then
local status, speed, duplex
status = stat.carrier and 1 or 0
@ -32,8 +31,7 @@ end
table.sort(eth_info,
function(a, b)
return tonumber(a.name:match("eth([0-9]+)$")) <
tonumber(b.name:match("eth([0-9]+)$"))
return a.name < b.name
end)
print(jsonc.stringify(eth_info))