Skip to contentSkip to conversation

bind BIND_PKGDIR

PATCH New Christopher McCrory 2 participants 6 messages Feb 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 bind BIND_PKGDIR

use BIND_PKGDIR instead of package/bind

---
 package/bind/bind.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/bind/bind.mk +2 -2
index bec902079c..392ef321c2 100644
@@ -93,11 +93,11 @@ endef
 
 ifeq ($(BR2_PACKAGE_BIND_SERVER),y)
 define BIND_INSTALL_INIT_SYSV
-	$(INSTALL) -m 0755 -D package/bind/S81named \
+	$(INSTALL) -m 0755 -D $(BIND_PKGDIR)/S81named \
 		$(TARGET_DIR)/etc/init.d/S81named
 endef
 define BIND_INSTALL_INIT_SYSTEMD
-	$(INSTALL) -D -m 644 package/bind/named.service \
+	$(INSTALL) -D -m 644 $(BIND_PKGDIR)/named.service \
 		$(TARGET_DIR)/usr/lib/systemd/system/named.service
 
 	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
Signature · 1 line
2.14.3
#1 lore raw

PATCH 2/3 bind config files

Snag config files from FreeBSD ports and use those for a working DNS system

( Not sure what to add for Licensing )

---
 package/bind/bind.hash |  4 ++++
 package/bind/bind.mk   | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
package/bind/bind.hash +4 -0
index 199db704fe..c98442423a 100644
@@ -1,3 +1,7 @@
 # Verified from http://ftp.isc.org/isc/bind9/9.11.2-P1/bind-9.11.2-P1.tar.gz.sha256.asc
 sha256 cec31548832fca3f85d95178d4019b7d702039e8595d4c93914feba337df1212 bind-9.11.2-P1.tar.gz
 sha256 d3906dfe153e2c48440d3ca1d5319f5e89b4b820cdfc5d0779c23d7ac2b175e9 COPYRIGHT
+sha256 ba341abfa4066dd2b72442142f7fe2ccb9f3793cf29856b822545c2745ffa978 empty.db
+sha256 6b19177db479e2f5f287c9d1f83e2ae6a503e3fb1e74d1f19513dddf8c8aee75 named.conf.in
+sha256 c4894aa07da2b8460afd595694794708ad7753892c39c4177a2f89de2d72b945 named.root
+sha256 a13ccc8a9d6a5a0ee4b2cce34b927a60fc4b60216e172e660bb28c803f09d416 localhost-forward.db
package/bind/bind.mk +32 -0
index 392ef321c2..886cf5d66e 100644
@@ -6,6 +6,10 @@
 
 BIND_VERSION = 9.11.2-P1
 BIND_SITE = http://ftp.isc.org/isc/bind9/$(BIND_VERSION)
+BIND_EXTRA_DOWNLOADS = https://svn.freebsd.org/ports/head/dns/bind912/files/empty.db
+BIND_EXTRA_DOWNLOADS += https://svn.freebsd.org/ports/head/dns/bind912/files/named.root https://svn.freebsd.org/ports/head/dns/bind912/files/localhost-forward.db https://svn.freebsd.org/ports/head/dns/bind912/files/named.conf.in
+BIND_EXTRA_DOWNLOADS += https://svn.freebsd.org/ports/head/dns/bind912/files/localhost-forward.db https://svn.freebsd.org/ports/head/dns/bind912/files/named.conf.in
+BIND_EXTRA_DOWNLOADS += https://svn.freebsd.org/ports/head/dns/bind912/files/named.conf.in
 # bind does not support parallel builds.
 BIND_MAKE = $(MAKE1)
 BIND_INSTALL_STAGING = YES
@@ -113,6 +117,34 @@ ifeq ($(BR2_PACKAGE_BIND_TOOLS),)
 BIND_POST_INSTALL_TARGET_HOOKS += BIND_TARGET_REMOVE_TOOLS
 endif
 
+define BIND_POST_DOWNLOAD_CONF_FILES
+	$(INSTALL) -m 0755 -d $(@D)/BR2
+	$(INSTALL) -m 0644 -D $(DL_DIR)/empty.db $(@D)/BR2/
+	$(INSTALL) -m 0644 -D $(DL_DIR)/named.root $(@D)/BR2/
+	$(INSTALL) -m 0644 -D $(DL_DIR)/localhost-forward.db $(@D)/BR2/
+	$(INSTALL) -m 0644 -D $(DL_DIR)/named.conf.in $(@D)/BR2/
+	sed -f $(BIND_PKGDIR)/configs.sed \
+	    $(@D)/BR2/named.conf.in > $(@D)/BR2/named.conf
+endef
+BIND_POST_DOWNLOAD_HOOKS += BIND_POST_DOWNLOAD_CONF_FILES
+
+define BIND_POST_INSTALL_CONFIG_FILES
+	$(INSTALL) -m 0755 -d $(TARGET_DIR)/etc/bind/{,master}
+	$(INSTALL) -m 0755 -d $(TARGET_DIR)/var/named/{,slave,dynamic}
+	$(INSTALL) -m 0644 -D $(@D)/BR2/empty.db $(TARGET_DIR)/etc/bind/master
+	$(INSTALL) -m 0644 -D $(@D)/BR2/named.root $(TARGET_DIR)/etc/bind/master
+	$(INSTALL) -m 0644 -D $(@D)/BR2/localhost-forward.db $(TARGET_DIR)/etc/bind/master
+	$(INSTALL) -m 0644 -D $(@D)/BR2/named.conf.in $(TARGET_DIR)/etc/bind/
+	$(INSTALL) -m 0644 -D $(@D)/BR2/named.conf $(TARGET_DIR)/etc/bind/
+endef
+BIND_POST_INSTALL_TARGET_HOOKS += BIND_POST_INSTALL_CONFIG_FILES
+
+define BIND_PERMISSIONS
+	/var/named d 0755 named named - - - - -
+	/var/named/dynamic d 0755 named named - - - - -
+	/var/named/slave d 0755 named named - - - - -
+endef
+
 define BIND_USERS
 	named -1 named -1 * /etc/bind - - BIND daemon
 endef
Signature · 1 line
2.14.3
#2 lore raw

PATCH 2/3 bind config files

Hello Christopher,

Commit title should be something like:

bind: add sample config files

Quoted 3 lines · Christopher McCrory

Snag config files from FreeBSD ports and use those for a working DNS system

( Not sure what to add for Licensing )

Does licensing on config files really matters ?

Any reason to chose those FreeBSD config files ? The bind tarball doesn't contain sample files ?

Note: I'm making comments about the implementation below, but I don't know if we should use those FreeBSD files, bundle some sample files in Buildroot, or use other example files shipped with bind.

package/bind/bind.mk line 12

Quoted 6 lines

BIND_VERSION = 9.11.2-P1
BIND_SITE = http://ftp.isc.org/isc/bind9/$(BIND_VERSION)

package/bind/bind.mk +4 -0
+BIND_EXTRA_DOWNLOADS = https://svn.freebsd.org/ports/head/dns/bind912/files/empty.db
+BIND_EXTRA_DOWNLOADS += https://svn.freebsd.org/ports/head/dns/bind912/files/named.root https://svn.freebsd.org/ports/head/dns/bind912/files/localhost-forward.db https://svn.freebsd.org/ports/head/dns/bind912/files/named.conf.in
+BIND_EXTRA_DOWNLOADS += https://svn.freebsd.org/ports/head/dns/bind912/files/localhost-forward.db https://svn.freebsd.org/ports/head/dns/bind912/files/named.conf.in
+BIND_EXTRA_DOWNLOADS += https://svn.freebsd.org/ports/head/dns/bind912/files/named.conf.in

Why do you have named.conf.in three times ? and localhost-forward.db two times ? Am I missing something here ?

Also, this is pretty verbose. What about:

BIND_EXTRA_CONFIG_FILES = \
	empty.db named.root localhost-forward.db \
	named.conf.in
