tang: Add package into tree

Tang is lightweight server for binding data to network presence.
---
Tang's source: https://github.com/latchset/tang

Maintainer: @Tiboris

Compile tested: (mips, TL-WR842N, 17.01.4, r3560-79f57e422d)

**Tang requires a few other software libraries:**

1. libhttp-parser
2. xinetd's socket activation
3. jose >= 8

**Two new files compared to tang upstream:**
- tangdx : configuration file for xinetd
- tangdw : wrapper for tangd service
	- puts timestamp when service activated, and
	- redirects stderr to log file in /var/log/

**Removed systemd requirement**

Signed-off-by: Tibor Dudlák <tdudlak@redhat.com>
This commit is contained in:
Tibor Dudlák
2018-01-14 21:37:13 +01:00
parent 3b65a21c7c
commit b99d701318
6 changed files with 181 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
#
# Author: Tibor Dudlák
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=tang
PKG_VERSION:=6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/latchset/$(PKG_NAME)/releases/download/v$(PKG_VERSION)/
PKG_HASH:=1df78b48a52d2ca05656555cfe52bd4427c884f5a54a2c5e37a7b39da9e155e3
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.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
URL:=https://github.com/latchset/tang
MAINTAINER:=Tibor Dudlák <tibor.dudlak@gmail.com>
endef
define Package/tang/description
Tang is a small daemon for binding data to the presence of a third party.
endef
define Package/tang/conffiles
/etc/xinetd.d/tangdx
/usr/share/tang/db/
endef
define Package/tang/install
$(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_DIR) $(1)/etc/xinetd.d/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/tangd* $(1)/usr/libexec/
$(INSTALL_BIN) ./files/tangdw $(1)/usr/libexec/
$(CP) ./files/tangdx $(1)/etc/xinetd.d/
endef
define Package/tang/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
mkdir -p /usr/share/tang/db && mkdir -p /usr/share/tang/cache
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/
elif [ "${KEYS}" = "1" ]; then # having 1 key should not happen
(>&2 echo "Please check the Tang's keys in /usr/share/tang/db \
and regenate cache using /usr/libexec/tangd-update script.")
else
/usr/libexec/tangd-update /usr/share/tang/db/ /usr/share/tang/cache/
fi
(cat /etc/services | grep -E "tangd.*8888\/tcp") > /dev/null \
|| echo -e "tangd\t\t8888/tcp" >> /etc/services
fi
endef
$(eval $(call BuildPackage,tang))