New port: net/pwhois:

The Prefix WhoIs Project provides a whois-compatible client and server
framework for disclosing various up-to-date routing information.
Instead of using registrar-originated network information (which is often
unspecific or inaccurate), Prefix WhoIs uses the Internet's global routing
table as gleaned from a number of routing peers around the world. Other
sources of information, such as imported data from ARIN are also supported
(a separate agreement with ARIN is required).

WWW: http://pwhois.org/
This commit is contained in:
Ryan Steinmetz 2014-03-20 20:07:10 +00:00
parent 18b3f381d1
commit 3b3db1acf7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=348718
8 changed files with 182 additions and 0 deletions

View File

@ -889,6 +889,7 @@
SUBDIR += pure-sockets
SUBDIR += pvm
SUBDIR += pvm++
SUBDIR += pwhois
SUBDIR += pxe
SUBDIR += pxe-pdhcp
SUBDIR += py-GeoIP

59
net/pwhois/Makefile Normal file
View File

@ -0,0 +1,59 @@
# Created by: Ryan Steinmetz <zi@FreeBSD.org>
# $FreeBSD$
PORTNAME= pwhois
PORTVERSION= 2.2.0.1
CATEGORIES= net
MASTER_SITES= http://pwhois.org/get/ \
http://mirrors.rit.edu/zi/
EXTRACT_SUFX= .tgz
MAINTAINER= zi@FreeBSD.org
COMMENT= Whois-compatible framework for disclosing routing data
RUN_DEPENDS= p5-DBI>0:${PORTSDIR}/databases/p5-DBI \
p5-Time-Format>0:${PORTSDIR}/devel/p5-Time-Format \
p5-Log-Dispatch>0:${PORTSDIR}/devel/p5-Log-Dispatch \
p5-Net-DNS>0:${PORTSDIR}/dns/p5-Net-DNS \
p5-Net-Telnet>0:${PORTSDIR}/net/p5-Net-Telnet \
p5-Net-CIDR>0:${PORTSDIR}/net-mgmt/p5-Net-CIDR \
p5-RPSL-Parser>0:${PORTSDIR}/devel/p5-RPSL-Parser \
p5-DBD-mysql>=0:${PORTSDIR}/databases/p5-DBD-mysql
FETCH_ARGS= -p
USERS= ${PORTNAME}
GROUPS= ${PORTNAME}
USE_MYSQL= client
USE_RC_SUBR= ${PORTNAME}d
SUB_FILES= pkg-message 512.pwhois-updatedb
SUB_LIST= TOUCH="${TOUCH}" RM="${RM}" CHOWN="${CHOWN}" \
USER="${USERS}" GROUP="${GROUPS}" INSTALL="${INSTALL}"
post-patch:
${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' ${WRKSRC}/Makefile
@${REINPLACE_CMD} -e 's|/etc/pwhois/|${ETCDIR}/|g' \
-e 's|/var/pwhois/|/var/db/pwhois/|g' \
-e 's|/var/log/|/var/log/pwhois/|g' \
-e 's|/var/db/log/|/var/log/pwhois/|g' \
${WRKSRC}/main.c ${WRKSRC}/pwhois-updatedb \
${WRKSRC}/pwhois_pwdump.c ${WRKSRC}/pwhoisd.conf
do-install:
@${MKDIR} ${STAGEDIR}${DATADIR} ${STAGEDIR}${ETCDIR} \
${STAGEDIR}${PREFIX}/etc/periodic/daily
@${INSTALL_SCRIPT} ${WRKDIR}/512.pwhois-updatedb \
${STAGEDIR}${PREFIX}/etc/periodic/daily/
@${INSTALL_PROGRAM} ${WRKSRC}/pwhoisd ${STAGEDIR}${PREFIX}/sbin/
@${INSTALL_SCRIPT} ${WRKSRC}/pwhois-updatedb ${STAGEDIR}${PREFIX}/sbin/
@${INSTALL_DATA} ${WRKSRC}/pwhoisd.conf \
${STAGEDIR}${ETCDIR}/pwhoisd.conf.sample
@${INSTALL_DATA} ${WRKSRC}/mysql/createdb.sql ${STAGEDIR}${DATADIR}/
post-install:
@${MKDIR} ${STAGEDIR}/var/db/pwhois ${STAGEDIR}/var/log/pwhois
@${CHOWN} 512:512 ${STAGEDIR}/var/db/pwhois ${STAGEDIR}/var/log/pwhois
#@${CHOWN} ${USERS}:${GROUPS} ${STAGEDIR}/var/db/pwhois ${STAGEDIR}/var/log/pwhois
.include <bsd.port.mk>

2
net/pwhois/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (pwhois-2.2.0.1.tgz) = 973470746d9a942e7391fe748dfd7b8a661e66a1f742f26a1061b6e11cb2e56c
SIZE (pwhois-2.2.0.1.tgz) = 105401

View File

@ -0,0 +1,21 @@
#!/bin/sh -
#
# $FreeBSD$
#
if [ -r /etc/defaults/periodic.conf ]; then
. /etc/defaults/periodic.conf
source_periodic_confs
fi
rc=0
case "${daily_pwhois-updatedb_enable:-YES}" in
[Nn][Oo])
;;
*)
[ -x %%PREFIX%%/sbin/pwhois-updatedb ] && %%PREFIX%%/sbin/pwhois-updatedb 1>/dev/null
;;
esac
exit $rc

