diff options
author | Kirill Ponomarev <krion@FreeBSD.org> | 2004-07-09 16:50:00 +0000 |
---|---|---|
committer | Kirill Ponomarev <krion@FreeBSD.org> | 2004-07-09 16:50:00 +0000 |
commit | f00bff1604ca307ba98c9a3c2b463272470a86c5 (patch) | |
tree | 8318e94fc492a52ebdd6b043f11b6f1fe548fc57 /net-mgmt/arpwatch-devel | |
parent | fcd42c3e27c8290606b33cd48a7e38e5f06c8e3d (diff) |
Notes
Diffstat (limited to 'net-mgmt/arpwatch-devel')
-rw-r--r-- | net-mgmt/arpwatch-devel/Makefile | 12 | ||||
-rw-r--r-- | net-mgmt/arpwatch-devel/files/arpwatch.sh | 87 | ||||
-rw-r--r-- | net-mgmt/arpwatch-devel/files/patch-ae | 48 | ||||
-rw-r--r-- | net-mgmt/arpwatch-devel/pkg-message | 12 | ||||
-rw-r--r-- | net-mgmt/arpwatch-devel/pkg-plist | 2 |
5 files changed, 81 insertions, 80 deletions
diff --git a/net-mgmt/arpwatch-devel/Makefile b/net-mgmt/arpwatch-devel/Makefile index d6b498669be0..a1f03a43f5b9 100644 --- a/net-mgmt/arpwatch-devel/Makefile +++ b/net-mgmt/arpwatch-devel/Makefile @@ -7,7 +7,7 @@ PORTNAME= arpwatch PORTVERSION= 2.1.a11 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= net-mgmt MASTER_SITES= http://www.Awfulhak.org/arpwatch/ \ ftp://ftp.ee.lbl.gov/ @@ -25,8 +25,15 @@ CONFIGURE_ARGS= --quiet INSTALL_TARGET= install install-man MAN8= arpwatch.8 arpsnmp.8 +USE_RC_SUBR= yes +RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} + MAKE_ENV= PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" PTHREAD_LIBS="${PTHREAD_LIBS}" +post-patch: + @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${FILESDIR}/arpwatch.sh > ${WRKDIR}/arpwatch.sh + post-install: if [ ! -d ${PREFIX}/arpwatch ]; then \ ${MKDIR} ${PREFIX}/arpwatch; \ @@ -41,6 +48,7 @@ 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 + ${INSTALL_SCRIPT} ${WRKDIR}/arpwatch.sh ${PREFIX}/etc/rc.d/arpwatch.sh + @${CAT} ${PKGMESSAGE} .include <bsd.port.mk> diff --git a/net-mgmt/arpwatch-devel/files/arpwatch.sh b/net-mgmt/arpwatch-devel/files/arpwatch.sh index acf46782ce0d..9017b8c3ca3f 100644 --- a/net-mgmt/arpwatch-devel/files/arpwatch.sh +++ b/net-mgmt/arpwatch-devel/files/arpwatch.sh @@ -1,60 +1,31 @@ #!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: arpwatch +# REQUIRE: NETWORKING SERVERS +# BEFORE: DAEMON +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable arpwatch: +# arpwatch_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable arpwatch +# arpwatch_flags (str): Set to "-N" by default. +# Extra flags passed to start command +# +. %%RC_SUBR%% + +name="arpwatch" +rcvar=`set_rcvar` + +command="%%PREFIX%%/sbin/arpwatch" + +[ -z "$arpwatch_enable" ] && arpwatch_enable="NO" +[ -z "$arpwatch_flags" ] && arpwatch_flags="-N" + +load_rc_config $name + +run_rc_command "$1" -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 - - if [ ! -e "$PREFIX"/arpwatch/ether.dat ]; then - if [ -e "$PREFIX"/arpwatch/ether.dat- ]; then - cp "$PREFIX"/arpwatch/ether.dat- "$PREFIX"/arpwatch/ether.dat - else - touch "$PREFIX"/arpwatch/ether.dat - fi - fi - - case ${arpwatch_interfaces} in - '') - if [ -x "$PREFIX"/sbin/arpwatch -a -d "$PREFIX"/arpwatch ]; then - "$PREFIX"/sbin/arpwatch ${arpwatch_flags} && 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' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - exit 64 - ;; -esac - -exit 0 diff --git a/net-mgmt/arpwatch-devel/files/patch-ae b/net-mgmt/arpwatch-devel/files/patch-ae index 41828fffe373..af6cb222dfa2 100644 --- a/net-mgmt/arpwatch-devel/files/patch-ae +++ b/net-mgmt/arpwatch-devel/files/patch-ae @@ -1,5 +1,5 @@ ---- arpwatch.c.orig Sat Oct 14 04:07:35 2000 -+++ arpwatch.c Tue Jan 20 00:22:23 2004 +--- arpwatch.c.orig Fri Oct 13 22:07:35 2000 ++++ arpwatch.c Wed Jul 7 17:08:21 2004 @@ -36,6 +36,7 @@ #include <sys/ioctl.h> #include <sys/socket.h> @@ -85,7 +85,7 @@ default: usage(); } -@@ -213,19 +230,23 @@ +@@ -213,50 +230,107 @@ net = 0; netmask = 0; } else { @@ -121,16 +121,26 @@ } /* Drop into the background if not debugging */ -@@ -238,7 +259,7 @@ - exit(0); - (void)close(fileno(stdin)); - (void)close(fileno(stdout)); + if (!debug) { +- pid = fork(); +- if (pid < 0) { +- syslog(LOG_ERR, "main fork(): %m"); +- exit(1); +- } else if (pid != 0) +- exit(0); +- (void)close(fileno(stdin)); +- (void)close(fileno(stdout)); - (void)close(fileno(stderr)); -+ - #ifdef TIOCNOTTY - fd = open("/dev/tty", O_RDWR); - if (fd >= 0) { -@@ -251,12 +272,82 @@ +-#ifdef TIOCNOTTY +- fd = open("/dev/tty", O_RDWR); +- if (fd >= 0) { +- (void)ioctl(fd, TIOCNOTTY, 0); +- (void)close(fd); +- } +-#else +- (void) setsid(); +-#endif ++ daemon(1, 0); } } @@ -214,7 +224,7 @@ if (rfilename != NULL) { pd = pcap_open_offline(rfilename, errbuf); -@@ -306,27 +397,7 @@ +@@ -306,27 +380,7 @@ if (rfilename == NULL) syslog(LOG_INFO, "listening on %s", interface); @@ -242,7 +252,7 @@ switch (linktype) { -@@ -347,9 +418,7 @@ +@@ -347,9 +401,7 @@ exit(1); } pcap_close(pd); @@ -253,7 +263,7 @@ } /* Process an ethernet arp/rarp packet */ -@@ -362,6 +431,8 @@ +@@ -362,6 +414,8 @@ register u_char *sea, *sha; register time_t t; u_int32_t sia; @@ -262,7 +272,7 @@ eh = (struct ether_header *)p; ea = (struct ether_arp *)(eh + 1); -@@ -400,9 +471,16 @@ +@@ -400,9 +454,16 @@ /* Got a live one */ t = h->ts.tv_sec; can_checkpoint = 0; @@ -280,7 +290,7 @@ can_checkpoint = 1; } -@@ -507,6 +585,8 @@ +@@ -507,6 +568,8 @@ register u_char *sea, *sha; register time_t t; u_int32_t sia; @@ -289,7 +299,7 @@ fh = (struct fddi_header *)p; ea = (struct ether_arp *)(fh + 1); -@@ -549,7 +629,13 @@ +@@ -549,7 +612,13 @@ /* Got a live one */ t = h->ts.tv_sec; can_checkpoint = 0; @@ -304,7 +314,7 @@ syslog(LOG_ERR, "ent_add(%s, %s, %ld) failed", intoa(sia), e2str(sea), t); can_checkpoint = 1; -@@ -750,7 +836,7 @@ +@@ -750,7 +819,7 @@ extern char version[]; (void)fprintf(stderr, "Version %s\n", version); diff --git a/net-mgmt/arpwatch-devel/pkg-message b/net-mgmt/arpwatch-devel/pkg-message new file mode 100644 index 000000000000..0d2dc89abb16 --- /dev/null +++ b/net-mgmt/arpwatch-devel/pkg-message @@ -0,0 +1,12 @@ + +*** ATTENTION *** + +To run arpwatch from startup, add +arpwatch_enable="YES" to /etc/rc.conf + +Available variables you add/set to /etc/rc.conf. +- arpwatch_enable (bool): Set to "NO" by default. + Set it to "YES" to enable arpwatch. +- arpwatch_flags (str): Set to "-N" by default. + Extra flags passed to start command. + diff --git a/net-mgmt/arpwatch-devel/pkg-plist b/net-mgmt/arpwatch-devel/pkg-plist index 7c0246942dcc..ae0b0aa34527 100644 --- a/net-mgmt/arpwatch-devel/pkg-plist +++ b/net-mgmt/arpwatch-devel/pkg-plist @@ -5,7 +5,7 @@ arpwatch/ethercodes.dat arpwatch/d.awk arpwatch/e.awk arpwatch/p.awk -etc/rc.d/arpwatch.sh.sample +etc/rc.d/arpwatch.sh @unexec test -f %D/arpwatch/arp.dat && test -s %D/arpwatch/arp.dat || rm -f %D/arpwatch/arp.dat @unexec test -f %D/arpwatch/ether.dat && test -s %D/arpwatch/ether.dat || rm -f %D/arpwatch/ether.dat @exec test -f %D/arpwatch/arp.dat || touch %D/arpwatch/arp.dat |