aboutsummaryrefslogtreecommitdiff
path: root/dns
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2006-08-12 03:56:54 +0000
committerRong-En Fan <rafan@FreeBSD.org>2006-08-12 03:56:54 +0000
commit62801042a01756ce3a75788856a68aea12fc04ea (patch)
treec95f57b335f00f0165519e2c903edb1f6df1fe9b /dns
parentd5910658d0eaeccea3934567ef528c0e50f63af5 (diff)
downloadports-62801042a01756ce3a75788856a68aea12fc04ea.tar.gz
ports-62801042a01756ce3a75788856a68aea12fc04ea.zip
Notes
Diffstat (limited to 'dns')
-rw-r--r--dns/dns_balance/Makefile74
-rw-r--r--dns/dns_balance/distinfo6
-rw-r--r--dns/dns_balance/files/dns_balance.sh.in10
-rw-r--r--dns/dns_balance/files/patch-dns_balance.rb105
-rw-r--r--dns/dns_balance/pkg-descr7
-rw-r--r--dns/dns_balance/pkg-plist17
6 files changed, 124 insertions, 95 deletions
diff --git a/dns/dns_balance/Makefile b/dns/dns_balance/Makefile
index aeb1246e1481..864565c17ae6 100644
--- a/dns/dns_balance/Makefile
+++ b/dns/dns_balance/Makefile
@@ -6,12 +6,12 @@
#
PORTNAME= dns_balance
-PORTVERSION= 1.1
+PORTVERSION= 2.0
CATEGORIES= dns
MASTER_SITES= http://www.netlab.is.tsukuba.ac.jp/~yokota/archive/
DISTNAME= DNS-Balance-${PORTVERSION}
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= ssedov@mbsd.msk.ru
COMMENT= A dynamic load-balancing DNS server
USE_RUBY= yes
@@ -21,62 +21,60 @@ NO_BUILD= yes
RUBY_SHEBANG_FILES= ${WRKSRC}/dns_balance.rb \
${WRKSRC}/sample/makedb.rb \
- ${WRKSRC}/sample/makeringdb.rb \
${WRKSRC}/sample/make_namespace.rb
+
ETCS= addrdb.rb \
namespace.rb
+ETCDIR= ${PREFIX}/etc/${PORTNAME}
LIBS= as_search.rb \
cache.rb \
datatype.rb \
log_writer.rb \
multilog.rb \
util.rb
-EXAMPLES_EXEC= make_namespace.rb \
- makedb.rb \
- makeringdb.rb \
- ringupdate.sh
-EXAMPLES_DATA= addr \
- addr.ring \
- addr.ring.txt \
- namespace.txt
-DOCS_EN= Q_and_A.dns_balance.eng \
- README.dns_balance.eng \
- README.dnsbalance+daemontools.eng
-DOCS_JA= ChangeLog \
- Q_and_A.dns_balance \
- README.dns_balance \
- README.dnsbalance+daemontools
-SUBST= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
+
+PLIST_SUB+= ETCDIR=${ETCDIR}
+SUB_LIST+= RUBY=${RUBY}
post-patch:
- ${SED} ${SUBST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${WRKSRC}/dns_balance.rb > ${WRKSRC}/dns_balance
+ ${SED} -E -e "s,%%PREFIX%%,${PREFIX},g" \
+ -e "s,%%PORTNAME%%,${PORTNAME},g" \
+ -e "s,%%ETCDIR%%,${ETCDIR},g" \
+ ${WRKSRC}/dns_balance.rb > ${WRKSRC}/dns_balance
do-install:
+#
+# Install main executable
+#
${INSTALL_SCRIPT} ${WRKSRC}/dns_balance ${PREFIX}/sbin/
+#
+# Install sample configuration files
+#
${MKDIR} ${PREFIX}/etc/${PORTNAME}
-.for f in ${ETCS}
- ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/etc/${PORTNAME}/${f}-dist
- [ -f ${PREFIX}/etc/${PORTNAME}/${f} ] || ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/etc/${PORTNAME}/${f}
+.for FILE in ${ETCS}
+ ${INSTALL_DATA} ${WRKSRC}/${FILE} ${ETCDIR}/${FILE}.dist
+. if !exists(${ETCDIR}/${FILE})
+ ${INSTALL_DATA} ${WRKSRC}/${FILE} ${ETCDIR}/${FILE}
+. endif
.endfor
+
+#
+# Install library files
+#
${MKDIR} ${PREFIX}/lib/${PORTNAME}
-.for f in ${LIBS}
- ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/lib/${PORTNAME}/
+.for FILE in ${LIBS}
+ ${INSTALL_DATA} ${WRKSRC}/${FILE} ${PREFIX}/lib/${PORTNAME}/
.endfor
+
+#
+# Install port's documentation
+#
.if !defined(NOPORTDOCS)
${MKDIR} ${EXAMPLESDIR}
-.for f in ${EXAMPLES_EXEC}
- ${INSTALL_DATA} ${WRKSRC}/sample/${f} ${EXAMPLESDIR}/
-.endfor
-.for f in ${EXAMPLES_DATA}
- ${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${EXAMPLESDIR}/
-.endfor
- ${MKDIR} ${DOCSDIR}/ja
-.for f in ${DOCS_EN}
- ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}/
-.endfor
-.for f in ${DOCS_JA}
- ${INSTALL_SCRIPT} ${WRKSRC}/${f} ${DOCSDIR}/ja/
-.endfor
+ ${INSTALL_DATA} ${WRKSRC}/sample/* ${EXAMPLESDIR}
+
+ ${MKDIR} ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/README* ${WRKSRC}/Q_and_A* ${DOCSDIR}
.endif
.include <bsd.port.mk>
diff --git a/dns/dns_balance/distinfo b/dns/dns_balance/distinfo
index abf77afb44a9..f9445847b415 100644
--- a/dns/dns_balance/distinfo
+++ b/dns/dns_balance/distinfo
@@ -1,3 +1,3 @@
-MD5 (DNS-Balance-1.1.tar.gz) = a01bcf3fc7ce6ac7ad5b6bb5e441ad9d
-SHA256 (DNS-Balance-1.1.tar.gz) = 09148f5e5fb5f1e2ef384d93e55fd36e2d3d5537cd7f69fb032ec8a3573b36b0
-SIZE (DNS-Balance-1.1.tar.gz) = 16496
+MD5 (DNS-Balance-2.0.tar.gz) = 2d68bb2fd5279906feaf5570027ce267
+SHA256 (DNS-Balance-2.0.tar.gz) = 117d42986f7b090e827110ba74a00f6a488244f74605e22c5587a13e604bf4de
+SIZE (DNS-Balance-2.0.tar.gz) = 17256
diff --git a/dns/dns_balance/files/dns_balance.sh.in b/dns/dns_balance/files/dns_balance.sh.in
index 9855a7fba88d..1dbe5dd7f01f 100644
--- a/dns/dns_balance/files/dns_balance.sh.in
+++ b/dns/dns_balance/files/dns_balance.sh.in
@@ -11,12 +11,14 @@ name=dns_balance
rcvar=`set_rcvar`
load_rc_config ${name}
-
: ${dns_balance_enable="NO"}
-: ${dns_balance_pidfile="/var/run/dns_balance.pid"}
-: ${dns_balance_flags="-l /var/log/dns_balance.log -p ${dns_balance_pidfile}"}
+: ${dns_balance_logfile="/var/log/${name}.log"}
+: ${dns_balance_pidfile="/var/log/${name}.pid"}
+: ${dns_balance_flags=""}
-command="env ROOT=%%PREFIX%%/lib/dns_balance %%PREFIX%%/sbin/dns_balance"
+command="%%PREFIX%%/sbin/${name}"
+command_args="-l ${dns_balance_logfile} -p ${dns_balance_pidfile}"
+command_interpreter=%%RUBY%%
pidfile=${dns_balance_pidfile}
run_rc_command "$1"
diff --git a/dns/dns_balance/files/patch-dns_balance.rb b/dns/dns_balance/files/patch-dns_balance.rb
index d3ef71c182d6..2cbb7df948de 100644
--- a/dns/dns_balance/files/patch-dns_balance.rb
+++ b/dns/dns_balance/files/patch-dns_balance.rb
@@ -1,36 +1,42 @@
---- dns_balance.rb.orig Thu Feb 6 17:39:46 2003
-+++ dns_balance.rb Sun Jul 18 00:58:12 2004
-@@ -19,6 +19,8 @@
- require 'thread'
- require 'getopts'
+--- dns_balance.rb.orig Sat Jun 11 02:23:56 2005
++++ dns_balance.rb Tue Aug 8 23:51:31 2006
+@@ -7,14 +7,7 @@
+ # $Id: dns_balance.rb,v 1.25 2003/06/13 22:07:27 elca Exp $
-+$:.unshift "%%PREFIX%%/etc/dns_balance", "%%PREFIX%%/lib/dns_balance"
-+
- require 'datatype.rb'
- require 'multilog.rb'
- require 'log_writer.rb'
-@@ -39,9 +41,11 @@
- # 関数
-
- def usage()
-- print "Usage: ruby dns_balance.rb [-lh] [-i ipaddr]\n"
-+ print "Usage: dns_balance.rb [-h] [-i ipaddr] [-l logfile] [-p pidfile]\n"
-+ print " -l logfile print log to logfile\n"
- print " -i ipaddr listen IP address (default:0.0.0.0)\n"
- print " -h help message\n"
-+ print " -p pidfile record PID in pidfile\n"
- print " --as Enable AS namespace\n"
- exit(111)
- end
-@@ -184,12 +188,45 @@
- # main
-
- srand()
--getopts("lh", "i:0.0.0.0", "d:", "as")
-+getopts("h", "i:0.0.0.0", "d:", "as", 'l:', 'p:')
+ # DNS Balance の存在するパス名
+-if ENV["ROOT"] == nil
+- warn("\"ROOT\" environment is recommended. Use current directory in this time.")
+- PREFIX = "."
+-# exit(111)
+-else
+- PREFIX = ENV["ROOT"]
+- $LOAD_PATH.unshift(PREFIX)
+-end
++$LOAD_PATH.unshift("%%PREFIX%%/etc/%%PORTNAME%%", "%%PREFIX%%/lib/%%PORTNAME%%")
+ $LOAD_PATH.freeze
- usage() if $OPT_h
+ require 'socket'
+@@ -204,6 +197,14 @@
+ opt.on("--as", "Enable AS namespace") {
+ OPT["as"] = true
+ }
++ opt.on("-l LOGFILE", String, "Print log to LOGFILE") {
++ |o|
++ OPT["l"] = o;
++ }
++ opt.on("-p PIDFILE", String, "Record PID to PIDFILE") {
++ |o|
++ OPT["p"] = o;
++ }
+ opt.on_tail("-h", "--help", "Show this help message and exit") {
+ STDERR.printf("%s", opt.to_s)
+ exit(111)
+@@ -212,10 +213,42 @@
+ }
+ OPT.freeze
+-ML = MultiLog::new
+-ML.open
+exit! if fork
+Process::setsid
+exit! if fork
@@ -39,14 +45,14 @@
+STDERR.close
+
+$pidfile = nil
-+if $OPT_p
-+ $pidfile = $OPT_p
++if OPT["p"]
++ $pidfile = OPT["p"]
+ File::open($pidfile, 'w') { |f| f.puts $$ }
+end
+
-+$logout = nil
-+if $OPT_l
-+ $logout = File::open($OPT_l, 'a+')
++$logout = nil
++if OPT["l"]
++ $logout = File::open(OPT["l"], 'a+')
+ $logout.sync = true
+end
+
@@ -58,15 +64,34 @@
+ }
+end
+
- ML = MultiLog.new
--ML.open
-+if $OPT_l
-+ $logout = File::open($OPT_l, 'a+')
++ ML = MultiLog.new
++if OPT["l"]
++ $logout = File::open(OPT["l"], 'a+')
+ $logout.sync = true
+ ML.open($logout)
+else
+ ML.open
+end
- ML.log("dir: " + Prefix)
+-ML.log("dir: " + PREFIX)
ML.log("start")
+
+
+@@ -224,7 +257,7 @@
+ #
+ Thread::start {
+ loop {
+- if test(?r, PREFIX + "/addr") || test(?r, "./addr")
++ if test(?r, "%%ETCDIR%%" + "/addr")
+ begin
+ load("addr")
+
+@@ -234,7 +267,7 @@
+ end
+ end
+
+- #if test(?r, PREFIX + "/addr-once") || test(?r, "./addr-once")
++ #if test(?r, "%%ETCDIR%%" + "/addr-once")
+ # Thread.exit
+ #end
+
diff --git a/dns/dns_balance/pkg-descr b/dns/dns_balance/pkg-descr
index 5fa28c7c3438..a99913b9bcff 100644
--- a/dns/dns_balance/pkg-descr
+++ b/dns/dns_balance/pkg-descr
@@ -6,4 +6,9 @@ o Can answer the most proper resolution based on the client's IP
o Implements "A" record lookups only. This would be good for
security.
-WWW: http://openlab.ring.gr.jp/dns_balance/index.html.en
+This (FreeBSD) version differs from original in the following:
+- It works as a daemon
+- Has ability to write messages to logfile
+- Can save it's PID
+
+WWW: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/dns_balance/
diff --git a/dns/dns_balance/pkg-plist b/dns/dns_balance/pkg-plist
index 317db70891e4..dbe1c4fa3136 100644
--- a/dns/dns_balance/pkg-plist
+++ b/dns/dns_balance/pkg-plist
@@ -1,9 +1,9 @@
sbin/dns_balance
-@unexec if cmp -s %D/etc/dns_balance/addrdb.rb %D/etc/dns_balance/addrdb.rb-dist; then rm -f %D/etc/dns_balance/addrdb.rb; fi
-etc/dns_balance/addrdb.rb-dist
+@unexec if cmp -s %%ETCDIR%%/addrdb.rb %%ETCDIR%%/addrdb.rb.dist; then rm -f %%ETCDIR%%/addrdb.rb; fi
+etc/dns_balance/addrdb.rb.dist
@exec [ ! -f %B/addrdb.rb ] && cp %B/%f %B/addrdb.rb
-@unexec if cmp -s %D/etc/dns_balance/namespace.rb %D/etc/dns_balance/namespace.rb-dist; then rm -f %D/etc/dns_balance/namespace.rb; fi
-etc/dns_balance/namespace.rb-dist
+@unexec if cmp -s %%ETCDIR%%/namespace.rb %%ETCDIR%%/namespace.rb.dist; then rm -f %%ETCDIR%%/namespace.rb; fi
+etc/dns_balance/namespace.rb.dist
@exec [ ! -f %B/namespace.rb ] && cp %B/%f %B/namespace.rb
@dirrm etc/dns_balance
lib/dns_balance/as_search.rb
@@ -13,14 +13,12 @@ lib/dns_balance/log_writer.rb
lib/dns_balance/multilog.rb
lib/dns_balance/util.rb
@dirrm lib/dns_balance
+%%PORTDOCS%%%%DOCSDIR%%/Q_and_A.dns_balance
%%PORTDOCS%%%%DOCSDIR%%/Q_and_A.dns_balance.eng
+%%PORTDOCS%%%%DOCSDIR%%/README.dns_balance
%%PORTDOCS%%%%DOCSDIR%%/README.dns_balance.eng
+%%PORTDOCS%%%%DOCSDIR%%/README.dnsbalance+daemontools
%%PORTDOCS%%%%DOCSDIR%%/README.dnsbalance+daemontools.eng
-%%PORTDOCS%%%%DOCSDIR%%/ja/ChangeLog
-%%PORTDOCS%%%%DOCSDIR%%/ja/Q_and_A.dns_balance
-%%PORTDOCS%%%%DOCSDIR%%/ja/README.dns_balance
-%%PORTDOCS%%%%DOCSDIR%%/ja/README.dnsbalance+daemontools
-%%PORTDOCS%%@dirrm %%DOCSDIR%%/ja
%%PORTDOCS%%@dirrm %%DOCSDIR%%
%%PORTDOCS%%%%EXAMPLESDIR%%/addr
%%PORTDOCS%%%%EXAMPLESDIR%%/addr.ring
@@ -28,6 +26,7 @@ lib/dns_balance/util.rb
%%PORTDOCS%%%%EXAMPLESDIR%%/make_namespace.rb
%%PORTDOCS%%%%EXAMPLESDIR%%/makedb.rb
%%PORTDOCS%%%%EXAMPLESDIR%%/makeringdb.rb
+%%PORTDOCS%%%%EXAMPLESDIR%%/namespace.rb
%%PORTDOCS%%%%EXAMPLESDIR%%/namespace.txt
%%PORTDOCS%%%%EXAMPLESDIR%%/ringupdate.sh
%%PORTDOCS%%@dirrm %%EXAMPLESDIR%%