summaryrefslogtreecommitdiff
path: root/net-im/tox/files/tox-bootstrapd.in
diff options
context:
space:
mode:
authorThierry Thomas <thierry@FreeBSD.org>2014-10-14 20:55:19 +0000
committerThierry Thomas <thierry@FreeBSD.org>2014-10-14 20:55:19 +0000
commit4f355437767f7b451b8de02678e65b17dec4ed1d (patch)
treeb12fa51dfd6f3ea4e53680f529107142c5070312 /net-im/tox/files/tox-bootstrapd.in
parent- update to version 4.4.6 (diff)
Add an option to build and run a Tox DHT Bootstrap Node.
More details at https://blog.libtoxcore.so/running-a-bootstrap-node
Diffstat (limited to 'net-im/tox/files/tox-bootstrapd.in')
-rw-r--r--net-im/tox/files/tox-bootstrapd.in42
1 files changed, 42 insertions, 0 deletions
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"