Signed-off-by: Ming Liu <[email protected]>
---
 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

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to