|
| 1 | +# |
| 2 | +# Author: Tibor Dudlák |
| 3 | +# |
| 4 | +# This is free software, licensed under the GNU General Public License v2. |
| 5 | +# See /LICENSE for more information. |
| 6 | +# |
| 7 | + |
| 8 | +include $(TOPDIR)/rules.mk |
| 9 | + |
| 10 | +PKG_NAME:=tang |
| 11 | +PKG_VERSION:=6 |
| 12 | +PKG_RELEASE:=1 |
| 13 | + |
| 14 | +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 15 | +PKG_SOURCE_URL:=https://github.com/latchset/$(PKG_NAME)/releases/download/v$(PKG_VERSION)/ |
| 16 | +PKG_HASH:=1df78b48a52d2ca05656555cfe52bd4427c884f5a54a2c5e37a7b39da9e155e3 |
| 17 | + |
| 18 | +PKG_INSTALL:=1 |
| 19 | +PKG_BUILD_PARALLEL:=1 |
| 20 | + |
| 21 | +PKG_FIXUP:=autoreconf |
| 22 | + |
| 23 | +include $(INCLUDE_DIR)/package.mk |
| 24 | + |
| 25 | +define Package/tang |
| 26 | + SECTION:=utils |
| 27 | + TITLE:=tang v$(PKG_VERSION) - daemon for binding data to the presence of a third party |
| 28 | + DEPENDS:=+libhttp-parser +xinetd +jose +bash |
| 29 | + URL:=https://github.com/latchset/tang |
| 30 | + MAINTAINER:=Tibor Dudlák <tibor.dudlak@gmail.com> |
| 31 | +endef |
| 32 | + |
| 33 | +define Package/tang/description |
| 34 | + Tang is a small daemon for binding data to the presence of a third party. |
| 35 | +endef |
| 36 | + |
| 37 | +define Package/tang/conffiles |
| 38 | +/etc/xinetd.d/tangdx |
| 39 | +/usr/share/tang/db/ |
| 40 | +endef |
| 41 | + |
| 42 | +define Package/tang/install |
| 43 | + $(INSTALL_DIR) $(1)/usr/libexec |
| 44 | + $(INSTALL_DIR) $(1)/etc/xinetd.d/ |
| 45 | + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/tangd* $(1)/usr/libexec/ |
| 46 | + $(INSTALL_BIN) ./files/tangdw $(1)/usr/libexec/ |
| 47 | + $(CP) ./files/tangdx $(1)/etc/xinetd.d/ |
| 48 | +endef |
| 49 | + |
| 50 | +define Package/tang/postinst |
| 51 | +#!/bin/sh |
| 52 | +if [ -z "$${IPKG_INSTROOT}" ]; then |
| 53 | + mkdir -p /usr/share/tang/db && mkdir -p /usr/share/tang/cache |
| 54 | + KEYS=$(find /usr/share/tang/db/ -name "*.jw*" -maxdepth 1 | wc -l) |
| 55 | + if [ "${KEYS}" = "0" ]; then # if db is empty generate new key pair |
| 56 | + /usr/libexec/tangd-keygen /usr/share/tang/db/ |
| 57 | + elif [ "${KEYS}" = "1" ]; then # having 1 key should not happen |
| 58 | + (>&2 echo "Please check the Tang's keys in /usr/share/tang/db \ |
| 59 | +and regenate cache using /usr/libexec/tangd-update script.") |
| 60 | + else |
| 61 | + /usr/libexec/tangd-update /usr/share/tang/db/ /usr/share/tang/cache/ |
| 62 | + fi |
| 63 | + (cat /etc/services | grep -E "tangd.*8888\/tcp") > /dev/null \ |
| 64 | + || echo -e "tangd\t\t8888/tcp" >> /etc/services |
| 65 | +fi |
| 66 | +endef |
| 67 | + |
| 68 | +$(eval $(call BuildPackage,tang)) |
0 commit comments