Also add pkg_postrm to remove the entry.

Signed-off-by: Ming Liu <[email protected]>
---
 meta/recipes-extended/screen/screen_4.0.3.bb |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/meta/recipes-extended/screen/screen_4.0.3.bb 
b/meta/recipes-extended/screen/screen_4.0.3.bb
index 1a7eb20..a3b3715 100644
--- a/meta/recipes-extended/screen/screen_4.0.3.bb
+++ b/meta/recipes-extended/screen/screen_4.0.3.bb
@@ -41,3 +41,21 @@ do_install_append () {
                fi
        done
 }
+
+pkg_postinst_${PN} () {
+       if [ ! -f $D${sysconfdir}/shells ]; then
+               touch $D${sysconfdir}/shells
+       fi
+
+       grep -q "^${bindir}/screen$" $D${sysconfdir}/shells || echo 
${bindir}/screen >> $D${sysconfdir}/shells
+}
+
+pkg_postrm_${PN} () {
+       if [ -f $D${sysconfdir}/shells ]; then
+               printf "$(grep -v "^${bindir}/screen$" 
$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