From 054ba0ce9c4262f3642f2b8b29ce3dae659c35eb Mon Sep 17 00:00:00 2001 From: Kevin Jilissen Date: Wed, 8 May 2024 19:56:16 +0200 Subject: [PATCH] ethtool-lua: Initial packaging 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 [improve PKG_SOURCE/PKG_SOURCE_URL] Signed-off-by: Etienne Champetier --- libs/ethtool-lua/Makefile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 libs/ethtool-lua/Makefile diff --git a/libs/ethtool-lua/Makefile b/libs/ethtool-lua/Makefile new file mode 100644 index 0000000000..2fa6f5450c --- /dev/null +++ b/libs/ethtool-lua/Makefile @@ -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 +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)) -- 2.30.2