mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-17 08:01:36 +00:00
- Switch to rc_subr startup script
PR: ports/84711 Submitted by: SimpleRezo <freebsd@simplerezo.com>
This commit is contained in:
parent
fc78da6f48
commit
21bf127503
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=152151
@ -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>
|
||||
|
@ -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
|
77
net-mgmt/arpwatch/files/arpwatch.sh.in
Normal file
77
net-mgmt/arpwatch/files/arpwatch.sh.in
Normal file
@ -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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user