From: Christopher Larson Date: Wed, 4 Nov 2015 20:57:45 +0000 (-0700) Subject: systemd: add myhostname to nsswitch.conf X-Git-Tag: 2016-4~1664 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=1fb3e1a4bbf36a5b46d126a478d42d0b94f43182;p=openembedded-core.git systemd: add myhostname to nsswitch.conf 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 Signed-off-by: Ross Burton --- diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 19b7b4218d..df8813ac42 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -404,6 +404,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*\//' \ + -e 's/\(^hosts:.*\)\(\\)\(.*\)\(\\)\(.*\)/\1\2 myhostname \3\4\5/' \ + -i $D${sysconfdir}/nsswitch.conf +} + +pkg_prerm_${PN} () { + sed -e '/^hosts:/s/\s*\//' \ + -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 \