- Add $ipv6mon_interfaces support to rc.d/ipv6mon.

- Style fix.

PR:	180324
This commit is contained in:
Hiroki Sato 2014-09-15 16:11:39 +00:00
parent 438dcd27fe
commit 8e8b8e16ba
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=368273
5 changed files with 66 additions and 30 deletions

View file

@ -1,9 +1,8 @@
# Created by: Hiroki Sato <hrs@FreeBSD.org>
# $FreeBSD$
PORTNAME= ipv6mon
PORTVERSION= 1.0
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= net-mgmt ipv6
MASTER_SITES= http://www.si6networks.com/tools/ipv6mon/
DISTNAME= ${PORTNAME}-v${PORTVERSION}
@ -11,14 +10,8 @@ DISTNAME= ${PORTNAME}-v${PORTVERSION}
MAINTAINER= hrs@FreeBSD.org
COMMENT= Tool for monitoring IPv6 address usage
OPTIONS_DEFINE= DOCS
LICENSE= GPLv3
USES= uidfix
#Ignore "normal" destdir from port infra
DESTDIRNAME= IGNOREME
MAKE_ENV= DESTDIR=${STAGEDIR}${PREFIX}/
CFLAGS+= -DIPV6MON_CONF=\\\"${PREFIX}/etc/ipv6mon.conf\\\"
USERS= ${PORTNAME}
GROUPS= ${PORTNAME}
@ -30,7 +23,10 @@ PORTDOCS= README.TXT \
ipv6mon-manual.odt \
ipv6mon-manual.pdf
OPTIONS_DEFINE= DOCS
post-extract:
${INSTALL_DATA} ${FILESDIR}/Makefile ${WRKSRC}
${INSTALL_DATA} ${WRKSRC}/manuals/* ${WRKSRC}
post-install:

View file

@ -0,0 +1,19 @@
# $FreeBSD$
PROG= ipv6mon
LDADD= -lpcap
PREFIX?= /usr/local
FILES= ipv6mon.conf
FILESNAME= ipv6mon.conf.sample
FILESDIR= ${PREFIX}/etc
BINDIR= ${PREFIX}/sbin
MANDIR= ${PREFIX}/man/man
MAN= ipv6mon.8 ipv6mon.conf.5
NO_MANCOMPRESS=
WITH_INSTALL_AS_USER=yes
.include <bsd.prog.mk>

View file

@ -6,13 +6,53 @@
# BEFORE: LOGIN
# KEYWORD: nojail shutdown
# $ipv6mon_interfaces:
# If specified, multiple instances of ipv6mon are invoked.
# Configuration files for each interfaces are automatically
# generated from %%PREFIX%%/etc/ipv6mon.conf.
#
# Example:
# ipv6mon_interfaces="bge0 bge1"
#
# An interface can be specified in a command line argument. If
# not specified, the action is applied to all of the interfaces.
#
# # service ipv6mon start bge0
#
. /etc/rc.subr
name="ipv6mon"
rcvar="${name}_enable"
command="%%PREFIX%%/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="%%PREFIX%%/etc/${name}.conf"
start_precmd="start_precmd"
: ${ipv6mon_enable:=NO}
start_precmd()
{
for ifn in $ipv6mon_interfaces; do
(grep -v "LockFile=\|AddressLogFile=\|NetworkInterface=" \
%%PREFIX%%/etc/${name}.conf
echo "NetworkInterface=${ifn}"
echo "LockFile=/var/run/${name}-${ifn}.pid"
echo "AddressLogFile=/var/log/${name}-${ifn}.log"
) > "/var/run/${name}-${ifn}.conf"
done
}
load_rc_config $name
run_rc_command "$1"
case ${2:-$ipv6mon_interfaces} in
"")
pidfile="/var/run/${name}.pid"
run_rc_command "$1"
;;
*)
for ifn in ${2:-$ipv6mon_interfaces}; do
pidfile="/var/run/${name}${ifn:+-}${ifn}.pid"
command_args="$command_args \
-c /var/run/${name}${ifn:+-}${ifn}.conf"
run_rc_command "$1"
done
;;
esac

View file

@ -1,19 +0,0 @@
--- /dev/null 2012-09-18 11:55:15.000000000 +0900
+++ Makefile 2012-09-18 11:55:52.000000000 +0900
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+PROG= ipv6mon
+LDADD= -lpcap
+
+FILES= ipv6mon.conf
+FILESNAME= ipv6mon.conf.sample
+FILESDIR= etc
+
+BINDIR= sbin
+MANDIR= man/man
+
+MAN= ipv6mon.8 ipv6mon.conf.5
+NO_MANCOMPRESS=
+
+.include <bsd.prog.mk>

View file

@ -5,4 +5,4 @@ where address assignment is decentralized and there is no central
server that records which IPv6 addresses have been assigned to which
nodes during which period of time.
WWW: http://www.si6networks.com/tools/ipv6mon/
WWW: http://www.si6networks.com/tools/ipv6mon/