diff options
author | nbm <nbm@FreeBSD.org> | 2001-08-23 22:45:02 +0800 |
---|---|---|
committer | nbm <nbm@FreeBSD.org> | 2001-08-23 22:45:02 +0800 |
commit | 648793487c8ef5edb4e5fcabc6b8d7b57534d253 (patch) | |
tree | bfe020c13c2f0399efd18ed07a333d126528c720 /net/arpwatch/files | |
parent | 59842353320018b64f7fe5c7293d166b6393e0d5 (diff) | |
download | freebsd-ports-graphics-648793487c8ef5edb4e5fcabc6b8d7b57534d253.tar.gz freebsd-ports-graphics-648793487c8ef5edb4e5fcabc6b8d7b57534d253.tar.zst freebsd-ports-graphics-648793487c8ef5edb4e5fcabc6b8d7b57534d253.zip |
arpwatch package will now install an arp.dat file, meaning arpwatch from
the package will work by default.
Additionally, setting arpwatch_interfaces in the rc.conf system will
allow you to specify which interfaces arpwatches will run on. By
default (ie, variable empty or not set), it will run on the first
non-local interface it finds.
Approved by: brian (thanks!)
Diffstat (limited to 'net/arpwatch/files')
-rw-r--r-- | net/arpwatch/files/arpwatch.sh | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/net/arpwatch/files/arpwatch.sh b/net/arpwatch/files/arpwatch.sh index 1f4ad205b3f..072546207aa 100644 --- a/net/arpwatch/files/arpwatch.sh +++ b/net/arpwatch/files/arpwatch.sh @@ -1,5 +1,12 @@ #!/bin/sh +if [ -r /etc/defaults/rc.conf ]; then + . /etc/defaults/rc.conf + source_rc_confs +elif [ -r /etc/rc.conf ]; then + . /etc/rc.conf +fi + prog=$(realpath $0) || exit 1 dir=${prog%/*} PREFIX=${dir%/etc/rc.d} @@ -12,9 +19,26 @@ fi case $1 in start) - if [ -x "$PREFIX"/sbin/arpwatch -a -d "$PREFIX"/arpwatch ]; then - "$PREFIX"/sbin/arpwatch && echo -n ' arpwatch' + if [ ! -e "$PREFIX"/arpwatch/arp.dat ]; then + if [ -e "$PREFIX"/arpwatch/arp.dat- ]; then + cp "$PREFIX"/arpwatch/arp.dat- "$PREFIX"/arpwatch/arp.dat + else + touch "$PREFIX"/arpwarch/arp.dat + fi fi + + case ${arpwatch_interfaces} in + '') + if [ -x "$PREFIX"/sbin/arpwatch -a -d "$PREFIX"/arpwatch ]; then + "$PREFIX"/sbin/arpwatch && echo -n ' arpwatch' + fi + ;; + *) + for interface in ${arpwatch_interfaces}; do + "$PREFIX"/sbin/arpwatch -i "${interface}" && echo -n " arpwatch(${interface})" + done + ;; + esac ;; stop) killall arpwatch && echo -n ' arpwatch' |