tang: updated to version 12

This version enables standalone operation.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
Nikos Mavrogiannopoulos 2023-04-12 20:19:10 +02:00
parent 4bd7befa6a
commit c3d09dfaa3
6 changed files with 38 additions and 27 deletions

View File

@ -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 <tibor.dudlak@gmail.com>
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

4
utils/tang/files/config Normal file
View File

@ -0,0 +1,4 @@
config tang 'config'
option port '9090'
option enabled '0'

View File

@ -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
}

View File

@ -0,0 +1 @@
/usr/share/tang/db/*.jw*

View File

@ -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

View File

@ -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
}