summaryrefslogtreecommitdiff
path: root/net-analyzer/darkstat/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-analyzer/darkstat/files
reinit the tree, so we can have metadata
Diffstat (limited to 'net-analyzer/darkstat/files')
-rw-r--r--net-analyzer/darkstat/files/darkstat-confd27
-rw-r--r--net-analyzer/darkstat/files/darkstat-initd58
2 files changed, 85 insertions, 0 deletions
diff --git a/net-analyzer/darkstat/files/darkstat-confd b/net-analyzer/darkstat/files/darkstat-confd
new file mode 100644
index 000000000000..3d95a0461a06
--- /dev/null
+++ b/net-analyzer/darkstat/files/darkstat-confd
@@ -0,0 +1,27 @@
+# The interface to listen on
+# Use only with /etc/init.d/darkstat init script. If you use
+# /etc/init.d/darkstat.if init script, then this option should be ignored.
+#INTERFACE="eth0"
+
+# The port for the embedded webserver
+#PORT="667"
+
+# The address embedded webserver should bind to
+#ADDRESS="0.0.0.0"
+
+# Set the filter. See tcpdump documenation for details.
+#FILTER=""
+
+# Log daily traffic statistics into the named file, relative to the
+# chroot directory (see, below).
+#DAYLOGFILE="darkstat.log"
+
+# Other options:
+DARKSTAT_OPTS="--no-promisc --no-dns --user darkstat"
+
+# The directory to which the program chroots after initialization.
+# If you change this, please note the variable below and adjust
+# the permissions accordingly. Note that if you want to use the
+# --daylog option in EXTRAOPTS, the files are logged relative
+# to the chroot-directory; see the man-page for details.
+#CHROOT=__CHROOT__
diff --git a/net-analyzer/darkstat/files/darkstat-initd b/net-analyzer/darkstat/files/darkstat-initd
new file mode 100644
index 000000000000..c362251dadc8
--- /dev/null
+++ b/net-analyzer/darkstat/files/darkstat-initd
@@ -0,0 +1,58 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+IF=${SVCNAME##*.}
+
+if [ -n "${IF}" -a "${SVCNAME}" != "darkstat" ] ; then
+ PIDFILE=/run/darkstat.${IF}.pid
+else
+ PIDFILE=/run/darkstat.pid
+fi
+
+depend() {
+ need net
+}
+
+chkconfig() {
+ if [ -n "${IF}" -a "${SVCNAME}" != "darkstat" ] ; then
+ if [ ! -f "/etc/conf.d/darkstat.${IF}" ] ; then
+ einfo "It's possible to have distinct config in /etc/conf.d/darkstat.${IF}."
+ fi
+ INTERFACE=${IF}
+ else
+ if [ ! -f "/etc/conf.d/darkstat" ] ; then
+ ewarn "/etc/conf.d/darkstat does not exist. Falling on defaults."
+ fi
+ fi
+
+ if [ -z "${INTERFACE}" ]; then
+ ewarn "No interface specified. Trying to use eth0."
+ INTERFACE="eth0"
+ fi
+
+ DARK_OPTS="-i ${INTERFACE}"
+ [ -n "${PORT}" ] && DARK_OPTS="${DARK_OPTS} -p ${PORT}"
+ [ -n "${ADDRESS}" ] && DARK_OPTS="${DARK_OPTS} -b ${ADDRESS}"
+ [ -n "${DAYLOGFILE}" ] && DARK_OPTS="${DARK_OPTS} --daylog ${DAYLOGFILE}"
+
+ return 0
+}
+
+start() {
+ chkconfig || return 1
+
+ # If ${PIDFILE} exist darkstat fails to start
+ [ -f ${PIDFILE} ] && rm ${PIDFILE}
+ ebegin "Starting darkstat on ${INTERFACE}"
+ /sbin/start-stop-daemon --start --exec /usr/sbin/darkstat -- \
+ --chroot "${CHROOT:-__CHROOT__}" --pidfile ${PIDFILE} \
+ ${DARKSTAT_OPTS} ${DARK_OPTS} -f "${FILTER}"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping darkstat on ${INTERFACE}"
+ /sbin/start-stop-daemon --stop --pidfile ${PIDFILE}
+ eend $?
+}