diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index c659a95ec..499b05d59 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -86,23 +86,40 @@ setup_flashable() { } ensure_bb() { - [ -o standalone ] && return - set -o standalone 2>/dev/null && return + if set -o | grep -q standalone; then + # We are definitely in busybox ash + set -o standalone + return + fi - # At this point, we are not running in BusyBox ash # Find our busybox binary - local BUSYBOX + local bb if [ -f $TMPDIR/busybox ]; then - BUSYBOX=$TMPDIR/busybox + bb=$TMPDIR/busybox elif [ -f $MAGISKBIN/busybox ]; then - BUSYBOX=$MAGISKBIN/busybox + bb=$MAGISKBIN/busybox else abort "! Cannot find BusyBox" fi + chmod 755 $bb + + # Find our current arguments + # Run in busybox environment to ensure consistent results + # /proc//cmdline shall be