View File

@ -0,0 +1,24 @@
This port requires additional tasks before it will function properly.
1. Create and initialize the database:
mysql> create database pwhois;
mysql> create user 'pwhois'@'localhost' identified by 'secret-password';
mysql> grant all privileges on pwhois.* to 'pwhois'@'localhost';
mysql> use pwhois;
mysql> \. %%DATADIR%%/createdb.sql
2. Edit %%ETCDIR%%/pwhoisd.conf and update:
* Database connection information
* RouteView servers (some may be slower than others)
3. Populate the database with data for the first time by running:
%%PREFIX%%/sbin/pwhois-updatedb
4. Add the following to /etc/rc.conf:
pwhoisd_enable="YES"
5. Start pwhoisd for the first time by running:
service pwhoisd start
6. To enable daily updates, edit /etc/periodic.conf and add:
daily_pwhois-updatedb_enable="YES"

View File

@ -0,0 +1,45 @@
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: pwhoisd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line(s) to /etc/rc.conf to enable pwhoisd:
#
# pwhoisd_enable="YES"
#
. /etc/rc.subr
name=pwhoisd
rcvar=pwhoisd_enable
load_rc_config $name
# Set defaults
pwhoisd_enable=${pwhoisd_enable:-"NO"}
_logdir=/var/log/pwhois
_dbdir=/var/db/pwhois
pidfile=/var/run/pwhoisd.pid
command=%%PREFIX%%/sbin/pwhoisd
command_args="-d -u 512 -g 512"
required_files=%%PREFIX%%/etc/pwhois/pwhoisd.conf
start_precmd=pwhoisd_precmd
stop_postcmd=pwhoisd_cleanup
pwhoisd_precmd()
{
[ ! -f $pidfile ] && %%TOUCH%% $pidfile && %%CHOWN%% %%USER%%:%%GROUP%% $pidfile
[ ! -d $_dbdir ] && %%INSTALL%% -d -o %%USER%% -g %%GROUP%% $_dbdir
[ ! -d $_logdir ] && %%INSTALL%% -d -o %%USER%% -g %%GROUP%% $_logdir
return 0
}
pwhoisd_cleanup() {
[ -f ${pidfile} ] && %%RM%% ${pidfile}
}
run_rc_command "$1"

9
net/pwhois/pkg-descr Normal file
View File

@ -0,0 +1,9 @@
The Prefix WhoIs Project provides a whois-compatible client and server
framework for disclosing various up-to-date routing information.
Instead of using registrar-originated network information (which is often
unspecific or inaccurate), Prefix WhoIs uses the Internet's global routing
table as gleaned from a number of routing peers around the world. Other
sources of information, such as imported data from ARIN are also supported
(a separate agreement with ARIN is required).
WWW: http://pwhois.org/

21
net/pwhois/pkg-plist Normal file
View File

@ -0,0 +1,21 @@
@comment $FreeBSD$
etc/periodic/daily/512.pwhois-updatedb
sbin/pwhois-updatedb
sbin/pwhoisd
@group pwhois
@mode 640
@unexec if cmp -s %D/etc/pwhois/pwhoisd.conf %D/etc/pwhois/pwhoisd.conf.sample ; then rm -f %D/etc/pwhois/pwhoisd.conf ; fi
%%ETCDIR%%/pwhoisd.conf.sample
@exec if [ ! -f %D/etc/pwhois/pwhoisd.conf ]; then cp -p %D/%F %B/pwhoisd.conf; fi
@group wheel
@mode
%%DATADIR%%/createdb.sql
@dirrm %%DATADIR%%
@dirrmtry %%ETCDIR%%
@dirrmtry etc/periodic/daily
@dirrmtry etc/periodic
@cwd /
@dirrmtry var/db/pwhois
@dirrmtry var/log/pwhois
@unexec if [ -d var/db/pwhois ]; then echo "You should remove /var/db/pwhois if you don't need it any more."; fi
@unexec if [ -d var/log/pwhois ]; then echo "You should remove /var/log/pwhois if you don't need it any more."; fi