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

Christopher Larson
2015-11-17T13:55:54Z

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

On Tue, Nov 17, 2015 at 12:25 AM, Andreas Müller <
schnitzeltony@googlemail.com> wrote:

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

As far as I know, nsswitch.conf is flagged as a conffile (actually in
master everything in /etc/ will be), so once it's modified externally (in
this case, by the systemd recipe), the original package which installed the
file won't blindliy overwrite those changes.
--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

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