[OE-core] [PATCH V3 2/3] screen: add pkg_postinst to register entry to /etc/shells

Ming Liu ming.liu at windriver.com
Fri Oct 18 11:11:39 UTC 2013


Also add pkg_postrm to remove the entry.

Signed-off-by: Ming Liu <ming.liu at windriver.com>
---
 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




More information about the Openembedded-core mailing list