From 1fb3e1a4bbf36a5b46d126a478d42d0b94f43182 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Wed, 4 Nov 2015 13:57:45 -0700 Subject: 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 --- meta/recipes-core/systemd/systemd_228.bb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'meta') 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 \ -- cgit v1.2.3