termux-tools: Try a more functional su wrapper
[termux-packages] / packages / termux-tools / su
1 #!/data/data/com.termux/files/usr/bin/sh
2
3 ROOT_SHELL=$PREFIX/bin/bash
4 if test -x "$HOME/.termux/shell"; then ROOT_SHELL=`readlink -f $HOME/.termux/shell`; fi
5
6 for p in /system/xbin/su /su/bin/su
7 do
8 if [ -x $p ]; then
9 # The su tool may require programs in PATH:
10 PATH=$PATH:/su/bin:/su/xbin:/system/bin:/system/xbin \
11 exec $p \
12 --preserve-environment \
13 -c "LD_LIBRARY_PATH=$PREFIX/lib $ROOT_SHELL"
14 fi
15 done
16
17 echo "There is no su program on this device. Termux"
18 echo "does not supply tools for rooting, see e.g."
19 echo "http://www.androidcentral.com/root for"
20 echo "information about rooting Android."
21 exit 1