]> code.ossystems Code Review - openembedded-core.git/commitdiff
bash: dynamically add or remove a entry to/from /etc/shells
authorMing Liu <ming.liu@windriver.com>
Tue, 22 Oct 2013 03:12:00 +0000 (11:12 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 26 Oct 2013 14:53:25 +0000 (15:53 +0100)
1 Add base-files to RDEPENDS.
2 Use ${base_bindir} in regex to match bash path.
3 Add pkg_postrm to remove the entry from /etc/shells that added by
pkg_postinst.

Signed-off-by: Ming Liu <ming.liu@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/recipes-extended/bash/bash.inc

index 64b476f4fb83093b49fb26ff8cc6adc51b151359..99875bfc759ff47e57bff17bf34903c2b82173b4 100644 (file)
@@ -17,6 +17,8 @@ ALTERNATIVE_PRIORITY = "100"
 
 export AUTOHEADER = "true"
 
+RDEPENDS_${PN} += "base-files"
+RDEPENDS_${PN}_class-nativesdk = ""
 RDEPENDS_${PN}-ptest += "make"
 
 do_configure_prepend () {
@@ -44,7 +46,9 @@ 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
+       grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
+}
+
+pkg_postrm_${PN} () {
+       printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
 }