More elaborate bb_setup

This commit is contained in:
topjohnwu 2018-06-21 16:39:10 +08:00
parent 14eebd582f
commit daf9b019c6

View File

@ -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