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

Andreas Müller
2015-11-17T07:25:59Z

On Fri, Nov 13, 2015 at 12:41 AM, 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.
>
> 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
>
> --
This seems to solve my xfce4-terminal delay - thanks. I have a
questions regarding this patch: As soon as basefiles are updated
resolving stops working - right? So why not handle at basefiles based
on systemd distro setting?

Andreas