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
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
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
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
--- /dev/null
+#!/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
+}