From: Nikos Mavrogiannopoulos Date: Wed, 12 Apr 2023 18:19:10 +0000 (+0200) Subject: tang: updated to version 12 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=c3d09dfaa3dc284602f6e1736a4b34be958af993;p=feed%2Fpackages.git tang: updated to version 12 This version enables standalone operation. Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/utils/tang/Makefile b/utils/tang/Makefile index 6dff7c88c4..005fe4d50c 100644 --- a/utils/tang/Makefile +++ b/utils/tang/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tang -PKG_VERSION:=11 -PKG_RELEASE:=3 +PKG_VERSION:=12 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/latchset/$(PKG_NAME)/releases/download/v$(PKG_VERSION)/ -PKG_HASH:=ef5d3ae56030f20c290594b9be89ad9ec469dd385676595e1c7a2bfdc3f45d8f +PKG_HASH:=892e0b26ee2db01f2c257b083fbb85aede7d3f59de7361c9c9528c0d5783e69c PKG_MAINTAINER:=Tibor Dudlák PKG_LICENSE:=GPL-3.0-or-later @@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/meson.mk define Package/tang SECTION:=utils TITLE:=tang v$(PKG_VERSION) - daemon for binding data to the presence of a third party - DEPENDS:=+libhttp-parser +xinetd +jose +bash + DEPENDS:=+libhttp-parser +jose +bash URL:=https://github.com/latchset/tang endef @@ -34,18 +34,18 @@ define Package/tang/description endef define Package/tang/conffiles -/etc/xinetd.d/tangdx /usr/share/tang/db/ endef define Package/tang/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/libexec - $(INSTALL_DIR) $(1)/etc/xinetd.d/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tang-show-keys $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/tangd* $(1)/usr/libexec/ - $(INSTALL_BIN) ./files/tangdw $(1)/usr/libexec/ - $(CP) ./files/tangdx $(1)/etc/xinetd.d/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/tang.init $(1)/etc/init.d/tang + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/config $(1)/etc/config/tang endef define Package/tang/postinst @@ -54,10 +54,8 @@ if [ -z "$${IPKG_INSTROOT}" ]; then mkdir -p /usr/share/tang/db KEYS=$(find /usr/share/tang/db/ -name "*.jw*" -maxdepth 1 | wc -l) if [ "${KEYS}" = "0" ]; then # if db is empty generate new key pair - /usr/libexec/tangd-keygen /usr/share/tang/db/ + /usr/libexec/tangd-keygen /usr/share/tang/db fi - (cat /etc/services | grep -E "tangd.*8888\/tcp") > /dev/null \ - || echo -e "tangd\t\t8888/tcp" >> /etc/services fi endef diff --git a/utils/tang/files/config b/utils/tang/files/config new file mode 100644 index 0000000000..1b37d3deb4 --- /dev/null +++ b/utils/tang/files/config @@ -0,0 +1,4 @@ +config tang 'config' + option port '9090' + option enabled '0' + diff --git a/utils/tang/files/tang.init b/utils/tang/files/tang.init new file mode 100644 index 0000000000..9ce89c1586 --- /dev/null +++ b/utils/tang/files/tang.init @@ -0,0 +1,24 @@ +#!/bin/sh /etc/rc.common + +START=50 +USE_PROCD=1 + +start_service() { + KEYS=$(find /usr/share/tang/db -name "*.jw*" -maxdepth 1 | wc -l) + if [ -z "${KEYS}" ] || [ "${KEYS}" = "0" ]; then # if db is empty generate new key pair + mkdir -p /usr/share/tang/db + /usr/libexec/tangd-keygen /usr/share/tang/db + fi + + config_load "tang" + config_get_bool enabled "config" "enabled" 0 + config_get port "config" "port" "9090" + + [ "${enabled}" = "1" ] || return + + procd_open_instance + procd_set_param command /usr/libexec/tangd -p "${port}" -l /usr/share/tang/db + procd_set_param respawn + procd_set_param user tang + procd_close_instance +} diff --git a/utils/tang/files/tang.upgrade b/utils/tang/files/tang.upgrade new file mode 100644 index 0000000000..82623f64e3 --- /dev/null +++ b/utils/tang/files/tang.upgrade @@ -0,0 +1 @@ +/usr/share/tang/db/*.jw* diff --git a/utils/tang/files/tangdw b/utils/tang/files/tangdw deleted file mode 100755 index 91c8a89650..0000000000 --- a/utils/tang/files/tangdw +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -echo "==================================" >> /var/log/tangd.log -echo `date`: >> /var/log/tangd.log -/usr/libexec/tangd $1 2>> /var/log/tangd.log diff --git a/utils/tang/files/tangdx b/utils/tang/files/tangdx deleted file mode 100644 index bd2134eae3..0000000000 --- a/utils/tang/files/tangdx +++ /dev/null @@ -1,12 +0,0 @@ -service tangd -{ - port = 8888 - socket_type = stream - wait = no - user = root - server = /usr/libexec/tangdw - server_args = /usr/share/tang/db - log_on_success += USERID - log_on_failure += USERID - disable = no -}