BIND_EXTRA_DOWNLOADS = \
	$(addprefix https://svn.freebsd.org/ports/head/dns/bind912/files/,$(BIND_EXTRA_CONFIG_FILES))

package/bind/bind.mk ifeq ($(BR2_PACKAGE_BIND_TOOLS),) · line 125

Quoted 13 lines
 # bind does not support parallel builds.
 BIND_MAKE = $(MAKE1)
 BIND_INSTALL_STAGING = YES
package/bind/bind.mk +6 -0
@@ -113,6 +117,34 @@ ifeq ($(BR2_PACKAGE_BIND_TOOLS),)
 BIND_POST_INSTALL_TARGET_HOOKS += BIND_TARGET_REMOVE_TOOLS
 endif
 
+define BIND_POST_DOWNLOAD_CONF_FILES
+	$(INSTALL) -m 0755 -d $(@D)/BR2
+	$(INSTALL) -m 0644 -D $(DL_DIR)/empty.db $(@D)/BR2/
+	$(INSTALL) -m 0644 -D $(DL_DIR)/named.root $(@D)/BR2/
+	$(INSTALL) -m 0644 -D $(DL_DIR)/localhost-forward.db $(@D)/BR2/
+	$(INSTALL) -m 0644 -D $(DL_DIR)/named.conf.in $(@D)/BR2/

You could replace those 5 lines by:

	$(foreach f,$(BIND_EXTRA_CONFIG_FILES), \
		$(INSTALL) -D -m0644 $(DL_DIR)/$(f) $(@D)/BR2/$(f)
	)

package/bind/bind.mk ifeq ($(BR2_PACKAGE_BIND_TOOLS),) · line 129

Quoted 4 lines
package/bind/bind.mk +4 -0
+	sed -f $(BIND_PKGDIR)/configs.sed \
+	    $(@D)/BR2/named.conf.in > $(@D)/BR2/named.conf
+endef
+BIND_POST_DOWNLOAD_HOOKS += BIND_POST_DOWNLOAD_CONF_FILES

This as a post download hook looks wrong, the package hasn't been extracted yet. Doing this as a post-extract hook or post-patch hook looks more appropriate.

package/bind/bind.mk ifeq ($(BR2_PACKAGE_BIND_TOOLS),) · line 132

Quoted 2 lines
package/bind/bind.mk +2 -0
+define BIND_POST_INSTALL_CONFIG_FILES
+	$(INSTALL) -m 0755 -d $(TARGET_DIR)/etc/bind/{,master}

This is not needed if you use a full destination path when installing files below.

package/bind/bind.mk ifeq ($(BR2_PACKAGE_BIND_TOOLS),) · line 133

Quoted 1 line
package/bind/bind.mk +1 -0
+	$(INSTALL) -m 0755 -d $(TARGET_DIR)/var/named/{,slave,dynamic}

The {,slave,dynamic} could be just {slave,dynamic}: install -d creates subfolders as needed.

package/bind/bind.mk ifeq ($(BR2_PACKAGE_BIND_TOOLS),) · line 137

Quoted 4 lines
package/bind/bind.mk +4 -0
+	$(INSTALL) -m 0644 -D $(@D)/BR2/empty.db $(TARGET_DIR)/etc/bind/master
+	$(INSTALL) -m 0644 -D $(@D)/BR2/named.root $(TARGET_DIR)/etc/bind/master
+	$(INSTALL) -m 0644 -D $(@D)/BR2/localhost-forward.db $(TARGET_DIR)/etc/bind/master
+	$(INSTALL) -m 0644 -D $(@D)/BR2/named.conf.in $(TARGET_DIR)/etc/bind/

Do you need to install the .in file ?

package/bind/bind.mk ifeq ($(BR2_PACKAGE_BIND_TOOLS),) · line 138

Quoted 1 line
package/bind/bind.mk +1 -0
+	$(INSTALL) -m 0644 -D $(@D)/BR2/named.conf $(TARGET_DIR)/etc/bind/

Use a full destination path on all those installation commands.

package/bind/bind.mk ifeq ($(BR2_PACKAGE_BIND_TOOLS),) · line 150

Quoted 12 lines
package/bind/bind.mk +9 -0
+endef
+BIND_POST_INSTALL_TARGET_HOOKS += BIND_POST_INSTALL_CONFIG_FILES
+
+define BIND_PERMISSIONS
+	/var/named d 0755 named named - - - - -
+	/var/named/dynamic d 0755 named named - - - - -
+	/var/named/slave d 0755 named named - - - - -
+endef
+
 define BIND_USERS
 	named -1 named -1 * /etc/bind - - BIND daemon
 endef

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
#3 lore raw

PATCH 3/3 bind sed

In reply to Christopher McCrory

sed script to alter directory locations

---
 package/bind/configs.sed | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 package/bind/configs.sed
package/bind/configs.sed new file +9 -0
new file mode 100644
index 0000000000..809da8e10c
@@ -0,0 +1,9 @@
+s#/var/run/named/pid#/var/run/named.pid#
+s#/var/dump/named_dump.db#/var/named/named_dump.db#
+s#/var/stats/named.stats#/var/named/named.stats#
+s#%%ETCDIR%%/master#/etc/bind/master#
+s#%%ETCDIR%%/named.root#/etc/bind/master/named.root#
+s#%%ETCDIR%%/working#/var/named#
+s#%%ETCDIR%%/slave#/var/named/slave#
+s#%%ETCDIR%%/dynamic#/var/named/dynamic#
+
Signature · 1 line
2.14.3
#4 lore raw

PATCH 3/3 bind sed

Hello,

Quoted 3 lines · Christopher McCrory

sed script to alter directory locations

This cannot be separated from PATCH 2/3, because PATCH 2/3 uses this sed script, so PATCH 2/3 and 3/3 should be merged together.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
#5 lore raw

PATCH 1/3 bind BIND_PKGDIR

In reply to Christopher McCrory

Hello,

Quoted 6 lines · Christopher McCrory

use BIND_PKGDIR instead of package/bind

---
 package/bind/bind.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

I've applied to next, after changing the commit title to follow the convention:

<package>: <description>

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com