termux-tools: Update su
authorFredrik Fornwall <fredrik@fornwall.net>
Mon, 12 Sep 2016 10:11:18 +0000 (06:11 -0400)
committerFredrik Fornwall <fredrik@fornwall.net>
Mon, 12 Sep 2016 10:11:18 +0000 (06:11 -0400)
Search for /sbin/su, and remove termux-specific environment
so that system tools can be used for the root session.

packages/termux-tools/su

index cc3d9af..4c1fc9c 100755 (executable)
@@ -1,20 +1,17 @@
 #!/data/data/com.termux/files/usr/bin/sh
 
-ROOT_SHELL=$PREFIX/bin/bash
-if test -x "$HOME/.termux/shell"; then ROOT_SHELL=`readlink -f $HOME/.termux/shell`; fi
+unset LD_LIBRARY_PATH
 
-for p in /system/xbin/su /su/bin/su
+for p in /system/xbin/su /su/bin/su /sbin/su
 do
        if [ -x $p ]; then
                # The su tool may require programs in PATH:
-               PATH=$PATH:/su/bin:/su/xbin:/system/bin:/system/xbin \
-                       exec $p \
-                       --preserve-environment \
-                       -c "LD_LIBRARY_PATH=$PREFIX/lib $ROOT_SHELL"
+               PATH=/sbin/su:/su/bin:/su/xbin:/system/bin:/system/xbin \
+                       exec $p $@
        fi
 done
 
-echo "There is no su program on this device. Termux"
+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."