--- _orig/net/bind9/Portfile	2014-01-31 10:00:47.000000000 -0500
+++ net/bind9/Portfile	2014-04-19 15:21:10.000000000 -0400
@@ -2,89 +2,98 @@
 
 PortSystem 1.0
 
-name			bind9
-version			9.9.5
-categories		net
-maintainers		geeklair.net:dluke
-platforms		darwin freebsd sunos
+name               bind9
+version            9.9.5
+revision           1
+categories         net
+maintainers        geeklair.net:dluke
+platforms          darwin freebsd sunos
 
-description		Domain Name System server
+description        Domain Name System server
 # license is actually ISC, a BSD style license, though.
 # see http://www.isc.org/software/license
-license			BSD
+license            BSD
 
-long_description	The BIND DNS Server is used on the vast majority of name \
-				serving machines on the Internet, providing a robust \
-				and stable architecture on top of which an \
-				organization's naming architecture can be built. The \
-				resolver library included in the BIND distribution \
-				provides the standard APIs for translation between domain names \
-				and Internet addresses and is intended to be linked with applications \
-				requiring name service.
+long_description    The BIND DNS Server is used on the vast majority of name \
+                    serving machines on the Internet, providing a robust \
+                    and stable architecture on top of which an \
+                    organization's naming architecture can be built. The \
+                    resolver library included in the BIND distribution \
+                    provides the standard APIs for translation between domain names \
+                    and Internet addresses and is intended to be linked with applications \
+                    requiring name service.
 
-homepage		http://www.isc.org
+homepage            http://www.isc.org
 
-distname		bind-${version}
-master_sites		isc:${name}/${version}
+distname            bind-${version}
+master_sites        isc:${name}/${version}
 
-checksums	md5	e676c65cad5234617ee22f48e328c24e \
-		sha1	f3fe8000628ec57f332aec1ad9587b767208a38f \
-		rmd160	cc2351d9af779ed1a1dd5909a10cce28ddb41747
+checksums           rmd160  cc2351d9af779ed1a1dd5909a10cce28ddb41747 \
+                    sha256  d4b64c1dde442145a316679acff2df4008aa117ae52dfa3a6bc69efecc7840d1
 
-depends_lib		port:openssl port:libxml2
+depends_lib         port:openssl port:libxml2
 
-patchfiles-append	gssapi-link.patch 
+patchfiles-append   patch-gssapi-link.diff
 
-use_autoreconf		yes
-autoreconf.args		-fvi
+use_autoreconf      yes
+autoreconf.args     -fvi
 
-use_parallel_build	no
-universal_variant	no
+use_parallel_build  no
+universal_variant   no
 
-test.run		yes
-test.target		test
+test.run            yes
+test.target         test
 
-startupitem.create	yes
-startupitem.netchange	yes
-startupitem.executable	${prefix}/sbin/named -f
+## FIXME! add dedicated user/group!
+startupitem.create  yes
+startupitem.netchange yes
+startupitem.executable ${prefix}/sbin/named -f -u named
 
-configure.env		STD_CDEFINES=-DDIG_SIGCHASE=1
+post-configure {
+    addgroup named
+    add_users named gid=[existsgroup named] home=${prefix}/var/named shell=/sbin/nologin realname=Bind\ user
+}
+
+
+configure.env       STD_CDEFINES=-DDIG_SIGCHASE=1
 
-configure.args		--mandir=${prefix}/share/man \
-				--with-openssl=${prefix} \
-				--with-libxml2=${prefix} \
-				--enable-threads \
-				--enable-ipv6 \
-				--enable-rrl
+configure.args      --mandir=${prefix}/share/man \
+                    --with-openssl=${prefix} \
+                    --with-libxml2=${prefix} \
+                    --enable-threads \
+                    --enable-ipv6 \
+                    --enable-rrl
 
 platform darwin 8 {
-	configure.args-append --with-dlopen=no \
-				--with-gssapi=no
+    configure.args-append --with-dlopen=no \
+                --with-gssapi=no
 }
 
 platform darwin 9 {
-	configure.args-append --with-dlopen=no
+    configure.args-append --with-dlopen=no
 }
 
-post-destroot	{
-	# Ensure needed directories
-	xinstall -m 755 -d \
-		${destroot}${prefix}/var/named \
-		${destroot}${prefix}/var/run
-
-	# Install the conf file as a sample
-	xinstall -o root -m 644 ${filespath}/named.conf \
-		${destroot}${prefix}/etc/named.conf.dist
-	reinplace "s|%%PREFIX%%|${prefix}|g" \
-		${destroot}${prefix}/etc/named.conf.dist
-
-	# Install the db files as samples
-	foreach f "db.127.0.0 db.cache db.localhost" {
-		xinstall -o root -m 644 ${filespath}/${f} \
-			${destroot}${prefix}/var/named/${f}.dist
-	}
+destroot.asroot     yes
+install.asroot      yes
+post-destroot    {
+    # Ensure needed directories
+    xinstall -m 755 -d \
+        ${destroot}${prefix}/var/named \
+        ${destroot}${prefix}/var/run
+
+    # Install the conf file as a sample
+    xinstall -o root -m 644 ${filespath}/named.conf \
+        ${destroot}${prefix}/etc/named.conf.dist
+    reinplace "s|%%PREFIX%%|${prefix}|g" \
+        ${destroot}${prefix}/etc/named.conf.dist
+
+    # Install the db files as samples
+    foreach f "db.127.0.0 db.cache db.localhost" {
+        xinstall -o root -m 644 ${filespath}/${f} \
+            ${destroot}${prefix}/var/named/${f}.dist
+    }
 
-	destroot.keepdirs ${destroot}${prefix}/var/run
+    destroot.keepdirs ${destroot}${prefix}/var/run
 }
 
 notes "******************************************************
@@ -97,4 +106,13 @@
 * sudo cp ${prefix}/var/named/db.127.0.0.dist ${prefix}/var/named/db.127.0.0
 * sudo cp ${prefix}/var/named/db.cache.dist ${prefix}/var/named/db.cache
 * sudo cp ${prefix}/var/named/db.localhost.dist ${prefix}/var/named/db.localhost
+  Generate key
+    $ sudo rndc-confgen -a
+* Remember to secure your configuration.
+http://www.cymru.com/Documents/secure-bind-template.html
 ******************************************************"
+
+livecheck.type      regex
+livecheck.url       ${homepage}/downloads/
+livecheck.regex     "target=\"_blank\">BIND (\\d+\.\\d+\.\\d+) - tar.gz</a>"
+
