summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/busybox/busybox.inc
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:36 +0100
commitcebda73b3fc33793c3ad42edec380c656680330d (patch)
tree7b6182262caf4247719707095033bd78a1dbf091 /meta/recipes-core/busybox/busybox.inc
parent8d22a45cdd97e14e1c8f9f0410406c4c1e0a0950 (diff)
downloadpoky-cebda73b3fc33793c3ad42edec380c656680330d.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. (From OE-Core rev: 3a035bd0a06a6ded4d0ce7e35a3bce42245727d2) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/busybox/busybox.inc')
-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 () {
392 set_alternative_vars("${sysconfdir}/busybox.links.suid", "${base_bindir}/busybox.suid") 392 set_alternative_vars("${sysconfdir}/busybox.links.suid", "${base_bindir}/busybox.suid")
393} 393}
394 394
395pkg_postinst_${PN} () { 395# This part of code is dedicated to the on target upgrade problem. It's known
396 # This part of code is dedicated to the on target upgrade problem. 396# that if we don't make appropriate symlinks before update-alternatives calls,
397 # It's known that if we don't make appropriate symlinks before update-alternatives calls, 397# there will be errors indicating missing commands such as 'sed'.
398 # there will be errors indicating missing commands such as 'sed'. 398# These symlinks will later be updated by update-alternatives calls.
399 # These symlinks will later be updated by update-alternatives calls. 399# The update-alternatives.bbclass' postinst script runs firstly before other
400 test -n 2 > /dev/null || alias test='busybox test' 400# postinst, but this part of code needs run firstly, so add this funtion.
401 if test "x$D" = "x"; then 401python populate_packages_updatealternatives_append() {
402 # Remove busybox.nosuid if it's a symlink, because this situation indicates 402 postinst = """
403 # that we're installing or upgrading to a one-binary busybox. 403test -n 2 > /dev/null || alias test='busybox test'
404 if test -h ${base_bindir}/busybox.nosuid; then 404if test "x$D" = "x"; then
405 rm -f ${base_bindir}/busybox.nosuid 405 # Remove busybox.nosuid if it's a symlink, because this situation indicates
406 fi 406 # that we're installing or upgrading to a one-binary busybox.
407 for suffix in "" ".nosuid" ".suid"; do 407 if test -h ${base_bindir}/busybox.nosuid; then
408 if test -e ${sysconfdir}/busybox.links$suffix; then 408 rm -f ${base_bindir}/busybox.nosuid
409 while read link; do 409 fi
410 if test ! -e "$link"; then 410 for suffix in "" ".nosuid" ".suid"; do
411 # we can use busybox here because even if we are using splitted busybox 411 if test -e ${sysconfdir}/busybox.links$suffix; then
412 # we've made a symlink from /bin/busybox to /bin/busybox.nosuid. 412 while read link; do
413 busybox rm -f $link 413 if test ! -e "$link"; then
414 busybox ln -s "${base_bindir}/busybox$suffix" $link 414 # we can use busybox here because even if we are using splitted busybox
415 fi 415 # we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
416 done < ${sysconfdir}/busybox.links$suffix 416 busybox rm -f $link
417 fi 417 busybox ln -s "${base_bindir}/busybox$suffix" $link
418 done 418 fi
419 fi 419 done < ${sysconfdir}/busybox.links$suffix
420 if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then 420 fi
421 grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells 421 done
422 fi 422fi
423if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then
424 grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
425fi
426
427"""
428 d.prependVar('pkg_postinst_%s' % pkg, postinst)
423} 429}
424 430
425pkg_prerm_${PN} () { 431pkg_prerm_${PN} () {