summaryrefslogtreecommitdiffstats
path: root/openrecoveryscript.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-10-16 17:43:20 +0200
committerDees_Troy <dees_troy@teamw.in>2012-10-16 17:43:20 +0200
commit06b4fe97eff1f03540919c2900ccaf217a75fa2e (patch)
tree1aab3027899ad286258eb859cc801e99dcd91412 /openrecoveryscript.cpp
parentFix weird keyboard problem (diff)
downloadandroid_bootable_recovery-06b4fe97eff1f03540919c2900ccaf217a75fa2e.tar
android_bootable_recovery-06b4fe97eff1f03540919c2900ccaf217a75fa2e.tar.gz
android_bootable_recovery-06b4fe97eff1f03540919c2900ccaf217a75fa2e.tar.bz2
android_bootable_recovery-06b4fe97eff1f03540919c2900ccaf217a75fa2e.tar.lz
android_bootable_recovery-06b4fe97eff1f03540919c2900ccaf217a75fa2e.tar.xz
android_bootable_recovery-06b4fe97eff1f03540919c2900ccaf217a75fa2e.tar.zst
android_bootable_recovery-06b4fe97eff1f03540919c2900ccaf217a75fa2e.zip
Diffstat (limited to '')
-rw-r--r--openrecoveryscript.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp
index 9317ae7bc..47bf5d6dd 100644
--- a/openrecoveryscript.cpp
+++ b/openrecoveryscript.cpp
@@ -72,7 +72,7 @@ int OpenRecoveryScript::check_for_script_file(void) {
int OpenRecoveryScript::run_script_file(void) {
FILE *fp = fopen(SCRIPT_FILE_TMP, "r");
- int ret_val = 0, cindex, line_len, i, remove_nl;
+ int ret_val = 0, cindex, line_len, i, remove_nl, install_cmd = 0;
char script_line[SCRIPT_COMMAND_SIZE], command[SCRIPT_COMMAND_SIZE],
value[SCRIPT_COMMAND_SIZE], mount[SCRIPT_COMMAND_SIZE],
value1[SCRIPT_COMMAND_SIZE], value2[SCRIPT_COMMAND_SIZE];
@@ -112,6 +112,7 @@ int OpenRecoveryScript::run_script_file(void) {
if (strcmp(command, "install") == 0) {
// Install Zip
ret_val = Install_Command(value);
+ install_cmd = -1;
} else if (strcmp(command, "wipe") == 0) {
// Wipe
if (strcmp(value, "cache") == 0 || strcmp(value, "/cache") == 0) {
@@ -345,6 +346,17 @@ int OpenRecoveryScript::run_script_file(void) {
LOGE("Error opening script file '%s'\n", SCRIPT_FILE_TMP);
return 1;
}
+ if (install_cmd && DataManager_GetIntValue(TW_HAS_INJECTTWRP) == 1 && DataManager_GetIntValue(TW_INJECT_AFTER_ZIP) == 1) {
+ ui_print("Injecting TWRP into boot image...\n");
+ TWPartition* Boot = PartitionManager.Find_Partition_By_Path("/boot");
+ if (Boot == NULL || Boot->Current_File_System != "emmc")
+ system("injecttwrp --dump /tmp/backup_recovery_ramdisk.img /tmp/injected_boot.img --flash");
+ else {
+ string injectcmd = "injecttwrp --dump /tmp/backup_recovery_ramdisk.img /tmp/injected_boot.img --flash bd=" + Boot->Actual_Block_Device;
+ system(injectcmd.c_str());
+ }
+ ui_print("TWRP injection complete.\n");
+ }
return ret_val;
}