Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/3] bind BIND_PKGDIR
@ 2018-02-27 12:39 Christopher McCrory
  2018-02-27 12:39 ` [Buildroot] [PATCH 2/3] bind config files Christopher McCrory
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christopher McCrory @ 2018-02-27 12:39 UTC (permalink / raw)
  To: buildroot

use BIND_PKGDIR instead of package/bind

Signed-off-by: Christopher McCrory <chrismcc@gmail.com>
---
 package/bind/bind.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/bind/bind.mk b/package/bind/bind.mk
index bec902079c..392ef321c2 100644
--- a/package/bind/bind.mk
+++ b/package/bind/bind.mk
@@ -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
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/3] bind config files
  2018-02-27 12:39 [Buildroot] [PATCH 1/3] bind BIND_PKGDIR Christopher McCrory
@ 2018-02-27 12:39 ` Christopher McCrory
  2018-02-27 21:32   ` Thomas Petazzoni
  2018-02-27 12:39 ` [Buildroot] [PATCH 3/3] bind sed Christopher McCrory
  2018-02-27 21:23 ` [Buildroot] [PATCH 1/3] bind BIND_PKGDIR Thomas Petazzoni
  2 siblings, 1 reply; 6+ messages in thread
From: Christopher McCrory @ 2018-02-27 12:39 UTC (permalink / raw)
  To: buildroot

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

( Not sure what to add for Licensing )

Signed-off-by: Christopher McCrory <chrismcc@gmail.com>
---
 package/bind/bind.hash |  4 ++++
 package/bind/bind.mk   | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/package/bind/bind.hash b/package/bind/bind.hash
index 199db704fe..c98442423a 100644
--- a/package/bind/bind.hash
+++ b/package/bind/bind.hash
@@ -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
diff --git a/package/bind/bind.mk b/package/bind/bind.mk
index 392ef321c2..886cf5d66e 100644
--- a/package/bind/bind.mk
+++ b/package/bind/bind.mk
@@ -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
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 3/3] bind sed
  2018-02-27 12:39 [Buildroot] [PATCH 1/3] bind BIND_PKGDIR Christopher McCrory
  2018-02-27 12:39 ` [Buildroot] [PATCH 2/3] bind config files Christopher McCrory
@ 2018-02-27 12:39 ` Christopher McCrory
  2018-02-27 21:25   ` Thomas Petazzoni
  2018-02-27 21:23 ` [Buildroot] [PATCH 1/3] bind BIND_PKGDIR Thomas Petazzoni
  2 siblings, 1 reply; 6+ messages in thread
From: Christopher McCrory @ 2018-02-27 12:39 UTC (permalink / raw)
  To: buildroot

    sed script to alter directory locations

Signed-off-by: Christopher McCrory <chrismcc@gmail.com>
---
 package/bind/configs.sed | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 package/bind/configs.sed

diff --git a/package/bind/configs.sed b/package/bind/configs.sed
new file mode 100644
index 0000000000..809da8e10c
--- /dev/null
+++ b/package/bind/configs.sed
@@ -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#
+
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/3] bind BIND_PKGDIR
  2018-02-27 12:39 [Buildroot] [PATCH 1/3] bind BIND_PKGDIR Christopher McCrory
  2018-02-27 12:39 ` [Buildroot] [PATCH 2/3] bind config files Christopher McCrory
  2018-02-27 12:39 ` [Buildroot] [PATCH 3/3] bind sed Christopher McCrory
@ 2018-02-27 21:23 ` Thomas Petazzoni
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2018-02-27 21:23 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 27 Feb 2018 04:39:22 -0800, Christopher McCrory wrote:
> use BIND_PKGDIR instead of package/bind
> 
> Signed-off-by: Christopher McCrory <chrismcc@gmail.com>
> ---
>  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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 3/3] bind sed
  2018-02-27 12:39 ` [Buildroot] [PATCH 3/3] bind sed Christopher McCrory
@ 2018-02-27 21:25   ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2018-02-27 21:25 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 27 Feb 2018 04:39:24 -0800, Christopher McCrory wrote:
>     sed script to alter directory locations
> 
> Signed-off-by: Christopher McCrory <chrismcc@gmail.com>

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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/3] bind config files
  2018-02-27 12:39 ` [Buildroot] [PATCH 2/3] bind config files Christopher McCrory
@ 2018-02-27 21:32   ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2018-02-27 21:32 UTC (permalink / raw)
  To: buildroot

Hello Christopher,

Commit title should be something like:

	bind: add sample config files

On Tue, 27 Feb 2018 04:39:23 -0800, Christopher McCrory wrote:
> 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.

>  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

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))

>  # 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/

You could replace those 5 lines by:

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

> +	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.

> +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.

> +	$(INSTALL) -m 0755 -d $(TARGET_DIR)/var/named/{,slave,dynamic}

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

> +	$(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 ?

> +	$(INSTALL) -m 0644 -D $(@D)/BR2/named.conf $(TARGET_DIR)/etc/bind/

Use a full destination path on all those installation commands.

> +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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-02-27 21:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-27 12:39 [Buildroot] [PATCH 1/3] bind BIND_PKGDIR Christopher McCrory
2018-02-27 12:39 ` [Buildroot] [PATCH 2/3] bind config files Christopher McCrory
2018-02-27 21:32   ` Thomas Petazzoni
2018-02-27 12:39 ` [Buildroot] [PATCH 3/3] bind sed Christopher McCrory
2018-02-27 21:25   ` Thomas Petazzoni
2018-02-27 21:23 ` [Buildroot] [PATCH 1/3] bind BIND_PKGDIR Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox