4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
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
18 PKG_MAINTAINER
:=Tibor Dudlák
<tibor.dudlak@gmail.com
>
19 PKG_LICENSE
:=GPL-3.0
-or-later
20 PKG_LICENSE_FILES
:=COPYING
23 PKG_BUILD_DEPENDS
:=meson
/host
25 include $(INCLUDE_DIR
)/package.mk
26 include ..
/..
/devel
/meson
/meson.mk
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
35 define Package
/tang
/description
36 Tang is a small daemon for binding data to the presence of a third party.
39 define Package
/tang
/conffiles
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
/
52 define Package
/tang
/postinst
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.")
63 /usr
/libexec
/tangd-update
/usr
/share
/tang
/db
/ /usr
/share
/tang
/cache
/
65 (cat
/etc
/services | grep
-E
"tangd.*8888\/tcp") > /dev
/null \
66 || echo
-e
"tangd\t\t8888/tcp" >> /etc
/services
70 $(eval
$(call BuildPackage
,tang
))