[OE-core] [PATCH 1/2] systemd 216: add postinsts for hostname and machine nss modules

Koen Kooi koen at dominion.thruhere.net
Sat Sep 27 07:22:24 UTC 2014


The external recipe has postinsts so to make this a true replacement add
them here as well.

Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>
---
 meta/recipes-core/systemd/systemd_216.bb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/meta/recipes-core/systemd/systemd_216.bb b/meta/recipes-core/systemd/systemd_216.bb
index 331da99..3e572e8 100644
--- a/meta/recipes-core/systemd/systemd_216.bb
+++ b/meta/recipes-core/systemd/systemd_216.bb
@@ -369,6 +369,28 @@ pkg_prerm_udev-hwdb () {
 	rm -f ${sysconfdir}/udev/hwdb.bin
 }
 
+# Do not activate libnss-resolve by default, that needs more thought
+
+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
+
+	sed -e '/^hosts:/s/\s*\<mymachine\>//' \
+		-e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 mymachine \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
+
+	sed -e '/^hosts:/s/\s*\<mymachine\>//' \
+		-e '/^hosts:/s/\s*mymachine//' \
+		-i $D${sysconfdir}/nsswitch.conf
+}
+
 # As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
 # that we don't build both udev and systemd in world builds.
 python () {
-- 
1.9.0




More information about the Openembedded-core mailing list