summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2019-06-26 15:40:22 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-27 12:20:24 +0100
commit3a035bd0a06a6ded4d0ce7e35a3bce42245727d2 (patch)
treee99ac649559b9a87cab32b17308e501a7aee2eed
parent52c36dd869c605c0065c17f9ed502a319ce3dd84 (diff)
downloadopenembedded-core-contrib-3a035bd0a06a6ded4d0ce7e35a3bce42245727d2.tar.gz
busybox: make postinst run firstly before update-alternatives
The update-alternatives.bbclass' postinst script runs firstly before other postinst, but busybox needs set basic tools such as sed command firstly, otherwise, update-alternatives doesn't work, so run busybox' postinst firstly to fix the problem. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/busybox/busybox.inc62
1 files changed, 34 insertions, 28 deletions
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 174ce5a8c0..49165d7f51 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -392,34 +392,40 @@ python do_package_prepend () {
set_alternative_vars("${sysconfdir}/busybox.links.suid", "${base_bindir}/busybox.suid")
}
-pkg_postinst_${PN} () {
- # This part of code is dedicated to the on target upgrade problem.
- # It's known that if we don't make appropriate symlinks before update-alternatives calls,
- # there will be errors indicating missing commands such as 'sed'.
- # These symlinks will later be updated by update-alternatives calls.
- test -n 2 > /dev/null || alias test='busybox test'
- if test "x$D" = "x"; then
- # Remove busybox.nosuid if it's a symlink, because this situation indicates
- # that we're installing or upgrading to a one-binary busybox.
- if test -h ${base_bindir}/busybox.nosuid; then
- rm -f ${base_bindir}/busybox.nosuid
- fi
- for suffix in "" ".nosuid" ".suid"; do
- if test -e ${sysconfdir}/busybox.links$suffix; then
- while read link; do
- if test ! -e "$link"; then
- # we can use busybox here because even if we are using splitted busybox
- # we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
- busybox rm -f $link
- busybox ln -s "${base_bindir}/busybox$suffix" $link
- fi
- done < ${sysconfdir}/busybox.links$suffix
- fi
- done
- fi
- if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then
- grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
- fi
+# This part of code is dedicated to the on target upgrade problem. It's known
+# that if we don't make appropriate symlinks before update-alternatives calls,
+# there will be errors indicating missing commands such as 'sed'.
+# These symlinks will later be updated by update-alternatives calls.
+# The update-alternatives.bbclass' postinst script runs firstly before other
+# postinst, but this part of code needs run firstly, so add this funtion.
+python populate_packages_updatealternatives_append() {
+ postinst = """
+test -n 2 > /dev/null || alias test='busybox test'
+if test "x$D" = "x"; then
+ # Remove busybox.nosuid if it's a symlink, because this situation indicates
+ # that we're installing or upgrading to a one-binary busybox.
+ if test -h ${base_bindir}/busybox.nosuid; then
+ rm -f ${base_bindir}/busybox.nosuid
+ fi
+ for suffix in "" ".nosuid" ".suid"; do
+ if test -e ${sysconfdir}/busybox.links$suffix; then
+ while read link; do
+ if test ! -e "$link"; then
+ # we can use busybox here because even if we are using splitted busybox
+ # we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
+ busybox rm -f $link
+ busybox ln -s "${base_bindir}/busybox$suffix" $link
+ fi
+ done < ${sysconfdir}/busybox.links$suffix
+ fi
+ done
+fi
+if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then
+ grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
+fi
+
+"""
+ d.prependVar('pkg_postinst_%s' % pkg, postinst)
}
pkg_prerm_${PN} () {