Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/3] bind config files
Date: Tue, 27 Feb 2018 22:32:39 +0100	[thread overview]
Message-ID: <20180227223239.191a2c66@windsurf.lan> (raw)
In-Reply-To: <20180227123924.20725-2-chrismcc@gmail.com>

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

  reply	other threads:[~2018-02-27 21:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180227223239.191a2c66@windsurf.lan \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox