From 0719636b05e4a66f26d2c1542f221518f79b79e0 Mon Sep 17 00:00:00 2001
From: Noah Meyerhans <noahm@debian.org>
Date: Sat, 16 Aug 2014 14:45:39 -0700
Subject: [PATCH] net/bind: Re-import package net/bind from oldpackages.
 Signed-off-by: Noah Meyerhans <noahm@debian.org>

---
 net/bind/Makefile                      | 199 +++++++++++++++++++++++++
 net/bind/files/bind/db.0               |  12 ++
 net/bind/files/bind/db.127             |  13 ++
 net/bind/files/bind/db.255             |  12 ++
 net/bind/files/bind/db.local           |  13 ++
 net/bind/files/bind/db.root            |  45 ++++++
 net/bind/files/bind/named.conf.example |  45 ++++++
 net/bind/files/named.init              |  40 +++++
 net/bind/patches/001-no-tests.patch    |  26 ++++
 9 files changed, 405 insertions(+)
 create mode 100644 net/bind/Makefile
 create mode 100644 net/bind/files/bind/db.0
 create mode 100644 net/bind/files/bind/db.127
 create mode 100644 net/bind/files/bind/db.255
 create mode 100644 net/bind/files/bind/db.local
 create mode 100644 net/bind/files/bind/db.root
 create mode 100644 net/bind/files/bind/named.conf.example
 create mode 100644 net/bind/files/named.init
 create mode 100644 net/bind/patches/001-no-tests.patch

