You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.0 KiB

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