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.

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