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.

73 lines
2.1 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:=7
  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:=fbe13e4e3103cd24cada7824b63e510cffd650832ecd075fd49b99475a4f9bfa
  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_FIXUP:=autoreconf
  18. PKG_INSTALL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. # This avoids generating man pages
  22. CONFIGURE_VARS += ac_cv_prog_A2X=
  23. define Package/tang
  24. SECTION:=utils
  25. TITLE:=tang v$(PKG_VERSION) - daemon for binding data to the presence of a third party
  26. DEPENDS:=+libhttp-parser +xinetd +jose +bash
  27. URL:=https://github.com/latchset/tang
  28. endef
  29. define Package/tang/description
  30. Tang is a small daemon for binding data to the presence of a third party.
  31. endef
  32. define Package/tang/conffiles
  33. /etc/xinetd.d/tangdx
  34. /usr/share/tang/db/
  35. endef
  36. define Package/tang/install
  37. $(INSTALL_DIR) $(1)/usr/libexec
  38. $(INSTALL_DIR) $(1)/etc/xinetd.d/
  39. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/tangd* $(1)/usr/libexec/
  40. $(INSTALL_BIN) ./files/tangdw $(1)/usr/libexec/
  41. $(CP) ./files/tangdx $(1)/etc/xinetd.d/
  42. endef
  43. define Package/tang/postinst
  44. #!/bin/sh
  45. if [ -z "$${IPKG_INSTROOT}" ]; then
  46. mkdir -p /usr/share/tang/db && mkdir -p /usr/share/tang/cache
  47. KEYS=$(find /usr/share/tang/db/ -name "*.jw*" -maxdepth 1 | wc -l)
  48. if [ "${KEYS}" = "0" ]; then # if db is empty generate new key pair
  49. /usr/libexec/tangd-keygen /usr/share/tang/db/
  50. elif [ "${KEYS}" = "1" ]; then # having 1 key should not happen
  51. (>&2 echo "Please check the Tang's keys in /usr/share/tang/db \
  52. and regenate cache using /usr/libexec/tangd-update script.")
  53. else
  54. /usr/libexec/tangd-update /usr/share/tang/db/ /usr/share/tang/cache/
  55. fi
  56. (cat /etc/services | grep -E "tangd.*8888\/tcp") > /dev/null \
  57. || echo -e "tangd\t\t8888/tcp" >> /etc/services
  58. fi
  59. endef
  60. $(eval $(call BuildPackage,tang))