Outfd $2
Outfd $2
ZIP=$3
SYSTEMLIB=/system/lib
ui_print() {
ch_con() {
chcon -h u:object_r:system_file:s0 $1
chcon u:object_r:system_file:s0 $1
ch_con_ext() {
chcon $2 $1
}
ln_con() {
LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox ln -s $1 $2
LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox ln -s $1 $2
ln -s $1 $2
ch_con $2
set_perm() {
chown $1.$2 $4
chown $1:$2 $4
chmod $3 $4
ch_con $4
ch_con_ext $4 $5
cp_perm() {
rm $5
if [ -f "$4" ]; then
cat $4 > $5
set_perm $1 $2 $3 $5 $6
fi
ui_print "*****************"
mount /system
mount /data
mount -o rw,remount /
mount -o rw,remount / /
SUMOD=06755
SUGOTE=false
SUPOLICY=false
INSTALL_RECOVERY_CONTEXT=u:object_r:system_file:s0
MKSH=/system/bin/mksh
PIE=
ARCH=arm
APKFOLDER=false
APKNAME=/system/app/Superuser.apk
APPPROCESS=false
APPPROCESS64=false
SUGOTE=true
PIE=.pie
fi
SUMOD=0755
fi
APKFOLDER=true
APKNAME=/system/app/SuperSU/SuperSU.apk
fi
if [ "$API" -ge "19" ]; then
SUPOLICY=true
INSTALL_RECOVERY_CONTEXT=u:object_r:toolbox_exec:s0
fi
fi
APPPROCESS=true
fi
fi
if [ ! -f $MKSH ]; then
MKSH=/system/bin/sh
fi
#ui_print "DBG [$API] [$ABI] [$ABI2] [$ABILONG] [$ARCH] [$MKSH]"
cd /tmp
mkdir supersu
cd supersu
if [ -z "$BIN" ]; then
unzip -o "$ZIP"
BIN=/tmp/supersu/$ARCH
COM=/tmp/supersu/common
fi
if [ -f "/system/bin/install-recovery.sh" ]; then
if [ ! -f "/system/bin/install-recovery_original.sh" ]; then
mv /system/bin/install-recovery.sh /system/bin/install-recovery_original.sh
ch_con /system/bin/install-recovery_original.sh
fi
fi
if [ -f "/system/etc/install-recovery.sh" ]; then
if [ ! -f "/system/etc/install-recovery_original.sh" ]; then
mv /system/etc/install-recovery.sh /system/etc/install-recovery_original.sh
ch_con /system/etc/install-recovery_original.sh
fi
fi
rm -f /system/bin/su
rm -f /system/xbin/su
rm -f /system/sbin/su
rm -f /vendor/sbin/su
rm -f /vendor/bin/su
rm -f /vendor/xbin/su
rm -f /system/xbin/daemonsu
rm -f /system/xbin/sugote
rm -f /system/xbin/sugote-mksh
rm -f /system/xbin/supolicy
rm -f /system/lib/libsupol.so
rm -f /system/lib64/libsupol.so
rm -f /system/bin/.ext/.su
rm -f /system/bin/install-recovery.sh
rm -f /system/etc/install-recovery.sh
rm -f /system/etc/init.d/99SuperSUDaemon
rm -f /system/etc/.installed_su_daemon
rm -f /system/app/Superuser.apk
rm -f /system/app/Superuser.odex
rm -rf /system/app/Superuser
rm -f /system/app/SuperUser.apk
rm -f /system/app/SuperUser.odex
rm -rf /system/app/SuperUser
rm -f /system/app/superuser.apk
rm -f /system/app/superuser.odex
rm -rf /system/app/superuser
rm -f /system/app/Supersu.apk
rm -f /system/app/Supersu.odex
rm -rf /system/app/Supersu
rm -f /system/app/SuperSU.apk
rm -f /system/app/SuperSU.odex
rm -rf /system/app/SuperSU
rm -f /system/app/supersu.apk
rm -f /system/app/supersu.odex
rm -rf /system/app/supersu
rm -f /system/app/VenomSuperUser.apk
rm -f /system/app/VenomSuperUser.odex
rm -rf /system/app/VenomSuperUser
rm -f /data/dalvik-cache/*com.noshufou.android.su*
rm -f /data/dalvik-cache/*/*com.noshufou.android.su*
rm -f /data/dalvik-cache/*com.koushikdutta.superuser*
rm -f /data/dalvik-cache/*/*com.koushikdutta.superuser*
rm -f /data/dalvik-cache/*com.mgyun.shua.su*
rm -f /data/dalvik-cache/*/*com.mgyun.shua.su*
rm -f /data/dalvik-cache/*com.m0narx.su*
rm -f /data/dalvik-cache/*/*com.m0narx.su*
rm -f /data/dalvik-cache/*Superuser.apk*
rm -f /data/dalvik-cache/*/*Superuser.apk*
rm -f /data/dalvik-cache/*SuperUser.apk*
rm -f /data/dalvik-cache/*/*SuperUser.apk*
rm -f /data/dalvik-cache/*superuser.apk*
rm -f /data/dalvik-cache/*/*superuser.apk*
rm -f /data/dalvik-cache/*VenomSuperUser.apk*
rm -f /data/dalvik-cache/*/*VenomSuperUser.apk*
rm -f /data/dalvik-cache/*eu.chainfire.supersu*
rm -f /data/dalvik-cache/*/*eu.chainfire.supersu*
rm -f /data/dalvik-cache/*Supersu.apk*
rm -f /data/dalvik-cache/*/*Supersu.apk*
rm -f /data/dalvik-cache/*SuperSU.apk*
rm -f /data/dalvik-cache/*/*SuperSU.apk*
rm -f /data/dalvik-cache/*supersu.apk*
rm -f /data/dalvik-cache/*/*supersu.apk*
rm -f /data/dalvik-cache/*.oat
rm -f /data/app/com.noshufou.android.su*
rm -f /data/app/com.koushikdutta.superuser*
rm -f /data/app/com.mgyun.shua.su*
rm -f /data/app/com.m0narx.su*
rm -f /data/app/eu.chainfire.supersu-*
rm -f /data/app/eu.chainfire.supersu.apk
if ($APKFOLDER); then
if [ -f "/system/app/Maps/Maps.apk" ]; then
cp /system/app/Maps/Maps.apk /Maps.apk
rm /system/app/Maps/Maps.apk
fi
if [ -f "/system/app/GMS_Maps/GMS_Maps.apk" ]; then
cp /system/app/GMS_Maps/GMS_Maps.apk /GMS_Maps.apk
rm /system/app/GMS_Maps/GMS_Maps.apk
fi
if [ -f "/system/app/YouTube/YouTube.apk" ]; then
cp /system/app/YouTube/YouTube.apk /YouTube.apk
rm /system/app/YouTube/YouTube.apk
fi
else
if [ -f "/system/app/Maps.apk" ]; then
cp /system/app/Maps.apk /Maps.apk
rm /system/app/Maps.apk
fi
if [ -f "/system/app/GMS_Maps.apk" ]; then
cp /system/app/GMS_Maps.apk /GMS_Maps.apk
rm /system/app/GMS_Maps.apk
fi
if [ -f "/system/app/YouTube.apk" ]; then
cp /system/app/YouTube.apk /YouTube.apk
rm /system/app/YouTube.apk
fi
fi
mkdir /system/bin/.ext
set_perm 0 0 0777 /system/bin/.ext
if ($SUGOTE); then
fi
if ($SUPOLICY); then
fi
if ($APKFOLDER); then
mkdir /system/app/SuperSU
fi
if ($APPPROCESS); then
rm /system/bin/app_process
if ($APPPROCESS64); then
if [ ! -f "/system/bin/app_process64_original" ]; then
mv /system/bin/app_process64 /system/bin/app_process64_original
else
rm /system/bin/app_process64
fi
if [ ! -f "/system/bin/app_process_init" ]; then
fi
else
if [ ! -f "/system/bin/app_process32_original" ]; then
mv /system/bin/app_process32 /system/bin/app_process32_original
else
rm /system/bin/app_process32
fi
if [ ! -f "/system/bin/app_process_init" ]; then
fi
fi
fi
if ($APKFOLDER); then
if [ -f "/Maps.apk" ]; then
rm /Maps.apk
fi
if [ -f "/GMS_Maps.apk" ]; then
rm /GMS_Maps.apk
fi
if [ -f "/YouTube.apk" ]; then
rm /YouTube.apk
fi
else
if [ -f "/Maps.apk" ]; then
rm /Maps.apk
fi
if [ -f "/GMS_Maps.apk" ]; then
rm /GMS_Maps.apk
fi
if [ -f "/YouTube.apk" ]; then
rm /YouTube.apk
fi
fi
rm /system/toolbox
umount /system
umount /data
exit 0