diff --git a/net/bind/Makefile b/net/bind/Makefile
new file mode 100644
index 000000000..7b1f8f717
--- /dev/null
+++ b/net/bind/Makefile
@@ -0,0 +1,199 @@
+#
+# Copyright (C) 2006-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bind
+PKG_VERSION:=9.9.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:= \
+	ftp://ftp.isc.org/isc/bind9/$(PKG_VERSION) \
+	http://www.mirrorservice.org/sites/ftp.isc.org/isc/bind9/$(PKG_VERSION)
+PKG_MD5SUM:=f69757adc86776daed8e5acb0ee7c0ca
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 libtool.m4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bind/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+bind-libs
+  TITLE:=bind
+  URL:=https://www.isc.org/software/bind
+  SUBMENU:=IP Addresses and Names
+endef
+
+define Package/bind-libs
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libopenssl
+  TITLE:=bind shared libraries
+  URL:=https://www.isc.org/software/bind
+endef
+
+define Package/bind-server
+  $(call Package/bind/Default)
+  TITLE+= DNS server
+endef
+
+define Package/bind-client
+  $(call Package/bind/Default)
+  TITLE+= dynamic DNS client
+endef
+
+define Package/bind-tools
+  $(call Package/bind/Default)
+  TITLE+= administration tools (all)
+endef
+
+define Package/bind-rndc
+  $(call Package/bind/Default)
+  TITLE+= administration tools (rndc and rndc-confgen only)
+endef
+
+define Package/bind-check
+  $(call Package/bind/Default)
+  TITLE+= administration tools (named-checkconf and named-checkzone only)
+endef
+
+define Package/bind-dnssec
+  $(call Package/bind/Default)
+  TITLE+= administration tools (dnssec-keygen and dnssec-signzone only)
+endef
+
+define Package/bind-host
+  $(call Package/bind/Default)
+  TITLE+= simple DNS client
+endef
+
+define Package/bind-dig
+  $(call Package/bind/Default)
+  TITLE+= DNS excavation tool
+endef
+
+export BUILD_CC="$(TARGET_CC)"
+
+CONFIGURE_ARGS += \
+	--enable-shared \
+	--enable-static \
+	--with-randomdev="/dev/urandom" \
+	--disable-threads \
+	--disable-linux-caps \
+	--with-openssl="$(STAGING_DIR)/usr" \
+	--with-libtool \
+	--with-libxml2=no \
+	--enable-epoll=yes \
+	--with-gost=no \
+	--with-gssapi=no \
+	--with-ecdsa=no \
+	--with-readline=no
+
+CONFIGURE_VARS += \
+	BUILD_CC="$(TARGET_CC)" \
+
+define Build/Compile
+	$(MAKE) -C $(PKG_BUILD_DIR)/lib/dns \
+		BUILD_CC="$(HOSTCC)" \
+		CC="$(HOSTCC)" \
+		CFLAGS="-O2" \
+		LIBS="" \
+		gen
+	$(call Build/Compile/Default)
+endef
+
+define Package/bind-libs/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
+endef
+
+define Package/bind-server/install
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/etc/bind
+	$(CP) \
+		./files/bind/db.0 \
+		./files/bind/db.127 \
+		./files/bind/db.255 \
+		./files/bind/db.local \
+		./files/bind/db.root \
+		$(1)/etc/bind/
+	$(CP) ./files/bind/named.conf.example $(1)/etc/bind/named.conf
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/named.init $(1)/etc/init.d/named
+	find $(1)/etc/bind/ -name ".svn" | xargs rm -rf
+endef
+
+define Package/bind-server/conffiles
+/etc/bind/db.0
+/etc/bind/db.127
+/etc/bind/db.255
+/etc/bind/db.local
+/etc/bind/db.root
+/etc/bind/named.conf
+endef
+
+define Package/bind-client/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nsupdate $(1)/usr/bin/
+endef
+
+define Package/bind-tools/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/
+endef
+
+define Package/bind-rndc/install
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/
+endef
+
+define Package/bind-check/install
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/
+endef
+
+define Package/bind-dnssec/install
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/
+endef
+
+define Package/bind-host/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/
+endef
+
+define Package/bind-dig/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,bind-libs))
+$(eval $(call BuildPackage,bind-server))
+$(eval $(call BuildPackage,bind-client))
+$(eval $(call BuildPackage,bind-tools))
+$(eval $(call BuildPackage,bind-rndc))
+$(eval $(call BuildPackage,bind-check))
+$(eval $(call BuildPackage,bind-dnssec))
+$(eval $(call BuildPackage,bind-host))
+$(eval $(call BuildPackage,bind-dig))
diff --git a/net/bind/files/bind/db.0 b/net/bind/files/bind/db.0
new file mode 100644
index 000000000..e3aabdbee
--- /dev/null
+++ b/net/bind/files/bind/db.0
@@ -0,0 +1,12 @@
+;
+; BIND reverse data file for broadcast zone
+;
+$TTL	604800
+@	IN	SOA	localhost. root.localhost. (
+			      1		; Serial
+			 604800		; Refresh
+			  86400		; Retry
+			2419200		; Expire
+			 604800 )	; Negative Cache TTL
+;
+@	IN	NS	localhost.
diff --git a/net/bind/files/bind/db.127 b/net/bind/files/bind/db.127
new file mode 100644
index 000000000..cd05bef14
--- /dev/null
+++ b/net/bind/files/bind/db.127
@@ -0,0 +1,13 @@
+;
+; BIND reverse data file for local loopback interface
+;
+$TTL	604800
+@	IN	SOA	localhost. root.localhost. (
+			      1		; Serial
+			 604800		; Refresh
+			  86400		; Retry
+			2419200		; Expire
+			 604800 )	; Negative Cache TTL
+;
+@	IN	NS	localhost.
+1.0.0	IN	PTR	localhost.
diff --git a/net/bind/files/bind/db.255 b/net/bind/files/bind/db.255
new file mode 100644
index 000000000..e3aabdbee
--- /dev/null
+++ b/net/bind/files/bind/db.255
@@ -0,0 +1,12 @@
+;
+; BIND reverse data file for broadcast zone
+;
+$TTL	604800
+@	IN	SOA	localhost. root.localhost. (
+			      1		; Serial
+			 604800		; Refresh
+			  86400		; Retry
+			2419200		; Expire
+			 604800 )	; Negative Cache TTL
+;
+@	IN	NS	localhost.
diff --git a/net/bind/files/bind/db.local b/net/bind/files/bind/db.local
new file mode 100644
index 000000000..66b489235
--- /dev/null
+++ b/net/bind/files/bind/db.local
@@ -0,0 +1,13 @@
+;
+; BIND data file for local loopback interface
+;
+$TTL	604800
+@	IN	SOA	localhost. root.localhost. (
+			      1		; Serial
+			 604800		; Refresh
+			  86400		; Retry
+			2419200		; Expire
+			 604800 )	; Negative Cache TTL
+;
+@	IN	NS	localhost.
+@	IN	A	127.0.0.1
diff --git a/net/bind/files/bind/db.root b/net/bind/files/bind/db.root
new file mode 100644
index 000000000..0eb52af7a
--- /dev/null
+++ b/net/bind/files/bind/db.root
@@ -0,0 +1,45 @@
+
+; <<>> DiG 9.2.3 <<>> ns . @a.root-servers.net.
+;; global options:  printcmd
+;; Got answer:
+;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18944
+;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13
+
+;; QUESTION SECTION:
+;.				IN	NS
+
+;; ANSWER SECTION:
+.			518400	IN	NS	A.ROOT-SERVERS.NET.
+.			518400	IN	NS	B.ROOT-SERVERS.NET.
+.			518400	IN	NS	C.ROOT-SERVERS.NET.
+.			518400	IN	NS	D.ROOT-SERVERS.NET.
+.			518400	IN	NS	E.ROOT-SERVERS.NET.
+.			518400	IN	NS	F.ROOT-SERVERS.NET.
+.			518400	IN	NS	G.ROOT-SERVERS.NET.
+.			518400	IN	NS	H.ROOT-SERVERS.NET.
+.			518400	IN	NS	I.ROOT-SERVERS.NET.
+.			518400	IN	NS	J.ROOT-SERVERS.NET.
+.			518400	IN	NS	K.ROOT-SERVERS.NET.
+.			518400	IN	NS	L.ROOT-SERVERS.NET.
+.			518400	IN	NS	M.ROOT-SERVERS.NET.
+
+;; ADDITIONAL SECTION:
+A.ROOT-SERVERS.NET.	3600000	IN	A	198.41.0.4
+B.ROOT-SERVERS.NET.	3600000	IN	A	192.228.79.201
+C.ROOT-SERVERS.NET.	3600000	IN	A	192.33.4.12
+D.ROOT-SERVERS.NET.	3600000	IN	A	128.8.10.90
+E.ROOT-SERVERS.NET.	3600000	IN	A	192.203.230.10
+F.ROOT-SERVERS.NET.	3600000	IN	A	192.5.5.241
+G.ROOT-SERVERS.NET.	3600000	IN	A	192.112.36.4
+H.ROOT-SERVERS.NET.	3600000	IN	A	128.63.2.53
+I.ROOT-SERVERS.NET.	3600000	IN	A	192.36.148.17
+J.ROOT-SERVERS.NET.	3600000	IN	A	192.58.128.30
+K.ROOT-SERVERS.NET.	3600000	IN	A	193.0.14.129
+L.ROOT-SERVERS.NET.	3600000	IN	A	199.7.83.42
+M.ROOT-SERVERS.NET.	3600000	IN	A	202.12.27.33
+
+;; Query time: 81 msec
+;; SERVER: 198.41.0.4#53(a.root-servers.net.)
+;; WHEN: Sun Feb  1 11:27:14 2004
+;; MSG SIZE  rcvd: 436
+
diff --git a/net/bind/files/bind/named.conf.example b/net/bind/files/bind/named.conf.example
new file mode 100644
index 000000000..162454955
--- /dev/null
+++ b/net/bind/files/bind/named.conf.example
@@ -0,0 +1,45 @@
+// This is the primary configuration file for the BIND DNS server named.
+
+options {
+	directory "/tmp";
+
+	// If your ISP provided one or more IP addresses for stable 
+	// nameservers, you probably want to use them as forwarders.  
+	// Uncomment the following block, and insert the addresses replacing 
+	// the all-0's placeholder.
+
+	// forwarders {
+	// 	0.0.0.0;
+	// };
+
+	auth-nxdomain no;    # conform to RFC1035
+};
+
+// prime the server with knowledge of the root servers
+zone "." {
+	type hint;
+	file "/etc/bind/db.root";
+};
+
+// be authoritative for the localhost forward and reverse zones, and for
+// broadcast zones as per RFC 1912
+
+zone "localhost" {
+	type master;
+	file "/etc/bind/db.local";
+};
+
+zone "127.in-addr.arpa" {
+	type master;
+	file "/etc/bind/db.127";
+};
+
+zone "0.in-addr.arpa" {
+	type master;
+	file "/etc/bind/db.0";
+};
+
+zone "255.in-addr.arpa" {
+	type master;
+	file "/etc/bind/db.255";
+};
diff --git a/net/bind/files/named.init b/net/bind/files/named.init
new file mode 100644
index 000000000..986e5fe08
--- /dev/null
+++ b/net/bind/files/named.init
@@ -0,0 +1,40 @@
+#!/bin/sh /etc/rc.common
+START=50
+
+config_file=/etc/bind/named.conf
+pid_file=/var/run/named/named.pid
+
+start() {
+  if [ -e $pid_file ]
+  then
+     echo "  named already running with PID `cat $pid_file`"
+     return 1
+  fi
+  echo Starting isc-bind
+
+  /usr/sbin/named -c $config_file
+
+  if [ $? -ne 0 ]
+  then
+    echo "  isc-bind failed to start"
+  fi
+}
+
+stop() {
+  echo "Stopping isc-bind"
+  if [ -e $pid_file ]
+  then
+    kill `cat $pid_file`
+
+    if [ $? -ne 0 ]
+    then
+      echo "  PID " `cat $pid_file` not found
+      echo "  Is the named server running?"
+    fi
+
+    rm -f $pid_file
+
+    else
+    echo "  $pid_file not found"
+  fi
+}
diff --git a/net/bind/patches/001-no-tests.patch b/net/bind/patches/001-no-tests.patch
new file mode 100644
index 000000000..c969c5e96
--- /dev/null
+++ b/net/bind/patches/001-no-tests.patch
@@ -0,0 +1,26 @@
+Index: bind-9.9.4/bin/Makefile.in
+===================================================================
+--- bind-9.9.4.orig/bin/Makefile.in
++++ bind-9.9.4/bin/Makefile.in
+@@ -19,7 +19,7 @@ srcdir =	@srcdir@
+ VPATH =		@srcdir@
+ top_srcdir =	@top_srcdir@
+ 
+-SUBDIRS =	named rndc dig dnssec tools tests nsupdate \
++SUBDIRS =	named rndc dig dnssec tools nsupdate \
+ 		check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@
+ TARGETS =
+ 
+Index: bind-9.9.4/lib/Makefile.in
+===================================================================
+--- bind-9.9.4.orig/lib/Makefile.in
++++ bind-9.9.4/lib/Makefile.in
+@@ -23,7 +23,7 @@ top_srcdir =	@top_srcdir@
+ # Attempt to disable parallel processing.
+ .NOTPARALLEL:
+ .NO_PARALLEL:
+-SUBDIRS =	isc isccc dns isccfg bind9 lwres tests
++SUBDIRS =	isc isccc dns isccfg bind9 lwres
+ TARGETS =
+ 
+ @BIND9_MAKE_RULES@