Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ming Liu <ming.liu@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH V3 3/3] bash: add pkg_postrm to remove the entry in /etc/shells
Date: Fri, 18 Oct 2013 19:11:40 +0800	[thread overview]
Message-ID: <1382094700-17805-3-git-send-email-ming.liu@windriver.com> (raw)
In-Reply-To: <1382094700-17805-1-git-send-email-ming.liu@windriver.com>

Signed-off-by: Ming Liu <ming.liu@windriver.com>
---
 meta/recipes-extended/bash/bash.inc |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
index 64b476f..7c18f37 100644
--- a/meta/recipes-extended/bash/bash.inc
+++ b/meta/recipes-extended/bash/bash.inc
@@ -44,7 +44,19 @@ do_install_ptest () {
 }
 
 pkg_postinst_${PN} () {
-	touch $D${sysconfdir}/shells
-	grep -q "bin/bash" $D${sysconfdir}/shells || echo /bin/bash >> $D${sysconfdir}/shells
-	grep -q "bin/sh" $D${sysconfdir}/shells || echo /bin/sh >> $D${sysconfdir}/shells
+	if [ ! -f $D${sysconfdir}/shells ]; then
+		touch $D${sysconfdir}/shells
+	fi
+
+	grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
+}
+
+pkg_postrm_${PN} () {
+	if [ -f $D${sysconfdir}/shells ]; then
+		printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
+
+		if [ ! -s $D${sysconfdir}/shells ]; then
+			rm $D${sysconfdir}/shells
+		fi
+	fi
 }
-- 
1.7.1



  parent reply	other threads:[~2013-10-18 11:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 11:11 [PATCH V3 1/3] base-files: move shells generating process to pkg_postinst Ming Liu
2013-10-18 11:11 ` [PATCH V3 2/3] screen: add pkg_postinst to register entry to /etc/shells Ming Liu
2013-10-18 11:11 ` Ming Liu [this message]
2013-10-18 14:59   ` [PATCH V3 3/3] bash: add pkg_postrm to remove the entry in /etc/shells Phil Blundell
2013-10-18 15:12     ` Mark Hatle
2013-10-18 15:18       ` Phil Blundell
2013-10-18 17:00         ` Mark Hatle
2013-10-20  5:50       ` Ming Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382094700-17805-3-git-send-email-ming.liu@windriver.com \
    --to=ming.liu@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox