From: David Bauer Date: Thu, 14 Mar 2024 22:26:46 +0000 (+0100) Subject: lpac: add package X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=dc1e0d91a5e198663b9013226b4b36f5029387d0;p=feed%2Fpackages.git lpac: add package lpac is a eUICC eSIM LPA manager written in C. It allows to manage eSIM profiles on eUICC SIM cards or modules using multiple backends. Signed-off-by: David Bauer --- diff --git a/utils/lpac/Makefile b/utils/lpac/Makefile new file mode 100644 index 0000000000..189f5ad1f5 --- /dev/null +++ b/utils/lpac/Makefile @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: AGPL-3.0-only + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lpac +PKG_VERSION:=2.0.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/estkme-group/lpac/tar.gz/refs/tags/v$(PKG_VERSION)? +PKG_HASH:=6afa88ed7d38ba5973a540d818c800083368ac82b3b09ac6fd18f7929b830b0a + +PKG_MAINTAINER:=David Bauer +PKG_LICENSE:=AGPL-3.0-only LGPL-2.0-only + +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/lpac + SECTION:=utils + CATEGORY:=Utilities + TITLE:=eUICC eSIM LPA written in C + DEPENDS:=+libpcsclite +pcscd +libcurl + URL:=https://github.com/estkme-group/lpac +endef + +define Package/lpac/description + lpac is a eUICC eSIM LPA manager written in C. It allows to + manage eSIM profiles on eUICC SIM cards or modules using multiple + backends. +endef + +define Package/lpac/conffiles +/etc/config/lpac +endef + +TARGET_CFLAGS += $(FPIC) + +define Package/lpac/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) ./files/lpac.sh $(1)/usr/bin/lpac + + $(INSTALL_DIR) $(1)/etc/config + $(CP) ./files/lpac.uci $(1)/etc/config/lpac + + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lpac $(1)/usr/lib/lpac +endef + +$(eval $(call BuildPackage,lpac)) diff --git a/utils/lpac/files/lpac.sh b/utils/lpac/files/lpac.sh new file mode 100644 index 0000000000..1eda622244 --- /dev/null +++ b/utils/lpac/files/lpac.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +. /lib/config/uci.sh + +APDU_BACKEND="$(uci_get lpac global apdu_backend at)" +APDU_DEBUG="$(uci_get lpac global apdu_debug 0)" + +HTTP_BACKEND="$(uci_get lpac global http_backend curl)" +HTTP_DEBUG="$(uci_get lpac global http_debug 0)" + +AT_DEVICE="$(uci_get lpac at device /dev/ttyUSB2)" +AT_DEBUG="$(uci_get lpac at debug 0)" + +export LPAC_HTTP="$HTTP_BACKEND" +if [ "$HTTP_DEBUG" -eq 1 ]; then + export LIBEUICC_DEBUG_HTTP="1" +fi + +export LPAC_APDU="$APDU_BACKEND" +if [ "$APDU_DEBUG" -eq 1 ]; then + export LIBEUICC_DEBUG_APDU="1" +fi + +export AT_DEVICE="$AT_DEVICE" +export AT_DEBUG="$AT_DEBUG" + +/usr/lib/lpac "$@" diff --git a/utils/lpac/files/lpac.uci b/utils/lpac/files/lpac.uci new file mode 100644 index 0000000000..9eeacd1d3c --- /dev/null +++ b/utils/lpac/files/lpac.uci @@ -0,0 +1,9 @@ +config global global + option apdu_backend 'at' + option http_backend 'curl' + option apdu_debug '0' + option http_debug '0' + +config at at + option device '/dev/ttyUSB2' + option debug '0'