termux-packages/packages/termux-tools/su
Jason A. Donenfeld db23fe725f termux-tools: use proper su search order
This mirrors the search order in the standard Android PATH, so that the
right tool is used consistently. This makes it easier for something like
Kernel Assisted Superuser to co-exist with Magisk.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-24 00:05:07 +01:00

19 lines
524 B
Bash
Executable File

#!/data/data/com.termux/files/usr/bin/sh
unset LD_LIBRARY_PATH LD_PRELOAD
for p in /sbin/su /system/sbin/su /system/bin/su /system/xbin/su /su/bin/su /magisk/.core/bin/su
do
if [ -x $p ]; then
# The su tool may require programs in PATH:
PATH=/sbin/su:/su/bin:/su/xbin:/system/bin:/system/xbin \
exec $p "$@"
fi
done
echo "No su program found on this device. Termux"
echo "does not supply tools for rooting, see e.g."
echo "http://www.androidcentral.com/root for"
echo "information about rooting Android."
exit 1