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