svn commit: r370885 - in head: . net-im/tox net-im/tox/files
Thierry Thomas
thierry at FreeBSD.org
Tue Oct 14 20:55:21 UTC 2014
Author: thierry
Date: Tue Oct 14 20:55:19 2014
New Revision: 370885
URL: https://svnweb.freebsd.org/changeset/ports/370885
QAT: https://qat.redports.org/buildarchive/r370885/
Log:
Add an option to build and run a Tox DHT Bootstrap Node.
More details at https://blog.libtoxcore.so/running-a-bootstrap-node
Added:
head/net-im/tox/files/
head/net-im/tox/files/tox-bootstrapd.in (contents, props changed)
head/net-im/tox/pkg-message.daemon (contents, props changed)
Modified:
head/UIDs
head/net-im/tox/Makefile
head/net-im/tox/pkg-plist
Modified: head/UIDs
==============================================================================
--- head/UIDs Tue Oct 14 20:47:56 2014 (r370884)
+++ head/UIDs Tue Oct 14 20:55:19 2014 (r370885)
@@ -307,4 +307,5 @@ tvheadend:*:984:984::0:0:TV Headend:/usr
puppetdb:*:985:985::0:0:PuppetDB Daemon pseudo-user:/nonexistent:/usr/sbin/nologin
kamailio:*:986:986::0:0:kamailio daemon:/nonexistent:/usr/sbin/nologin
spark:*:987:987::0:0:Apache Spark user:/nonexistent:/usr/sbin/nologin
+toxdht:*:988:65534::0:0:Tox DHT bootstrap user:/nonexistent:/usr/sbin/nologin
nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin
Modified: head/net-im/tox/Makefile
==============================================================================
--- head/net-im/tox/Makefile Tue Oct 14 20:47:56 2014 (r370884)
+++ head/net-im/tox/Makefile Tue Oct 14 20:55:19 2014 (r370885)
@@ -3,6 +3,7 @@
PORTNAME= toxcore
PORTVERSION= 0.141012
+PORTREVISION= 1
CATEGORIES= net-im net-p2p
MAINTAINER= thierry at FreeBSD.org
@@ -31,6 +32,7 @@ USE_LDCONFIG= yes
PATHFIX_MAKEFILEIN= Makefile.am
INSTALL_TARGET= install-strip
+OPTIONS_DEFINE= DAEMON
OPTIONS_RADIO= CRYPTO
OPTIONS_RADIO_CRYPTO= SODIUM NACL
OPTIONS_DEFAULT= SODIUM
@@ -41,9 +43,14 @@ SODIUM_LIB_DEPENDS= libsodium.so:${PORTS
NACL_DESC= Prefer NaCl
NACL_CONFIGURE_ENABLE= nacl
+NACL_CONFIGURE_ON= --with-nacl-libs=${LOCALBASE}/lib
NACL_BUILD_DEPENDS= ${LOCALBASE}/lib/libnacl.a:${PORTSDIR}/security/nacl
NACL_RUN_DEPENDS= ${LOCALBASE}/lib/libnacl.a:${PORTSDIR}/security/nacl
+DAEMON_DESC= Bootstrap daemon
+DAEMON_CONFIGURE_ENABLE=daemon
+DAEMON_LIB_DEPENDS= libconfig.so:${PORTSDIR}/devel/libconfig
+
.include <bsd.port.options.mk>
.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1000000
@@ -51,11 +58,25 @@ USE_GCC= yes
BROKEN_i386= '__stack_chk_fail_local' isn't defined
.endif
-.if ${PORT_OPTIONS:MNACL}
-CONFIGURE_ARGS+= --with-nacl-libs=${LOCALBASE}/lib
+.if ${PORT_OPTIONS:MDAEMON}
+USERS= toxdht
+USE_RC_SUBR= tox-bootstrapd
+SUB_LIST= TOXDHT=${USERS}
+PLIST_SUB+= TOXDHT=${USERS}
+KEYS_DIR= /var/lib/tox-bootstrapd
+PID_DIR= /var/run/tox-bootstrapd
+PKGMESSAGE= ${PKGDIR}/pkg-message.daemon
.endif
pre-configure:
${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/configure.ac
+post-install:
+.if ${PORT_OPTIONS:MDAEMON}
+ ${INSTALL_DATA} ${WRKSRC}/other/bootstrap_daemon/tox-bootstrapd.conf \
+ ${STAGEDIR}${PREFIX}/etc/tox-bootstrapd.conf.sample
+ ${MKDIR} ${STAGEDIR}${KEYS_DIR}
+ ${MKDIR} ${STAGEDIR}${PID_DIR}
+.endif
+
.include <bsd.port.mk>
Added: head/net-im/tox/files/tox-bootstrapd.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net-im/tox/files/tox-bootstrapd.in Tue Oct 14 20:55:19 2014 (r370885)
@@ -0,0 +1,42 @@
+#! /bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: tox_bootstrapd
+# REQUIRE: NETWORKING DAEMON
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable `tox-bootstrapd':
+#
+#tox_bootstrapd_enable="YES"
+#
+
+. /etc/rc.subr
+
+name="tox_bootstrapd"
+rcvar=tox_bootstrapd_enable
+
+# read settings, set default values
+load_rc_config "${name}"
+: ${tox_bootstrapd_enable="NO"}
+
+required_files=${tox_bootstrapd_config:="%%PREFIX%%/etc/tox-bootstrapd.conf"}
+_pidprefix="/var/run/tox-bootstrapd"
+pidfile=${tox_bootstrapd_pidfile:="$_pidprefix/tox-bootstrapd.pid"}
+long_name="Tox DHT bootstrap daemon."
+tox_bootstrapd_user="%%TOXDHT%%"
+command="%%PREFIX%%/bin/tox-bootstrapd"
+command_args="${tox_bootstrapd_config}"
+
+stop_cmd=${name}_stop
+
+# Cannot use the regular stop() because the daemon forks
+tox_bootstrapd_stop() {
+ [ -f $pidfile ] || (echo "$name not running?"; exit 1)
+ echo "Stopping $long_name"
+ kill `ps ax | grep $command | grep -v grep | awk '{print $1}'`
+ rm -f $pidfile
+}
+
+run_rc_command "$1"
Added: head/net-im/tox/pkg-message.daemon
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net-im/tox/pkg-message.daemon Tue Oct 14 20:55:19 2014 (r370885)
@@ -0,0 +1,4 @@
+
+Warning: your public key will be logged at the level INFO. Check that your
+/etc/syslog is configured to log these messages if you need it (to publicize
+it).
Modified: head/net-im/tox/pkg-plist
==============================================================================
--- head/net-im/tox/pkg-plist Tue Oct 14 20:47:56 2014 (r370884)
+++ head/net-im/tox/pkg-plist Tue Oct 14 20:55:19 2014 (r370885)
@@ -1,4 +1,6 @@
bin/DHT_bootstrap
+%%DAEMON%%bin/tox-bootstrapd
+%%DAEMON%%@sample etc/tox-bootstrapd.conf.sample
include/tox/tox.h
include/tox/toxav.h
include/tox/toxdns.h
@@ -21,3 +23,6 @@ lib/libtoxencryptsave.a
%%SODIUM%%lib/libtoxencryptsave.so.0.0.0
libdata/pkgconfig/libtoxav.pc
libdata/pkgconfig/libtoxcore.pc
+%%DAEMON%%@dir(%%TOXDHT%%,nobody,755) /var/run/tox-bootstrapd
+%%DAEMON%%@dir(%%TOXDHT%%,nobody,700) /var/lib/tox-bootstrapd
+%%DAEMON%%@dir /var/lib
More information about the svn-ports-all
mailing list