diff options
author | pav <pav@FreeBSD.org> | 2005-12-27 05:25:18 +0000 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2005-12-27 05:25:18 +0000 |
commit | 626fa01dacbc416c0f0876cebd8d99c5d1219847 (patch) | |
tree | fb86cffa7fb15f90dd3a67c6eca59cc834b10369 /net-mgmt | |
parent | a8b0f2f31550018d5bce33f2963f8fb2fea7004b (diff) | |
download | FreeBSD-ports-626fa01dacbc416c0f0876cebd8d99c5d1219847.zip FreeBSD-ports-626fa01dacbc416c0f0876cebd8d99c5d1219847.tar.gz |
- Switch to rc_subr startup script
PR: ports/84711
Submitted by: SimpleRezo <freebsd@simplerezo.com>
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/arpwatch/Makefile | 8 | ||||
-rw-r--r-- | net-mgmt/arpwatch/files/arpwatch.sh | 56 | ||||
-rw-r--r-- | net-mgmt/arpwatch/files/arpwatch.sh.in | 77 | ||||
-rw-r--r-- | net-mgmt/arpwatch/pkg-plist | 1 |
4 files changed, 80 insertions, 62 deletions
diff --git a/net-mgmt/arpwatch/Makefile b/net-mgmt/arpwatch/Makefile index dcfa82b..a5d2244 100644 --- a/net-mgmt/arpwatch/Makefile +++ b/net-mgmt/arpwatch/Makefile @@ -7,6 +7,7 @@ PORTNAME= arpwatch PORTVERSION= 2.1.a13 +PORTREVISION= 1 CATEGORIES= net-mgmt MASTER_SITES= ftp://ftp.ee.lbl.gov/ DISTNAME= arpwatch-2.1a13 @@ -17,11 +18,12 @@ COMMENT= Monitor arp & rarp requests CONFLICTS= arpwatch-devel-2.* GNU_CONFIGURE= yes -HAS_CONFIGURE= yes CONFIGURE_ARGS= --quiet INSTALL_TARGET= install install-man MAN8= arpwatch.8 arpsnmp.8 +USE_RC_SUBR= arpwatch.sh + post-install: if [ ! -d ${PREFIX}/arpwatch ]; then \ ${MKDIR} ${PREFIX}/arpwatch; \ @@ -34,9 +36,5 @@ post-install: ${INSTALL_DATA} ${WRKSRC}/$$file ${PREFIX}/arpwatch; \ done ${INSTALL_SCRIPT} ${WRKSRC}/arp2ethers ${PREFIX}/arpwatch - ${INSTALL_SCRIPT} ${FILESDIR}/arpwatch.sh ${PREFIX}/etc/rc.d/arpwatch.sh.sample - @${ECHO_MSG} "#####################################################################" - @${ECHO_MSG} "Installing ${PREFIX}/etc/rc.d/arpwatch.sh.sample file." - @${ECHO_MSG} "#####################################################################" .include <bsd.port.mk> diff --git a/net-mgmt/arpwatch/files/arpwatch.sh b/net-mgmt/arpwatch/files/arpwatch.sh deleted file mode 100644 index e7c5c33..0000000 --- a/net-mgmt/arpwatch/files/arpwatch.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/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} - -if [ ."$dir" = ."$prog" -o ."$PREFIX" = ."$dir" ] -then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - -case $1 in -start) - 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"/arpwatch/arp.dat - fi - fi - - case ${arpwatch_interfaces} in - '') - if [ -x "$PREFIX"/sbin/arpwatch -a -d "$PREFIX"/arpwatch ]; then - "$PREFIX"/sbin/arpwatch && echo -n ' arpwatch' - else - echo "Error: Cannot find $PREFIX/sbin/arpwatch" >&2 - exit 1 - fi - ;; - *) - for interface in ${arpwatch_interfaces}; do - touch "$PREFIX"/arpwatch/arp.${interface}.dat - "$PREFIX"/sbin/arpwatch -i "${interface}" -f arp.${interface}.dat && echo -n " arpwatch(${interface})" - done - ;; - esac - ;; -stop) - killall arpwatch && echo -n ' arpwatch' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - exit 64 - ;; -esac - -exit 0 diff --git a/net-mgmt/arpwatch/files/arpwatch.sh.in b/net-mgmt/arpwatch/files/arpwatch.sh.in new file mode 100644 index 0000000..12521d8 --- /dev/null +++ b/net-mgmt/arpwatch/files/arpwatch.sh.in @@ -0,0 +1,77 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: arpwatch +# REQUIRE: NETWORKING +# KEYWORD: FreeBSD + +# Add the following lines to /etc/rc.conf to enable arpwatch: +# +#arpwatch_enable="YES" +# +arpwatch_enable=${arpwatch_enable:-"NO"} +arpwatch_dir="%%PREFIX%%/arpwatch/" +arpwatch_interfaces= + +. %%RC_SUBR%% + +name=arpwatch +rcvar=`set_rcvar` +required_dirs=${arpwatch_dir} + +load_rc_config ${name} + +command="%%PREFIX%%/sbin/${name}" +start_precmd=${name}_precmd + +arpwatch_precmd() { + case ${arpwatch_interfaces} in + '') + echo prcmd + if [ ! -e "${arpwatch_dir}/arp.dat" ]; then + if [ -e "${arpwatch_dir}/arp.dat-" ]; then + cp "${arpwatch_dir}/arp.dat-" "${arpwatch_dir}/arp.dat" + else + touch "${arpwatch_dir}/arp.dat" + fi + fi + ;; + + *) + for interface in ${arpwatch_interfaces}; do + if [ ! -e "${arpwatch_dir}/arp.${interface}.dat" ]; then + if [ -e "${arpwatch_dir}/arp.${interface}.dat-" ]; then + cp "${arpwatch_dir}/arp.${interface}.dat-" "${arpwatch_dir}/arp.${interface}.dat" + else + touch "${arpwatch_dir}/arp.${interface}.dat" + fi + fi + done + ;; + esac +} + +arpwatch_stop() { + killall arpwatch +} + +case ${arpwatch_interfaces} in + '') + echo 'meuh' + run_rc_command "$1" + ;; + + *) + if [ "$1" = "start" ]; then + for interface in ${arpwatch_interfaces}; do + eval options=\$arpwatch_${interface}_options + command_args="-i ${interface} ${options} -f arp.${interface}.dat" + run_rc_command "$1" + done + else + run_rc_command "$1" + fi + ;; +esac diff --git a/net-mgmt/arpwatch/pkg-plist b/net-mgmt/arpwatch/pkg-plist index 107115d..9bb3e61 100644 --- a/net-mgmt/arpwatch/pkg-plist +++ b/net-mgmt/arpwatch/pkg-plist @@ -5,7 +5,6 @@ arpwatch/ethercodes.dat arpwatch/d.awk arpwatch/e.awk arpwatch/p.awk -etc/rc.d/arpwatch.sh.sample @unexec test -f %D/arpwatch/arp.dat && test -s %D/arpwatch/arp.dat || rm -f %D/arpwatch/arp.dat @exec test -f %D/arpwatch/arp.dat || touch %D/arpwatch/arp.dat @dirrm arpwatch |