Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] libnss-mdns: fix postinst scripts
@ 2012-05-21 14:53 Andreas Oberritter
  2012-05-24 17:52 ` Saul Wold
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Oberritter @ 2012-05-21 14:53 UTC (permalink / raw)
  To: openembedded-core

* On upgrade, postinst ocassionally returned 1, so use a
  conditional instead of &&.
* Use sed patterns in order to make it work more generally.

Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
---
 .../libnss-mdns/libnss-mdns_0.10.bb                |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 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 8770714..a1f2f9a 100644
--- a/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
+++ b/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1"
 
 DEPENDS = "avahi"
 RDEPENDS_${PN} = "avahi-daemon"
-PR = "r4"
+PR = "r5"
 
 SRC_URI = "http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-${PV}.tar.gz"
 
@@ -23,15 +23,14 @@ DEBIANNAME_${PN} = "libnss-mdns"
 
 EXTRA_OECONF = "--libdir=${base_libdir} --disable-lynx --enable-avahi"
 
-# TODO: pattern based configuration update
 pkg_postinst_${PN} () {
-	cat $D/etc/nsswitch.conf | grep "hosts:\s*files dns$" > /dev/null && {
-		sed -i 's/hosts:\s*files dns/& mdns4/' $D/etc/nsswitch.conf
-	}
+if ! grep -q '^hosts:.*\<mdns4\>' $D/etc/nsswitch.conf; then
+	sed -e 's/^hosts:.*/& mdns4/' -i $D/etc/nsswitch.conf
+fi
 }
 
 pkg_prerm_${PN} () {
-	cat /etc/nsswitch.conf | grep "hosts:\s*files dns mdns4$" > /dev/null && {
-		sed -i 's/\(hosts:\s*files dns\) mdns4*/\1/' /etc/nsswitch.conf
-	}
+if grep -q '^hosts:.*\<mdns4\>' /etc/nsswitch.conf; then
+	sed -e '/^hosts:/s/\s\<mdns4\>//' -i /etc/nsswitch.conf
+fi
 }
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libnss-mdns: fix postinst scripts
  2012-05-21 14:53 [PATCH] libnss-mdns: fix postinst scripts Andreas Oberritter
@ 2012-05-24 17:52 ` Saul Wold
  0 siblings, 0 replies; 2+ messages in thread
From: Saul Wold @ 2012-05-24 17:52 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On 05/21/2012 07:53 AM, Andreas Oberritter wrote:
> * On upgrade, postinst ocassionally returned 1, so use a
>    conditional instead of&&.
> * Use sed patterns in order to make it work more generally.
>
> Signed-off-by: Andreas Oberritter<obi@opendreambox.org>
> ---
>   .../libnss-mdns/libnss-mdns_0.10.bb                |   15 +++++++--------
>   1 file changed, 7 insertions(+), 8 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 8770714..a1f2f9a 100644
> --- a/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
> +++ b/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
> @@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1"
>
>   DEPENDS = "avahi"
>   RDEPENDS_${PN} = "avahi-daemon"
> -PR = "r4"
> +PR = "r5"
>
>   SRC_URI = "http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-${PV}.tar.gz"
>
> @@ -23,15 +23,14 @@ DEBIANNAME_${PN} = "libnss-mdns"
>
>   EXTRA_OECONF = "--libdir=${base_libdir} --disable-lynx --enable-avahi"
>
> -# TODO: pattern based configuration update
>   pkg_postinst_${PN} () {
> -	cat $D/etc/nsswitch.conf | grep "hosts:\s*files dns$">  /dev/null&&  {
> -		sed -i 's/hosts:\s*files dns/&  mdns4/' $D/etc/nsswitch.conf
> -	}
> +if ! grep -q '^hosts:.*\<mdns4\>' $D/etc/nsswitch.conf; then
> +	sed -e 's/^hosts:.*/&  mdns4/' -i $D/etc/nsswitch.conf
> +fi
>   }
>
>   pkg_prerm_${PN} () {
> -	cat /etc/nsswitch.conf | grep "hosts:\s*files dns mdns4$">  /dev/null&&  {
> -		sed -i 's/\(hosts:\s*files dns\) mdns4*/\1/' /etc/nsswitch.conf
> -	}
> +if grep -q '^hosts:.*\<mdns4\>' /etc/nsswitch.conf; then
> +	sed -e '/^hosts:/s/\s\<mdns4\>//' -i /etc/nsswitch.conf
> +fi
>   }

Merged into OE-Core

Thanks
	Sau!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-24 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-21 14:53 [PATCH] libnss-mdns: fix postinst scripts Andreas Oberritter
2012-05-24 17:52 ` Saul Wold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox