All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libnss-mdns: fix postinst and postrm
@ 2018-05-16 16:54 Dan McGregor
  0 siblings, 0 replies; only message in thread
From: Dan McGregor @ 2018-05-16 16:54 UTC (permalink / raw)
  To: openembedded-core

From: Dan McGregor <dan.mcgregor@usask.ca>

Don't blindly add mdns_minimal, instead check for existing
mdns_minimal instances. Fixes continuously appending mdns settings
to nssswitch.conf when upgrading.

Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
---
 .../libnss-mdns/libnss-mdns_0.10.bb               | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb b/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
index 8d2feec7698..5be5e4fa323 100644
--- a/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
+++ b/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
@@ -28,13 +28,16 @@ DEBIANNAME_${PN} = "libnss-mdns"
 RDEPENDS_${PN} = "avahi-daemon"
 
 pkg_postinst_${PN} () {
-	sed -e '/^hosts:/s/\s*\<mdns\>//' \
-		-e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 mdns4_minimal [NOTFOUND=return]\3\4 mdns\5/' \
-		-i $D${sysconfdir}/nsswitch.conf
+	sed '
+		/^hosts:/ !b
+		/\<mdns\(4\|6\)\?\(_minimal\)\?\>/ b
+		s/\([[:blank:]]\+\)dns\>/\1mdns4_minimal [NOTFOUND=return] dns/g
+		' -i $D${sysconfdir}/nsswitch.conf
 }
 
 pkg_prerm_${PN} () {
-	sed -e '/^hosts:/s/\s*\<mdns\>//' \
-		-e '/^hosts:/s/\s*mdns4_minimal\s\+\[NOTFOUND=return\]//' \
-		-i $D${sysconfdir}/nsswitch.conf
+	sed '
+		/^hosts:/ !b
+		s/[[:blank:]]\+mdns\(4\|6\)\?\(_minimal\( \[NOTFOUND=return\]\)\?\)\?//g
+		' -i $D${sysconfdir}/nsswitch.conf
 }
-- 
2.18.0-dev



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-16 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 16:54 [PATCH] libnss-mdns: fix postinst and postrm Dan McGregor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.