aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2015-11-04 13:57:45 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-11 23:23:15 +0000
commit1fb3e1a4bbf36a5b46d126a478d42d0b94f43182 (patch)
tree04fad28cb124ccc91f4c6947b2eaa13a4213dba5
parent0afb74e23ee9a1fcdd334865a5f7280526785a4c (diff)
downloadopenembedded-core-contrib-1fb3e1a4bbf36a5b46d126a478d42d0b94f43182.tar.gz
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 <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta/recipes-core/systemd/systemd_228.bb12
1 files changed, 12 insertions, 0 deletions
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*\<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 \