summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-08-29 22:21:12 +0200
committerDees_Troy <dees_troy@teamw.in>2013-08-30 03:53:54 +0200
commita7939bbdc8960f95d51df4d9b7d8e52db2550afa (patch)
tree0c865d1c7748e5a6261fc7e6dd5497d526f78b5a
parentChange to use HAVE_SELINUX build flag (diff)
downloadandroid_bootable_recovery-a7939bbdc8960f95d51df4d9b7d8e52db2550afa.tar
android_bootable_recovery-a7939bbdc8960f95d51df4d9b7d8e52db2550afa.tar.gz
android_bootable_recovery-a7939bbdc8960f95d51df4d9b7d8e52db2550afa.tar.bz2
android_bootable_recovery-a7939bbdc8960f95d51df4d9b7d8e52db2550afa.tar.lz
android_bootable_recovery-a7939bbdc8960f95d51df4d9b7d8e52db2550afa.tar.xz
android_bootable_recovery-a7939bbdc8960f95d51df4d9b7d8e52db2550afa.tar.zst
android_bootable_recovery-a7939bbdc8960f95d51df4d9b7d8e52db2550afa.zip
Diffstat (limited to '')
-rwxr-xr-xprebuilt/99SuperSUDaemon2
-rw-r--r--prebuilt/Android.mk18
-rwxr-xr-xprebuilt/chattrbin0 -> 9956 bytes
-rwxr-xr-xprebuilt/install-recovery.sh19
-rwxr-xr-xprebuilt/subin96260 -> 112164 bytes
-rw-r--r--twrp-functions.cpp62
-rw-r--r--variables.h2
7 files changed, 102 insertions, 1 deletions
diff --git a/prebuilt/99SuperSUDaemon b/prebuilt/99SuperSUDaemon
new file mode 100755
index 000000000..de738c17b
--- /dev/null
+++ b/prebuilt/99SuperSUDaemon
@@ -0,0 +1,2 @@
+#!/system/bin/sh
+/system/xbin/daemonsu --auto-daemon &
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 73432b3cb..08e09aca7 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -234,6 +234,24 @@ ifneq ($(TW_EXCLUDE_SUPERSU), true)
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
+ #install-recovery.sh
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := install-recovery.sh
+ LOCAL_MODULE_TAGS := eng
+ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+ LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu
+ LOCAL_SRC_FILES := $(LOCAL_MODULE)
+ include $(BUILD_PREBUILT)
+
+ #99SuperSUDaemon
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := 99SuperSUDaemon
+ LOCAL_MODULE_TAGS := eng
+ LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+ LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu
+ LOCAL_SRC_FILES := $(LOCAL_MODULE)
+ include $(BUILD_PREBUILT)
+
#SuperSU special installer APK
include $(CLEAR_VARS)
LOCAL_MODULE := Superuser.apk
diff --git a/prebuilt/chattr b/prebuilt/chattr
new file mode 100755
index 000000000..12ccf8610
--- /dev/null
+++ b/prebuilt/chattr
Binary files differ
diff --git a/prebuilt/install-recovery.sh b/prebuilt/install-recovery.sh
new file mode 100755
index 000000000..9b4374520
--- /dev/null
+++ b/prebuilt/install-recovery.sh
@@ -0,0 +1,19 @@
+#!/system/bin/sh
+
+# If you're implementing this in a custom kernel/firmware,
+# I suggest you use a different script name, and add a service
+# 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.
+# 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.
+
+/system/etc/install-recovery-2.sh
diff --git a/prebuilt/su b/prebuilt/su
index 7d31770de..da77f0a70 100755
--- a/prebuilt/su
+++ b/prebuilt/su
Binary files differ
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index e54e760ab..3c379d10e 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -560,6 +560,17 @@ bool TWFunc::Fix_su_Perms(void) {
return false;
}
}
+ file = "/system/xbin/daemonsu";
+ 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) {
+ LOGERR("Failed to chmod '%s'\n", file.c_str());
+ return false;
+ }
+ }
file = "/system/bin/.ext/.su";
if (TWFunc::Path_Exists(file)) {
if (chown(file.c_str(), 0, 0) != 0) {
@@ -571,6 +582,28 @@ bool TWFunc::Fix_su_Perms(void) {
return false;
}
}
+ file = "/system/etc/install-recovery.sh";
+ 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, "0755") != 0) {
+ LOGERR("Failed to chmod '%s'\n", file.c_str());
+ return false;
+ }
+ }
+ file = "/system/etc/init.d/99SuperSUDaemon";
+ 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, "0755") != 0) {
+ LOGERR("Failed to chmod '%s'\n", file.c_str());
+ return false;
+ }
+ }
file = "/system/app/Superuser.apk";
if (TWFunc::Path_Exists(file)) {
if (chown(file.c_str(), 0, 0) != 0) {
@@ -696,13 +729,42 @@ int TWFunc::tw_chmod(string fn, string mode) {
}
bool TWFunc::Install_SuperSU(void) {
+ string status;
+
if (!PartitionManager.Mount_By_Path("/system", true))
return false;
+ TWFunc::Exec_Cmd("/sbin/chattr -i /system/xbin/su", status);
if (copy_file("/supersu/su", "/system/xbin/su", 0755) != 0) {
LOGERR("Failed to copy su binary to /system/bin\n");
return false;
}
+ if (!Path_Exists("/system/bin/.ext")) {
+ mkdir("/system/bin/.ext", 0777);
+ }
+ TWFunc::Exec_Cmd("/sbin/chattr -i /system/bin/.ext/su", status);
+ if (copy_file("/supersu/su", "/system/bin/.ext/su", 0755) != 0) {
+ LOGERR("Failed to copy su binary to /system/bin/.ext/su\n");
+ return false;
+ }
+ TWFunc::Exec_Cmd("/sbin/chattr -i /system/xbin/daemonsu", status);
+ if (copy_file("/supersu/su", "/system/xbin/daemonsu", 0755) != 0) {
+ LOGERR("Failed to copy su binary to /system/xbin/daemonsu\n");
+ return false;
+ }
+ if (Path_Exists("/system/etc/init.d")) {
+ TWFunc::Exec_Cmd("/sbin/chattr -i /system/etc/init.d/99SuperSUDaemon", status);
+ if (copy_file("/supersu/99SuperSUDaemon", "/system/etc/init.d/99SuperSUDaemon", 0755) != 0) {
+ LOGERR("Failed to copy 99SuperSUDaemon to /system/etc/init.d/99SuperSUDaemon\n");
+ return false;
+ }
+ } else {
+ TWFunc::Exec_Cmd("/sbin/chattr -i /system/etc/install-recovery.sh", status);
+ if (copy_file("/supersu/install-recovery.sh", "/system/etc/install-recovery.sh", 0755) != 0) {
+ LOGERR("Failed to copy install-recovery.sh to /system/etc/install-recovery.sh\n");
+ return false;
+ }
+ }
if (copy_file("/supersu/Superuser.apk", "/system/app/Superuser.apk", 0644) != 0) {
LOGERR("Failed to copy Superuser app to /system/app\n");
return false;
diff --git a/variables.h b/variables.h
index b8a938035..8c88e9191 100644
--- a/variables.h
+++ b/variables.h
@@ -17,7 +17,7 @@
#ifndef _VARIABLES_HEADER_
#define _VARIABLES_HEADER_
-#define TW_VERSION_STR "2.6.0.4"
+#define TW_VERSION_STR "2.6.1.0"
#define TW_USE_COMPRESSION_VAR "tw_use_compression"
#define TW_FILENAME "tw_filename"