Skip to content

Commit

Permalink
Supersu 2.11
Browse files Browse the repository at this point in the history
Change-Id: Ice718d6edcc29d70be720556fa814453cbf9c999
  • Loading branch information
xiaolu committed Oct 1, 2014
1 parent 0c61772 commit e6fdf63
Show file tree
Hide file tree
Showing 20 changed files with 104 additions and 30 deletions.
33 changes: 29 additions & 4 deletions su/supersu/Android.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
LOCAL_PATH := $(call my-dir)

TARGET_ABILONG := $(TARGET_ARCH)
ifeq ($(TARGET_CPU_ABI), armeabi-v7a)
TARGET_ABILONG := armv7
endif

ifeq ($(TARGET_CPU_ABI), arm64-v8a)
TARGET_ABILONG := arm64
endif

ifeq ($(TARGET_CPU_ABI), x86_64)
TARGET_ABILONG := x64
endif

ifeq ($(TARGET_CPU_ABI), mips64)
TARGET_ABILONG := mips64
endif

include $(CLEAR_VARS)
LOCAL_MODULE := su
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ARCH)
LOCAL_SRC_FILES := $(TARGET_ARCH)/$(LOCAL_MODULE)
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ABILONG)
LOCAL_SRC_FILES := $(TARGET_ABILONG)/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := supolicy
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ABILONG)
LOCAL_SRC_FILES := $(TARGET_ABILONG)/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
Expand Down Expand Up @@ -36,6 +61,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE := chattr.pie
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ARCH)
LOCAL_SRC_FILES := $(TARGET_ARCH)/$(LOCAL_MODULE)
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin/supersu/$(TARGET_ABILONG)
LOCAL_SRC_FILES := $(TARGET_ABILONG)/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)
Binary file modified su/supersu/arm/su
Binary file not shown.
Binary file added su/supersu/arm/supolicy
Binary file not shown.
Binary file added su/supersu/arm64/su
Binary file not shown.
Binary file added su/supersu/arm64/supolicy
Binary file not shown.
Binary file added su/supersu/armv7/chattr.pie
Binary file not shown.
Binary file added su/supersu/armv7/su
Binary file not shown.
Binary file added su/supersu/armv7/supolicy
Binary file not shown.
101 changes: 75 additions & 26 deletions su/supersu/install-su.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,36 @@ mount -o rw,remount /system /system
mount -o rw,remount /
mount -o rw,remount / /

ABI=$(cat /default.prop | grep ro.product.cpu.abi= | dd bs=1 skip=19 count=3)
ABI2=$(cat /default.prop | grep ro.product.cpu.abi2= | dd bs=1 skip=20 count=3)

ARCH=arm
if [ "$ABI" = "x86" ]; then ARCH=x86; fi;
if [ "$ABI2" = "x86" ]; then ARCH=x86; fi;

API=$(cat /system/build.prop | grep ro.build.version.sdk= | dd bs=1 skip=21 count=2)
API=$(cat /system/build.prop | grep "ro.build.version.sdk=" | dd bs=1 skip=21 count=2)
ABI=$(cat /default.prop /system/build.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19 count=3)
ABILONG=$(cat /default.prop /system/build.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19)
ABI2=$(cat /default.prop /system/build.prop | grep -m 1 "ro.product.cpu.abi2=" | dd bs=1 skip=20 count=3)
SUMOD=06755
SUGOTE=false
SUPOLICY=false
MKSH=/system/bin/mksh
PIE=
ARCH=arm
if [ "$ABI" = "x86" ]; then ARCH=x86; fi;
if [ "$ABI2" = "x86" ]; then ARCH=x86; fi;
if [ "$API" -eq "$API" ]; then
if [ "$API" -gt "17" ]; then
SUMOD=0755
SUGOTE=true
if [ "$API" -ge "16" ]; then
PIE=.pie
if [ "$ABILONG" = "armeabi-v7a" ]; then ARCH=armv7; fi;
if [ "$ABI" = "mip" ]; then ARCH=mips; fi;
if [ "$ABILONG" = "mips" ]; then ARCH=mips; fi;
fi
if [ "$API" -ge "17" ]; then
SUMOD=0755
SUGOTE=true
fi
if [ "$API" -ge "19" ]; then
SUPOLICY=true
fi
if [ "$API" -ge "20" ]; then
if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; fi;
if [ "$ABILONG" = "mips64" ]; then ARCH=mips64; fi;
if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; fi;
fi
fi
if [ ! -f $MKSH ]; then
Expand All @@ -52,25 +67,30 @@ if [ -f /system/etc/install_recovery.sh ]; then
fi

