diff options
Diffstat (limited to 'net-im')
-rw-r--r-- | net-im/tox/Makefile | 25 | ||||
-rw-r--r-- | net-im/tox/files/tox-bootstrapd.in | 42 | ||||
-rw-r--r-- | net-im/tox/pkg-message.daemon | 4 | ||||
-rw-r--r-- | net-im/tox/pkg-plist | 5 |
4 files changed, 74 insertions, 2 deletions
diff --git a/net-im/tox/Makefile b/net-im/tox/Makefile index fec8c01a1e61..d94711274075 100644 --- a/net-im/tox/Makefile +++ b/net-im/tox/Makefile @@ -3,6 +3,7 @@ PORTNAME= toxcore PORTVERSION= 0.141012 +PORTREVISION= 1 CATEGORIES= net-im net-p2p MAINTAINER= thierry@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:${PORTSDIR}/security/libsodium 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> diff --git a/net-im/tox/files/tox-bootstrapd.in b/net-im/tox/files/tox-bootstrapd.in new file mode 100644 index 000000000000..8c70b89e38cd --- /dev/null +++ b/net-im/tox/files/tox-bootstrapd.in @@ -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" diff --git a/net-im/tox/pkg-message.daemon b/net-im/tox/pkg-message.daemon new file mode 100644 index 000000000000..e5e85be67b94 --- /dev/null +++ b/net-im/tox/pkg-message.daemon @@ -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). diff --git a/net-im/tox/pkg-plist b/net-im/tox/pkg-plist index 791e91e2d5a7..cc5877736339 100644 --- a/net-im/tox/pkg-plist +++ b/net-im/tox/pkg-plist @@ -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 |