lpac: add package master
authorDavid Bauer <mail@david-bauer.net>
Thu, 14 Mar 2024 22:26:46 +0000 (23:26 +0100)
committerDavid Bauer <mail@david-bauer.net>
Wed, 15 May 2024 14:03:28 +0000 (16:03 +0200)
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 <mail@david-bauer.net>
utils/lpac/Makefile [new file with mode: 0644]
utils/lpac/files/lpac.sh [new file with mode: 0644]
utils/lpac/files/lpac.uci [new file with mode: 0644]

diff --git a/utils/lpac/Makefile b/utils/lpac/Makefile
new file mode 100644 (file)
index 0000000..189f5ad
--- /dev/null
@@ -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 <mail@david-bauer.net>
+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 (file)
index 0000000..1eda622
--- /dev/null
@@ -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 (file)
index 0000000..9eeacd1
--- /dev/null
@@ -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'