mv -n $INS /system/etc/install-recovery-2.sh
chattr -i /system/xbin/su
$BIN/chattr.pie -i /system/xbin/su
chattr -i /system/bin/.ext/.su
$BIN/chattr.pie -i /system/bin/.ext/.su
chattr -i /system/xbin/daemonsu
$BIN/chattr.pie -i /system/xbin/daemonsu
chattr -i $INS
$BIN/chattr.pie -i $INS

chmod 0755 $BIN/chattr$PIE
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/bin/su
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/su
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/bin/.ext/.su
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/daemonsu
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/sugote
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/sugote_mksh
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/supolicy
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i $INS
LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/bin/install-recovery.sh

rm -f /system/bin/su
rm -f /system/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/bin/.ext/.su
rm -f /system/bin/install-recovery.sh
rm -f $INS
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 -f /system/app/SuperUser.apk
Expand All @@ -83,21 +103,39 @@ rm -f /system/app/SuperSU.apk
rm -f /system/app/SuperSU.odex
rm -f /system/app/supersu.apk
rm -f /system/app/supersu.odex
rm -f /system/app/VenomSuperUser.apk
rm -f /system/app/VenomSuperUser.odex
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.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

mkdir /system/bin/.ext
cp $BIN/su /system/xbin/daemonsu
Expand All @@ -106,6 +144,9 @@ if ($SUGOTE); then
cp $BIN/su /system/xbin/sugote
cp $MKSH /system/xbin/sugote-mksh
fi
if ($SUPOLICY); then
cp $BIN/supolicy /system/xbin/supolicy
fi
cp $BIN/su /system/bin/.ext/.su
cp $COM/install-recovery.sh $INS
ln -s $INS /system/bin/install-recovery.sh
Expand All @@ -115,27 +156,35 @@ echo 1 > /system/etc/.installed_su_daemon
set_perm 0 0 0777 /system/bin/.ext
set_perm 0 0 $SUMOD /system/bin/.ext/.su
set_perm 0 0 $SUMOD /system/xbin/su
if ($SUGOTE); then
if ($SUGOTE); then
set_perm 0 0 0755 /system/xbin/sugote
set_perm 0 0 0755 /system/xbin/sugote-mksh
fi
if ($SUPOLICY); then
set_perm 0 0 0755 /system/xbin/supolicy
fi
set_perm 0 0 0755 /system/xbin/daemonsu
set_perm 0 0 0755 $INS
set_perm 0 0 0755 /system/etc/init.d/99SuperSUDaemon
set_perm 0 0 0644 /system/etc/.installed_su_daemon
set_perm 0 0 0644 /system/app/Superuser.apk

ch_con /system/bin/.ext/.su
ch_con /system/xbin/su
if ($SUGOTE); then
ch_con_ext /system/xbin/sugote u:object_r:zygote_exec:s0
ch_con /system/xbin/sugote-mksh
ch_con_ext /system/xbin/sugote u:object_r:zygote_exec:s0
ch_con /system/xbin/sugote-mksh
fi
if ($SUPOLICY); then
ch_con /system/xbin/supolicy
fi
ch_con /system/xbin/daemonsu
ch_con $INS
ch_con /system/etc/init.d/99SuperSUDaemon
ch_con /system/etc/.installed_su_daemon

/system/xbin/su --install
LD_LIBRARY_PATH=/system/lib /system/xbin/su --install


umount /system
umount /data
Expand Down
Binary file added su/supersu/mips/chattr.pie
Binary file not shown.
Binary file added su/supersu/mips/su
Binary file not shown.
Binary file added su/supersu/mips/supolicy
Binary file not shown.
Binary file added su/supersu/mips64/su
Binary file not shown.
Binary file added su/supersu/mips64/supolicy
Binary file not shown.
Binary file added su/supersu/x64/su
Binary file not shown.
Binary file added su/supersu/x64/supolicy
Binary file not shown.
Empty file modified su/supersu/x86/chattr
100644 → 100755
Empty file.
Empty file modified su/supersu/x86/chattr.pie
100644 → 100755
Empty file.
Binary file modified su/supersu/x86/su
Binary file not shown.
Binary file added su/supersu/x86/supolicy
Binary file not shown.

0 comments on commit e6fdf63

Please sign in to comment.