All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/nss-myhostname: Add package
@ 2018-05-24 13:25 Vincent Prince
  2018-05-25 17:02 ` Peter Korsgaard
  2018-05-27 14:15 ` Arnout Vandecappelle
  0 siblings, 2 replies; 5+ messages in thread
From: Vincent Prince @ 2018-05-24 13:25 UTC (permalink / raw)
  To: buildroot

Also fix nss-mdns hook to work with nss-myhostname

Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com>
---
 package/Config.in                          |  1 +
 package/nss-mdns/nss-mdns.mk               |  2 +-
 package/nss-myhostname/Config.in           |  7 +++++++
 package/nss-myhostname/nss-myhostname.hash |  2 ++
 package/nss-myhostname/nss-myhostname.mk   | 20 ++++++++++++++++++++
 5 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 package/nss-myhostname/Config.in
 create mode 100644 package/nss-myhostname/nss-myhostname.hash
 create mode 100644 package/nss-myhostname/nss-myhostname.mk

diff --git a/package/Config.in b/package/Config.in
index 3cf53ed..3ac0d63 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1426,6 +1426,7 @@ menu "Networking"
 	source "package/neon/Config.in"
 	source "package/norm/Config.in"
 	source "package/nss-mdns/Config.in"
+	source "package/nss-myhostname/Config.in"
 	source "package/nss-pam-ldapd/Config.in"
 	source "package/omniorb/Config.in"
 	source "package/openldap/Config.in"
diff --git a/package/nss-mdns/nss-mdns.mk b/package/nss-mdns/nss-mdns.mk
index 407b942..ee666c7 100644
--- a/package/nss-mdns/nss-mdns.mk
+++ b/package/nss-mdns/nss-mdns.mk
@@ -17,6 +17,6 @@ define NSS_MDNS_INSTALL_CONFIG
 		$(TARGET_DIR)/etc/nsswitch.conf
 endef
 
-NSS_MDNS_POST_INSTALL_TARGET_HOOKS += NSS_MDNS_INSTALL_CONFIG
+NSS_MDNS_TARGET_FINALIZE_HOOKS += NSS_MDNS_INSTALL_CONFIG
 
 $(eval $(autotools-package))
diff --git a/package/nss-myhostname/Config.in b/package/nss-myhostname/Config.in
new file mode 100644
index 0000000..968b911
--- /dev/null
+++ b/package/nss-myhostname/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_NSS_MYHOSTNAME
+	bool "nss-myhostname"
+    depends on !BR2_PACKAGE_SYSTEMD_MYHOSTNAME
+	help
+		Name Service Switch module for resolving the local hostname
+
+		http://0pointer.de/lennart/projects/nss-myhostname
diff --git a/package/nss-myhostname/nss-myhostname.hash b/package/nss-myhostname/nss-myhostname.hash
new file mode 100644
index 0000000..9e33bec
--- /dev/null
+++ b/package/nss-myhostname/nss-myhostname.hash
@@ -0,0 +1,2 @@
+# locally computed
+sha256  2ba744ea8d578d1c57c85884e94a3042ee17843a5294434d3a7f6c4d67e7caf2 nss-myhostname-0.3.tar.gz
diff --git a/package/nss-myhostname/nss-myhostname.mk b/package/nss-myhostname/nss-myhostname.mk
new file mode 100644
index 0000000..153e1d0
--- /dev/null
+++ b/package/nss-myhostname/nss-myhostname.mk
@@ -0,0 +1,20 @@
+################################################################################
+#
+## nss-myhostname
+#
+#################################################################################
+
+NSS_MYHOSTNAME_VERSION = 0.3
+NSS_MYHOSTNAME_SITE = http://0pointer.de/lennart/projects/nss-myhostname
+NSS_MYHOSTNAME_LICENSE = LGPL-2.1
+NSS_MYHOSTNAME_LICENSE_FILES = LICENSE
+NSS_MYHOSTNAME_AUTORECONF = YES
+
+define MYHOSTNAME_SET_NSSWITCH
+    $(SED) '/^hosts:/s/\s*\<myhostname\>//' \
+		-e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' -r $(TARGET_DIR)/etc/nsswitch.conf
+endef
+
+NSS_MYHOSTNAME_TARGET_FINALIZE_HOOKS += MYHOSTNAME_SET_NSSWITCH
+
+$(eval $(autotools-package))
-- 
2.7.4

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

* [Buildroot] [PATCH] package/nss-myhostname: Add package
  2018-05-24 13:25 [Buildroot] [PATCH] package/nss-myhostname: Add package Vincent Prince
@ 2018-05-25 17:02 ` Peter Korsgaard
  2018-05-25 18:24   ` Vincent Prince
  2018-05-27 14:15 ` Arnout Vandecappelle
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2018-05-25 17:02 UTC (permalink / raw)
  To: buildroot

>>>>> "Vincent" == Vincent Prince <vincent.prince.fr@gmail.com> writes:

 > Also fix nss-mdns hook to work with nss-myhostname

 > Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com>

Thanks for you contribution! Can you please split this in two patches,
E.G. one to change nss-mdns and one to add nss-myhostname?

Also please add an entries to the DEVELOPERS file and run
./utils/check-package on your new files, I see a number of strange
indentation issues.

While you are at it, please also add a sha256 hash for the license file.

 > +
 > +NSS_MYHOSTNAME_VERSION = 0.3
 > +NSS_MYHOSTNAME_SITE = http://0pointer.de/lennart/projects/nss-myhostname
 > +NSS_MYHOSTNAME_LICENSE = LGPL-2.1
 > +NSS_MYHOSTNAME_LICENSE_FILES = LICENSE
 > +NSS_MYHOSTNAME_AUTORECONF = YES

Why? Does the tarball not contain a configure script?

> +
 > +define MYHOSTNAME_SET_NSSWITCH
 > +    $(SED) '/^hosts:/s/\s*\<myhostname\>//' \
 > +		-e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' -r $(TARGET_DIR)/etc/nsswitch.conf
 > +endef

Doesn't nss-myhostname just need to go to the end of the file?
E.G. something like:

     grep -qw myhostname $(TARGET_DIR)/etc/nsswwitch.conf || \
          $(SED) '/\(^hosts:.*\)/\1 myhostname/' $(TARGET_DIR)/etc/nsswitch.conf

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH] package/nss-myhostname: Add package
  2018-05-25 17:02 ` Peter Korsgaard
@ 2018-05-25 18:24   ` Vincent Prince
  2018-05-25 21:06     ` Peter Korsgaard
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Prince @ 2018-05-25 18:24 UTC (permalink / raw)
  To: buildroot

Hi Peter,

I'll send V2 on monday with:
  - patch split
  - DEVELOPERS
  - fix indentation
  - sha256 sig
  - AUTORECONF removed

nsswitch.conf resolve hosts in entries order, so it is important that it
resides after files and before the other entries.
Sed command comes from Yocto recipe
https://git.yoctoproject.org/cgit.cgi/poky/plain/meta/recipes-support/nss-myhostname/nss-myhostname_0.3.bb

Best regards,
Vincent



2018-05-25 19:02 GMT+02:00 Peter Korsgaard <peter@korsgaard.com>:

> >>>>> "Vincent" == Vincent Prince <vincent.prince.fr@gmail.com> writes:
>
>  > Also fix nss-mdns hook to work with nss-myhostname
>
>  > Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com>
>
> Thanks for you contribution! Can you please split this in two patches,
> E.G. one to change nss-mdns and one to add nss-myhostname?
>
> Also please add an entries to the DEVELOPERS file and run
> ./utils/check-package on your new files, I see a number of strange
> indentation issues.
>
> While you are at it, please also add a sha256 hash for the license file.
>
>  > +
>  > +NSS_MYHOSTNAME_VERSION = 0.3
>  > +NSS_MYHOSTNAME_SITE = http://0pointer.de/lennart/
> projects/nss-myhostname
>  > +NSS_MYHOSTNAME_LICENSE = LGPL-2.1
>  > +NSS_MYHOSTNAME_LICENSE_FILES = LICENSE
>  > +NSS_MYHOSTNAME_AUTORECONF = YES
>
> Why? Does the tarball not contain a configure script?
>
> > +
>  > +define MYHOSTNAME_SET_NSSWITCH
>  > +    $(SED) '/^hosts:/s/\s*\<myhostname\>//' \
>  > +            -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2
> myhostname \3\4\5/' -r $(TARGET_DIR)/etc/nsswitch.conf
>  > +endef
>
> Doesn't nss-myhostname just need to go to the end of the file?
> E.G. something like:
>
>      grep -qw myhostname $(TARGET_DIR)/etc/nsswwitch.conf || \
>           $(SED) '/\(^hosts:.*\)/\1 myhostname/'
> $(TARGET_DIR)/etc/nsswitch.conf
>
> --
> Bye, Peter Korsgaard
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180525/c8c9a336/attachment.html>

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

* [Buildroot] [PATCH] package/nss-myhostname: Add package
  2018-05-25 18:24   ` Vincent Prince
@ 2018-05-25 21:06     ` Peter Korsgaard
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2018-05-25 21:06 UTC (permalink / raw)
  To: buildroot

>>>>> "Vincent" == Vincent Prince <vincent.prince.fr@gmail.com> writes:

 > Hi Peter,
 > I'll send V2 on monday with:
 >   - patch split
 >   - DEVELOPERS
 >   - fix indentation
 >   - sha256 sig
 >   - AUTORECONF removed

Great, thanks.

 > nsswitch.conf resolve hosts in entries order, so it is important that it
 > resides after files and before the other entries.

Before the others?

The example on the website and note seems to show it at the very end,
E.G. as a fallback:

http://0pointer.de/lennart/projects/nss-myhostname/

It is recommended to put myhostname last in the nsswitch.conf line to
make sure that this mapping is only used as fallback, and any DNS or
/etc/hosts based mapping takes precedence.

 > Sed command comes from Yocto recipe
 > https://git.yoctoproject.org/cgit.cgi/poky/plain/meta/recipes-support/nss-myhostname/nss-myhostname_0.3.bb

Ok, please mention that in the commit message - Thanks.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH] package/nss-myhostname: Add package
  2018-05-24 13:25 [Buildroot] [PATCH] package/nss-myhostname: Add package Vincent Prince
  2018-05-25 17:02 ` Peter Korsgaard
@ 2018-05-27 14:15 ` Arnout Vandecappelle
  1 sibling, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2018-05-27 14:15 UTC (permalink / raw)
  To: buildroot

 Hi Vincent,

 In addition to Peter's comments...

On 24-05-18 15:25, Vincent Prince wrote:
> Also fix nss-mdns hook to work with nss-myhostname
> 
> Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com>
[snip]
> diff --git a/package/nss-myhostname/Config.in b/package/nss-myhostname/Config.in
> new file mode 100644
> index 0000000..968b911
> --- /dev/null
> +++ b/package/nss-myhostname/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_NSS_MYHOSTNAME
> +	bool "nss-myhostname"
> +    depends on !BR2_PACKAGE_SYSTEMD_MYHOSTNAME

 My guess is that this will needs nsswitch, right? So I guess it will need

	depends on BR2_TOOLCHAIN_USES_GLIBC

like nss-mdns, and also the "nss-myhostname needs a glibc toolchain" comment.

> +	help
> +		Name Service Switch module for resolving the local hostname
> +
> +		http://0pointer.de/lennart/projects/nss-myhostname
> diff --git a/package/nss-myhostname/nss-myhostname.hash b/package/nss-myhostname/nss-myhostname.hash
> new file mode 100644
> index 0000000..9e33bec
> --- /dev/null
> +++ b/package/nss-myhostname/nss-myhostname.hash
> @@ -0,0 +1,2 @@
> +# locally computed
> +sha256  2ba744ea8d578d1c57c85884e94a3042ee17843a5294434d3a7f6c4d67e7caf2 nss-myhostname-0.3.tar.gz
> diff --git a/package/nss-myhostname/nss-myhostname.mk b/package/nss-myhostname/nss-myhostname.mk
> new file mode 100644
> index 0000000..153e1d0
> --- /dev/null
> +++ b/package/nss-myhostname/nss-myhostname.mk
> @@ -0,0 +1,20 @@
> +################################################################################
> +#
> +## nss-myhostname
> +#
> +#################################################################################
> +
> +NSS_MYHOSTNAME_VERSION = 0.3
> +NSS_MYHOSTNAME_SITE = http://0pointer.de/lennart/projects/nss-myhostname
> +NSS_MYHOSTNAME_LICENSE = LGPL-2.1

 It has the "or later" clause, so LGPL-2.1+

> +NSS_MYHOSTNAME_LICENSE_FILES = LICENSE
> +NSS_MYHOSTNAME_AUTORECONF = YES
> +
> +define MYHOSTNAME_SET_NSSWITCH
> +    $(SED) '/^hosts:/s/\s*\<myhostname\>//' \

 If you use -e, use it everywhere for symmetry.

> +		-e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' -r $(TARGET_DIR)/etc/nsswitch.conf

 -r is not what we usually use, we use -E. However, the regex looks wrong to me
with -E, it should then be an unquoted (, no?

 Also, if the patterns contain /, use a different delimiter, we usually use ,
So something like:

 	$(SED) -E -e '/^hosts:/s/\s*\<myhostname\>//' \
 		-e 's,(^hosts:.*)(\<files\>)(.*)(\<dns\>),\1\2 myhostname \3\4,' \
 		$(TARGET_DIR)/etc/nsswitch.conf

 Regards,
 Arnout

> +endef
> +
> +NSS_MYHOSTNAME_TARGET_FINALIZE_HOOKS += MYHOSTNAME_SET_NSSWITCH
> +
> +$(eval $(autotools-package))
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

end of thread, other threads:[~2018-05-27 14:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 13:25 [Buildroot] [PATCH] package/nss-myhostname: Add package Vincent Prince
2018-05-25 17:02 ` Peter Korsgaard
2018-05-25 18:24   ` Vincent Prince
2018-05-25 21:06     ` Peter Korsgaard
2018-05-27 14:15 ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.