From 0385f518570c18cefacf41c86e0aa02043c9f18c Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Thu, 6 Feb 2014 14:33:02 -0600 Subject: Update SuperSU Change-Id: I0f450357595e7f5f56a7c120b899101faf7f6360 --- prebuilt/install-recovery.sh | 10 ++++------ prebuilt/su | Bin 112164 -> 113036 bytes twrp-functions.cpp | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/prebuilt/install-recovery.sh b/prebuilt/install-recovery.sh index 9b4374520..f62cf0b96 100755 --- a/prebuilt/install-recovery.sh +++ b/prebuilt/install-recovery.sh @@ -5,15 +5,13 @@ # to launch it from init.rc # Launches SuperSU in daemon mode only on Android 4.3+. -# Nothing will happen on 4.2.x or older. +# Nothing will happen on 4.2.x or older, unless SELinux+Enforcing. # If you want to force loading the daemon, use "--daemon" instead /system/xbin/daemonsu --auto-daemon & -# Some apps like to run stuff from this script as well, but the -# installer will have done "chattr +i" on this file to prevent -# accidental modification and deletion. In your code, just search -# this file for "install-recovery-2.sh", and if present, write -# there instead. +# Some apps like to run stuff from this script as well, that will +# obviously break root - in your code, just search this file +# for "install-recovery-2.sh", and if present, write there instead. /system/etc/install-recovery-2.sh diff --git a/prebuilt/su b/prebuilt/su index da77f0a70..941542798 100755 Binary files a/prebuilt/su and b/prebuilt/su differ diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 420982452..bbd3c4c9f 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -559,13 +559,21 @@ bool TWFunc::Fix_su_Perms(void) { if (!PartitionManager.Mount_By_Path("/system", true)) return false; + string propvalue = System_Property_Get("ro.build.version.sdk"); + string su_perms = "6755"; + if (!propvalue.empty()) { + int sdk_version = atoi(propvalue.c_str()); + if (sdk_version >= 18) + su_perms = "0755"; + } + string file = "/system/bin/su"; if (TWFunc::Path_Exists(file)) { if (chown(file.c_str(), 0, 0) != 0) { LOGERR("Failed to chown '%s'\n", file.c_str()); return false; } - if (tw_chmod(file, "6755") != 0) { + if (tw_chmod(file, su_perms) != 0) { LOGERR("Failed to chmod '%s'\n", file.c_str()); return false; } @@ -576,7 +584,7 @@ bool TWFunc::Fix_su_Perms(void) { LOGERR("Failed to chown '%s'\n", file.c_str()); return false; } - if (tw_chmod(file, "6755") != 0) { + if (tw_chmod(file, su_perms) != 0) { LOGERR("Failed to chmod '%s'\n", file.c_str()); return false; } @@ -587,7 +595,7 @@ bool TWFunc::Fix_su_Perms(void) { LOGERR("Failed to chown '%s'\n", file.c_str()); return false; } - if (tw_chmod(file, "6755") != 0) { + if (tw_chmod(file, "0755") != 0) { LOGERR("Failed to chmod '%s'\n", file.c_str()); return false; } @@ -598,7 +606,7 @@ bool TWFunc::Fix_su_Perms(void) { LOGERR("Failed to chown '%s'\n", file.c_str()); return false; } - if (tw_chmod(file, "6755") != 0) { + if (tw_chmod(file, su_perms) != 0) { LOGERR("Failed to chmod '%s'\n", file.c_str()); return false; } -- cgit v1.2.3