From daf9b019c60b305590568c26ee61348485a2d636 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 21 Jun 2018 16:39:10 +0800 Subject: [PATCH] More elaborate bb_setup --- scripts/util_functions.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index f53b49021..276f88e76 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -296,8 +296,14 @@ api_level_arch_detect() { } setup_bb() { - if [ ! -d $TMPDIR/bin ]; then - # Add busybox to PATH + if [ -x /sbin/.core/busybox/busybox ]; then + # Make sure this path is in the front + echo $PATH | grep -q '^/sbin/.core/busybox' || export PATH=/sbin/.core/busybox:$PATH + elif [ -x $TMPDIR/bin/busybox ]; then + # Make sure this path is in the front + echo $PATH | grep -q "^$TMPDIR/bin" || export PATH=$TMPDIR/bin:$PATH + else + # Construct the PATH mkdir -p $TMPDIR/bin ln -s $MAGISKBIN/busybox $TMPDIR/bin/busybox $MAGISKBIN/busybox --install -s $TMPDIR/bin