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 <info@kevinjilissen.nl>
[improve PKG_SOURCE/PKG_SOURCE_URL]
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
This commit is contained in:
Kevin Jilissen
2024-05-08 19:56:16 +02:00
committed by Etienne Champetier
parent b4cd95e202
commit 054ba0ce9c

37
libs/ethtool-lua/Makefile Normal file
View File

@@ -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 <info@kevinjilissen.nl>
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))