Re: [PATCH 3/4] systemd: add myhostname to nsswitch.conf

Dan McGregor
2015-11-18T03:49:01Z

[-- Attachment #1: Type: text/plain, Size: 1990 bytes --]

On 12 Nov 2015 5:41 p.m., "Christopher Larson" <kergoth@gmail.com> wrote:
>
> From: Christopher Larson <chris_larson@mentor.com>
>
> We don't need nss-myhostname on systemd systems, because systemd already
> provides myhostname, but we weren't configuring nsswitch to use it. Being
able
> to resolve the hostname is useful for a number of different applications,
so
> enable it using the same postinst/prerm bits which are in nss-myhostname.

I have this and a similar change for resolved in an append at work. Would
others be interested in that too?

>
> Signed-off-by: Christopher Larson <chris_larson@mentor.com>
> ---
> meta/recipes-core/systemd/systemd_225.bb | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/meta/recipes-core/systemd/systemd_225.bb
b/meta/recipes-core/systemd/systemd_225.bb
> index 18c2448..20515f5 100644
> --- a/meta/recipes-core/systemd/systemd_225.bb
> +++ b/meta/recipes-core/systemd/systemd_225.bb
> @@ -397,6 +397,18 @@ ALTERNATIVE_TARGET[runlevel] =
"${base_bindir}/systemctl"
> ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
> ALTERNATIVE_PRIORITY[runlevel] ?= "300"
>
> +pkg_postinst_${PN} () {
> + sed -e '/^hosts:/s/\s*\<myhostname\>//' \
> + -e
's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname
\3\4\5/' \
> + -i $D${sysconfdir}/nsswitch.conf
> +}
> +
> +pkg_prerm_${PN} () {
> + sed -e '/^hosts:/s/\s*\<myhostname\>//' \
> + -e '/^hosts:/s/\s*myhostname//' \
> + -i $D${sysconfdir}/nsswitch.conf
> +}
> +
> pkg_postinst_udev-hwdb () {
> if test -n "$D"; then
> ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')}
hwdb --update \
> --
> 2.2.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

[-- Attachment #2: Type: text/html, Size: 3004 bytes --]