diff --git a/dns/dns_balance/Makefile b/dns/dns_balance/Makefile index 0f6525425c92..fed1306722b2 100644 --- a/dns/dns_balance/Makefile +++ b/dns/dns_balance/Makefile @@ -6,7 +6,7 @@ # PORTNAME= dns_balance -PORTVERSION= 0.6.1 +PORTVERSION= 1.1 CATEGORIES= dns MASTER_SITES= http://www.netlab.is.tsukuba.ac.jp/~yokota/archive/ DISTNAME= DNS-Balance-${PORTVERSION} @@ -15,6 +15,7 @@ MAINTAINER= knu@FreeBSD.org COMMENT= A dynamic load-balancing DNS server USE_RUBY= yes +USE_RC_SUBR= yes NO_BUILD= yes @@ -24,8 +25,11 @@ RUBY_SHEBANG_FILES= ${WRKSRC}/dns_balance.rb \ ${WRKSRC}/sample/make_namespace.rb ETCS= addrdb.rb \ namespace.rb -LIBS= datatype.rb \ +LIBS= as_search.rb \ + cache.rb \ + datatype.rb \ log_writer.rb \ + multilog.rb \ util.rb EXAMPLES_EXEC= make_namespace.rb \ makedb.rb \ @@ -34,7 +38,6 @@ EXAMPLES_EXEC= make_namespace.rb \ EXAMPLES_DATA= addr \ addr.ring \ addr.ring.txt \ - addr.txt \ namespace.txt DOCS_EN= Q_and_A.dns_balance.eng \ README.dns_balance.eng \ @@ -43,17 +46,18 @@ DOCS_JA= ChangeLog \ Q_and_A.dns_balance \ README.dns_balance \ README.dnsbalance+daemontools +SUBST= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} post-patch: - ${RUBY} -pe 'gsub /!!PREFIX!!/, "${PREFIX}"' ${WRKSRC}/dns_balance.rb > ${WRKSRC}/dns_balance - ${RUBY} -pe 'gsub /!!PREFIX!!/, "${PREFIX}"' ${FILESDIR}/dns_balance.sh > ${WRKSRC}/dns_balance.sh + ${SED} ${SUBST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${WRKSRC}/dns_balance.rb > ${WRKSRC}/dns_balance + ${SED} ${SUBST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${FILESDIR}/dns_balance.sh > ${WRKSRC}/dns_balance.sh do-install: ${INSTALL_SCRIPT} ${WRKSRC}/dns_balance ${PREFIX}/sbin/ ${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} + [ -f ${PREFIX}/etc/${PORTNAME}/${f} ] || ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/etc/${PORTNAME}/${f} .endfor ${MKDIR} ${PREFIX}/lib/${PORTNAME} .for f in ${LIBS} @@ -61,19 +65,19 @@ do-install: .endfor ${INSTALL_SCRIPT} ${WRKSRC}/dns_balance.sh ${PREFIX}/etc/rc.d/ .if !defined(NOPORTDOCS) - ${MKDIR} ${PREFIX}/share/examples/${PORTNAME} + ${MKDIR} ${EXAMPLESDIR} .for f in ${EXAMPLES_EXEC} - ${INSTALL_DATA} ${WRKSRC}/sample/${f} ${PREFIX}/share/examples/${PORTNAME}/ + ${INSTALL_DATA} ${WRKSRC}/sample/${f} ${EXAMPLESDIR}/ .endfor .for f in ${EXAMPLES_DATA} - ${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${PREFIX}/share/examples/${PORTNAME}/ + ${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${EXAMPLESDIR}/ .endfor - ${MKDIR} ${PREFIX}/share/doc/${PORTNAME}/ja + ${MKDIR} ${DOCSDIR}/ja .for f in ${DOCS_EN} - ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/share/doc/${PORTNAME}/ + ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}/ .endfor .for f in ${DOCS_JA} - ${INSTALL_SCRIPT} ${WRKSRC}/${f} ${PREFIX}/share/doc/${PORTNAME}/ja/ + ${INSTALL_SCRIPT} ${WRKSRC}/${f} ${DOCSDIR}/ja/ .endfor .endif diff --git a/dns/dns_balance/distinfo b/dns/dns_balance/distinfo index c4932400d17b..fe6ccfe4247f 100644 --- a/dns/dns_balance/distinfo +++ b/dns/dns_balance/distinfo @@ -1,2 +1,2 @@ -MD5 (DNS-Balance-0.6.1.tar.gz) = 6ce31e9966037800dfbe96b4c991b9c4 -SIZE (DNS-Balance-0.6.1.tar.gz) = 12465 +MD5 (DNS-Balance-1.1.tar.gz) = a01bcf3fc7ce6ac7ad5b6bb5e441ad9d +SIZE (DNS-Balance-1.1.tar.gz) = 16496 diff --git a/dns/dns_balance/files/dns_balance.sh b/dns/dns_balance/files/dns_balance.sh index 49c7fff46472..cda1b4dd7857 100644 --- a/dns/dns_balance/files/dns_balance.sh +++ b/dns/dns_balance/files/dns_balance.sh @@ -1,30 +1,22 @@ #!/bin/sh # # $FreeBSD$ +# +# PROVIDE: dns_balance +# REQUIRE: DAEMON +# KEYWORD: FreeBSD -dns_balance="!!PREFIX!!/sbin/dns_balance" -pidfile="/var/run/dns_balance.pid" -logfile="/var/log/dns_balance.log" -#listen="-i 192.168.0.1" +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}" -case "$1" in -start) - if [ -x $dns_balance ]; then - echo -n ' dns_balance' - $dns_balance -l $logfile -p $pidfile $listen - fi - ;; -stop) - if [ -f $pidfile ]; then - kill `cat $pidfile` && echo -n ' dns_balance' - else - echo ' dns_balance: not running' - fi - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - exit 64 - ;; -esac +. %%RC_SUBR%% -exit 0 +name=dns_balance +rcvar=`set_rcvar` + +command="env ROOT=%%PREFIX%%/lib/dns_balance %%PREFIX%%/sbin/dns_balance" +pidfile=${dns_balance_pidfile} + +load_rc_config ${name} +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 f23d043f24eb..d3ef71c182d6 100644 --- a/dns/dns_balance/files/patch-dns_balance.rb +++ b/dns/dns_balance/files/patch-dns_balance.rb @@ -1,36 +1,36 @@ ---- dns_balance.rb.orig Fri Dec 22 12:46:39 2000 -+++ dns_balance.rb Mon Mar 5 16:59:36 2001 -@@ -10,6 +10,8 @@ +--- 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' -+$:.unshift "!!PREFIX!!/etc/dns_balance", "!!PREFIX!!/lib/dns_balance" ++$:.unshift "%%PREFIX%%/etc/dns_balance", "%%PREFIX%%/lib/dns_balance" + require 'datatype.rb' + require 'multilog.rb' require 'log_writer.rb' - require 'util.rb' -@@ -138,9 +140,10 @@ - end +@@ -39,9 +41,11 @@ + # ´Ø¿ô def usage() - print "Usage: ruby dns_balance.rb [-lh] [-i ipaddr]\n" -- print " -l print log to stdout\n" -+ print "Usage: dns_balance [-h] [-i ipaddr] [-l logfile] [-p pidfile]\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 " -p pidfile record PID in pidfile\n" print " -h help message\n" ++ print " -p pidfile record PID in pidfile\n" + print " --as Enable AS namespace\n" exit(111) end -@@ -149,9 +152,36 @@ +@@ -184,12 +188,45 @@ # main srand() --getopts("lh", "i:0.0.0.0") -+getopts("h", "i:0.0.0.0", 'l:', 'p:') +-getopts("lh", "i:0.0.0.0", "d:", "as") ++getopts("h", "i:0.0.0.0", "d:", "as", 'l:', 'p:') usage() if $OPT_h -+ + +exit! if fork +Process::setsid +exit! if fork @@ -56,7 +56,17 @@ + $logout.close if $logout + exit + } ++end ++ + ML = MultiLog.new +-ML.open ++if $OPT_l ++ $logout = File::open($OPT_l, 'a+') ++ $logout.sync = true ++ ML.open($logout) ++else ++ ML.open +end - put_log("start\n") if $OPT_l - + ML.log("dir: " + Prefix) + ML.log("start") diff --git a/dns/dns_balance/files/patch-log_writer.rb b/dns/dns_balance/files/patch-log_writer.rb deleted file mode 100644 index e18aced47fb8..000000000000 --- a/dns/dns_balance/files/patch-log_writer.rb +++ /dev/null @@ -1,12 +0,0 @@ ---- log_writer.rb.orig Fri Dec 22 12:46:39 2000 -+++ log_writer.rb Mon Mar 5 16:05:06 2001 -@@ -12,8 +12,7 @@ - - def put_log(str) - $loglock.synchronize do -- $stdout.print(str) -- $stdout.flush -+ $logout.print(str) - end - end - diff --git a/dns/dns_balance/pkg-plist b/dns/dns_balance/pkg-plist index c5fcc99f9bdf..64b0f60033c1 100644 --- a/dns/dns_balance/pkg-plist +++ b/dns/dns_balance/pkg-plist @@ -7,26 +7,28 @@ etc/dns_balance/namespace.rb-dist @exec [ ! -f %B/namespace.rb ] && cp %B/%f %B/namespace.rb @dirrm etc/dns_balance etc/rc.d/dns_balance.sh +lib/dns_balance/as_search.rb +lib/dns_balance/cache.rb lib/dns_balance/datatype.rb lib/dns_balance/log_writer.rb +lib/dns_balance/multilog.rb lib/dns_balance/util.rb @dirrm lib/dns_balance -%%PORTDOCS%%share/doc/dns_balance/Q_and_A.dns_balance.eng -%%PORTDOCS%%share/doc/dns_balance/README.dns_balance.eng -%%PORTDOCS%%share/doc/dns_balance/README.dnsbalance+daemontools.eng -%%PORTDOCS%%share/doc/dns_balance/ja/ChangeLog -%%PORTDOCS%%share/doc/dns_balance/ja/Q_and_A.dns_balance -%%PORTDOCS%%share/doc/dns_balance/ja/README.dns_balance -%%PORTDOCS%%share/doc/dns_balance/ja/README.dnsbalance+daemontools -%%PORTDOCS%%@dirrm share/doc/dns_balance/ja -%%PORTDOCS%%@dirrm share/doc/dns_balance -%%PORTDOCS%%share/examples/dns_balance/addr -%%PORTDOCS%%share/examples/dns_balance/addr.ring -%%PORTDOCS%%share/examples/dns_balance/addr.ring.txt -%%PORTDOCS%%share/examples/dns_balance/addr.txt -%%PORTDOCS%%share/examples/dns_balance/make_namespace.rb -%%PORTDOCS%%share/examples/dns_balance/makedb.rb -%%PORTDOCS%%share/examples/dns_balance/makeringdb.rb -%%PORTDOCS%%share/examples/dns_balance/namespace.txt -%%PORTDOCS%%share/examples/dns_balance/ringupdate.sh -%%PORTDOCS%%@dirrm share/examples/dns_balance +%%PORTDOCS%%%%DOCSDIR%%/Q_and_A.dns_balance.eng +%%PORTDOCS%%%%DOCSDIR%%/README.dns_balance.eng +%%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 +%%PORTDOCS%%%%EXAMPLESDIR%%/addr.ring.txt +%%PORTDOCS%%%%EXAMPLESDIR%%/make_namespace.rb +%%PORTDOCS%%%%EXAMPLESDIR%%/makedb.rb +%%PORTDOCS%%%%EXAMPLESDIR%%/makeringdb.rb +%%PORTDOCS%%%%EXAMPLESDIR%%/namespace.txt +%%PORTDOCS%%%%EXAMPLESDIR%%/ringupdate.sh +%%PORTDOCS%%@dirrm %%EXAMPLESDIR%%