aboutsummaryrefslogtreecommitdiff
path: root/net/pwhois
diff options
context:
space:
mode:
authorRyan Steinmetz <zi@FreeBSD.org>2014-03-20 20:07:10 +0000
committerRyan Steinmetz <zi@FreeBSD.org>2014-03-20 20:07:10 +0000
commit3b3db1acf71c083966dd72af42d1bc8915f85880 (patch)
treeeaebf7b1128967ce9310ecb1955709287e3e5078 /net/pwhois
parent18b3f381d11618492b9c8664120b2461bd83be2b (diff)
downloadports-3b3db1acf71c083966dd72af42d1bc8915f85880.tar.gz
ports-3b3db1acf71c083966dd72af42d1bc8915f85880.zip
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/
Notes
Notes: svn path=/head/; revision=348718
Diffstat (limited to 'net/pwhois')
-rw-r--r--net/pwhois/Makefile59
-rw-r--r--net/pwhois/distinfo2
-rw-r--r--net/pwhois/files/512.pwhois-updatedb.in21
-rw-r--r--net/pwhois/files/pkg-message.in24
-rw-r--r--net/pwhois/files/pwhoisd.in45
-rw-r--r--net/pwhois/pkg-descr9
-rw-r--r--net/pwhois/pkg-plist21
7 files changed, 181 insertions, 0 deletions
diff --git a/net/pwhois/Makefile b/net/pwhois/Makefile
new file mode 100644
index 000000000000..724b9befd786
--- /dev/null
+++ b/net/pwhois/Makefile
@@ -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>
diff --git a/net/pwhois/distinfo b/net/pwhois/distinfo
new file mode 100644
index 000000000000..6b067a02400c
--- /dev/null
+++ b/net/pwhois/distinfo
@@ -0,0 +1,2 @@
+SHA256 (pwhois-2.2.0.1.tgz) = 973470746d9a942e7391fe748dfd7b8a661e66a1f742f26a1061b6e11cb2e56c
+SIZE (pwhois-2.2.0.1.tgz) = 105401
diff --git a/net/pwhois/files/512.pwhois-updatedb.in b/net/pwhois/files/512.pwhois-updatedb.in
new file mode 100644
index 000000000000..4ce4166897c6
--- /dev/null
+++ b/net/pwhois/files/512.pwhois-updatedb.in
@@ -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
diff --git a/net/pwhois/files/pkg-message.in b/net/pwhois/files/pkg-message.in
new file mode 100644
index 000000000000..870a62b18a11
--- /dev/null
+++ b/net/pwhois/files/pkg-message.in
@@ -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"
diff --git a/net/pwhois/files/pwhoisd.in b/net/pwhois/files/pwhoisd.in
new file mode 100644
index 000000000000..ed17f7dce3c3
--- /dev/null
+++ b/net/pwhois/files/pwhoisd.in
@@ -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"
diff --git a/net/pwhois/pkg-descr b/net/pwhois/pkg-descr
new file mode 100644
index 000000000000..9d33b023d95d
--- /dev/null
+++ b/net/pwhois/pkg-descr
@@ -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/
diff --git a/net/pwhois/pkg-plist b/net/pwhois/pkg-plist
new file mode 100644
index 000000000000..6c523cf3a8e8
--- /dev/null
+++ b/net/pwhois/pkg-plist
@@ -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