diff options
Diffstat (limited to 'net-analyzer/arpwatch/files')
-rw-r--r-- | net-analyzer/arpwatch/files/arpwatch.confd | 11 | ||||
-rw-r--r-- | net-analyzer/arpwatch/files/arpwatch.confd-r2 | 18 | ||||
-rw-r--r-- | net-analyzer/arpwatch/files/arpwatch.initd | 36 | ||||
-rw-r--r-- | net-analyzer/arpwatch/files/arpwatch.initd-r2 | 33 |
4 files changed, 51 insertions, 47 deletions
diff --git a/net-analyzer/arpwatch/files/arpwatch.confd b/net-analyzer/arpwatch/files/arpwatch.confd deleted file mode 100644 index 98abe0417740..000000000000 --- a/net-analyzer/arpwatch/files/arpwatch.confd +++ /dev/null @@ -1,11 +0,0 @@ -# Config file for /etc/init.d/arpwatch -# see arpwatch.8 for more information - -#IFACES="eth0 eth1" -IFACES="eth0" - -# Additional options to pass to arpwatch. -OPTIONS="-N -p" - -# Comment this line if you wish arpwatch to run as root user (not recommended) -ARPUSER="arpwatch" diff --git a/net-analyzer/arpwatch/files/arpwatch.confd-r2 b/net-analyzer/arpwatch/files/arpwatch.confd-r2 new file mode 100644 index 000000000000..2937349cdc83 --- /dev/null +++ b/net-analyzer/arpwatch/files/arpwatch.confd-r2 @@ -0,0 +1,18 @@ +# See arpwatch.8 for more information + +# Specify the interface for arpwatch to listen on here (default: lo). +# If you need to listen on more than one interface, you should +# run multiple arpwatch services; for example "arpwatch" and +# "arpwatch.eth1". These additional services can be configured by +# symlinking to the "arpwatch" service script, and by creating a new +# conf.d file whose name matches the new service (symlink) name. +# +# Example: +# +# ARPWATCH_IFACE="eth0" +# +ARPWATCH_IFACE="lo" + +# Additional options to pass to arpwatch. +# See arpwatch(8) +ARPWATCH_OPTS="-N -p" diff --git a/net-analyzer/arpwatch/files/arpwatch.initd b/net-analyzer/arpwatch/files/arpwatch.initd deleted file mode 100644 index 5569dcee2527..000000000000 --- a/net-analyzer/arpwatch/files/arpwatch.initd +++ /dev/null @@ -1,36 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need net -} - -start() { - for IFACE in ${IFACES} - do - ebegin "Starting arpwatch on ${IFACE}" - DATAFILE=/var/lib/arpwatch/${IFACE}.dat - [ ! -f ${DATAFILE} ] && touch ${DATAFILE} - - if [ -z ${ARPUSER} ]; then - start-stop-daemon --start --quiet --pidfile=/var/run/arpwatch.${IFACE}.pid --exec \ - /usr/sbin/arpwatch -- -i ${IFACE} -f ${DATAFILE} -P /var/run/arpwatch.${IFACE}.pid ${OPTIONS} - else - chown ${ARPUSER} ${DATAFILE} - start-stop-daemon --start --quiet --pidfile=/var/run/arpwatch.${IFACE}.pid --exec \ - /usr/sbin/arpwatch -- -i $IFACE -u ${ARPUSER} -f ${DATAFILE} -P /var/run/arpwatch.${IFACE}.pid ${OPTIONS} - fi - eend $? - done -} - -stop() { - for IFACE in ${IFACES} - do - ebegin "Stopping arpwatch on ${IFACE}" - start-stop-daemon --stop --quiet --pidfile=/var/run/arpwatch.${IFACE}.pid --exec \ - /usr/sbin/arpwatch - eend $? - done -} diff --git a/net-analyzer/arpwatch/files/arpwatch.initd-r2 b/net-analyzer/arpwatch/files/arpwatch.initd-r2 new file mode 100644 index 000000000000..93438209e1f1 --- /dev/null +++ b/net-analyzer/arpwatch/files/arpwatch.initd-r2 @@ -0,0 +1,33 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Default to "lo" for the interface, so that the init script will work +# out-of-the-box. +: ${ARPWATCH_IFACE:=lo} + +ARPWATCH_DATAFILE="/var/lib/arpwatch/${RC_SVCNAME}.dat" + +command="/usr/sbin/arpwatch" +pidfile="/run/${RC_SVCNAME}.pid" +command_args=" + -i ${ARPWATCH_IFACE} + -f ${ARPWATCH_DATAFILE} + -P ${pidfile} + ${ARPWATCH_OPTS} +" + +depend() { + if [ -f "/proc/net/vlan/${ARPWATCH_IFACE}" ]; then + _if=$(grep -i "device" /proc/net/vlan/${ARPWATCH_IFACE} |awk '{print $2;}') + else + _if=${ARPWATCH_IFACE} + fi + need "net.${_if}" +} + +start_pre() { + # The "arpwatch" user must be a member of the "arpwatch" group for + # this to work. + checkpath --file --owner root:arpwatch --mode 0660 "${ARPWATCH_DATAFILE}" +} |