diff options
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/busybox/busybox.inc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc index 1a82f23b0f..344e891f7a 100644 --- a/meta/recipes-core/busybox/busybox.inc +++ b/meta/recipes-core/busybox/busybox.inc | |||
@@ -433,6 +433,32 @@ fi | |||
433 | d.prependVar('pkg_postinst_%s' % pkg, postinst) | 433 | d.prependVar('pkg_postinst_%s' % pkg, postinst) |
434 | } | 434 | } |
435 | 435 | ||
436 | pkg_postinst_${PN}_prepend () { | ||
437 | # Need path to saved utils, but they may have be removed on upgrade of busybox | ||
438 | # Only use shell to get paths. Also capture if busybox was saved. | ||
439 | BUSYBOX="" | ||
440 | if [ "x$D" = "x" ] ; then | ||
441 | for busybox_rmdir in /tmp/busyboxrm-*; do | ||
442 | if [ "$busybox_rmdir" != '/tmp/busyboxrm-*' ] ; then | ||
443 | export PATH=$busybox_rmdir:$PATH | ||
444 | if [ -e $busybox_rmdir/busybox* ] ; then | ||
445 | BUSYBOX="$busybox_rmdir/busybox*" | ||
446 | fi | ||
447 | fi | ||
448 | done | ||
449 | fi | ||
450 | } | ||
451 | |||
452 | pkg_postinst_${PN}_append () { | ||
453 | # If busybox exists in the remove directory it is because it was the only shell left. | ||
454 | if [ "x$D" = "x" ] ; then | ||
455 | if [ "x$BUSYBOX" != "x" ] ; then | ||
456 | update-alternatives --remove sh $BUSYBOX | ||
457 | rm -f $BUSYBOX | ||
458 | fi | ||
459 | fi | ||
460 | } | ||
461 | |||
436 | pkg_prerm_${PN} () { | 462 | pkg_prerm_${PN} () { |
437 | # This is so you can make busybox commit suicide - removing busybox with no other packages | 463 | # This is so you can make busybox commit suicide - removing busybox with no other packages |
438 | # providing its files, this will make update-alternatives work, but the update-rc.d part | 464 | # providing its files, this will make update-alternatives work, but the update-rc.d part |
@@ -453,9 +479,26 @@ pkg_prerm_${PN} () { | |||
453 | ln -s ${base_bindir}/busybox $tmpdir/grep | 479 | ln -s ${base_bindir}/busybox $tmpdir/grep |
454 | ln -s ${base_bindir}/busybox $tmpdir/tail | 480 | ln -s ${base_bindir}/busybox $tmpdir/tail |
455 | export PATH=$PATH:$tmpdir | 481 | export PATH=$PATH:$tmpdir |
482 | |||
483 | # If busybox is the shell, we need to save it since its the lowest priority shell | ||
484 | # Register saved bitbake as the lowest priority shell possible as back up. | ||
485 | if [ -n "$(readlink -f /bin/sh | grep busybox)" ] ; then | ||
486 | BUSYBOX=$(readlink -f /bin/sh) | ||
487 | cp $BUSYBOX $tmpdir/$(basename $BUSYBOX) | ||
488 | update-alternatives --install /bin/sh sh $tmpdir/$(basename $BUSYBOX) 1 | ||
489 | fi | ||
456 | } | 490 | } |
457 | 491 | ||
458 | pkg_postrm_${PN} () { | 492 | pkg_postrm_${PN} () { |
493 | # Add path to remove dir in case we removed our only grep | ||
494 | if [ "x$D" = "x" ] ; then | ||
495 | for busybox_rmdir in /tmp/busyboxrm-*; do | ||
496 | if [ "$busybox_rmdir" != '/tmp/busyboxrm-*' ] ; then | ||
497 | export PATH=$busybox_rmdir:$PATH | ||
498 | fi | ||
499 | done | ||
500 | fi | ||
501 | |||
459 | if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links* && [ ! -e $D${base_bindir}/bash ]; then | 502 | if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links* && [ ! -e $D${base_bindir}/bash ]; then |
460 | printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells | 503 | printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells |
461 | fi | 504 | fi |