ethtool-lua: Initial packaging
authorKevin Jilissen <[email protected]>
Wed, 8 May 2024 17:56:16 +0000 (19:56 +0200)
committerEtienne Champetier <[email protected]>
Sun, 8 Jun 2025 21:04:34 +0000 (00:04 +0300)
The ethtool-lua library is a partial re-implementation of the ethtool.
The goal is to provide the CLI queries and configuration options as a
Lua API.

The reason for staring this library, was the desire for a nice and
efficient way to query DSA switch statistics in the
prometheus-node-exporter-lua on OpenWRT devices. Existing suggestions
around the internet focussed mainly on calling the ethtool CLI program
and parsing the output. This is neither elegant nor efficient, as the
collection time for this implementation was 300% higher on my rtl838x
based switch running OpenWRT.

This package can be easily compiled and packaged for OpenWRT, as it was
initially created as an OpenWRT package.

Signed-off-by: Kevin Jilissen <[email protected]>
[improve PKG_SOURCE/PKG_SOURCE_URL]
Signed-off-by: Etienne Champetier <[email protected]>
libs/ethtool-lua/Makefile [new file with mode: 0644]

diff --git a/libs/ethtool-lua/Makefile b/libs/ethtool-lua/Makefile
new file mode 100644 (file)
index 0000000..2fa6f54
--- /dev/null
@@ -0,0 +1,37 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ethtool-lua
+PKG_VERSION:=0.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/Kevinjil/ethtool-lua/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=e2716bf87487f8105a441420d003179ffcc5ef9575232846ace0150dfad0b504
+
+PKG_MAINTAINER:=Kevin Jilissen <[email protected]>
+PKG_LICENSE:=AGPL-3.0-or-later
+PKG_LICENSE_FILES:=COPYING
+
+CMAKE_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/ethtool-lua
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=ethtool lua library
+  URL:=https://github.com/kevinjil/ethtool-lua
+  DEPENDS:=+liblua
+endef
+
+define Package/ethtool-lua/description
+  ethtool-lua provides a lua library for gathering ethtool driver statistics.
+endef
+
+define Package/ethtool-lua/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua
+       $(CP) $(PKG_BUILD_DIR)/ethtool.so $(1)/usr/lib/lua/
+endef
+
+$(eval $(call BuildPackage,ethtool-lua))