From 83a3b1260d7a371fe0d31e10361f38f311b99ece Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Mon, 1 Oct 2012 14:16:43 -0400 Subject: Update ORS and recovery commands --- openrecoveryscript.cpp | 247 ++++++++++++++++++++++++++----------------------- 1 file changed, 133 insertions(+), 114 deletions(-) (limited to 'openrecoveryscript.cpp') diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp index 23641f7f3..88d54aca4 100644 --- a/openrecoveryscript.cpp +++ b/openrecoveryscript.cpp @@ -109,58 +109,8 @@ int OpenRecoveryScript::run_script_file(void) { ui_print("command is: '%s' and there is no value\n", command); } if (strcmp(command, "install") == 0) { - // Install zip - string ret_string; - - PartitionManager.Mount_All_Storage(); - if (value[0] != '/') { - // Relative path given - char full_path[SCRIPT_COMMAND_SIZE]; - - sprintf(full_path, "%s/%s", DataManager_GetCurrentStoragePath(), value); - LOGI("Full zip path: '%s'\n", full_path); - if (!TWFunc::Path_Exists(full_path)) { - ret_string = Locate_Zip_File(full_path, DataManager_GetCurrentStoragePath()); - if (!ret_string.empty()) { - strcpy(full_path, ret_string.c_str()); - } else if (DataManager_GetIntValue(TW_HAS_DUAL_STORAGE)) { - if (DataManager_GetIntValue(TW_USE_EXTERNAL_STORAGE)) { - LOGI("Zip file not found on external storage, trying internal...\n"); - DataManager_SetIntValue(TW_USE_EXTERNAL_STORAGE, 0); - } else { - LOGI("Zip file not found on internal storage, trying external...\n"); - DataManager_SetIntValue(TW_USE_EXTERNAL_STORAGE, 1); - } - sprintf(full_path, "%s/%s", DataManager_GetCurrentStoragePath(), value); - LOGI("Full zip path: '%s'\n", full_path); - ret_string = Locate_Zip_File(full_path, DataManager_GetCurrentStoragePath()); - if (!ret_string.empty()) - strcpy(full_path, ret_string.c_str()); - } - } - strcpy(value, full_path); - } else { - // Full path given - if (!TWFunc::Path_Exists(value)) { - ret_string = Locate_Zip_File(value, DataManager_GetCurrentStoragePath()); - if (!ret_string.empty()) - strcpy(value, ret_string.c_str()); - } - } - int wipe_cache = 0; - if (!TWFunc::Path_Exists(value)) { - // zip file doesn't exist - ui_print("Unable to locate zip file '%s'.\n", value); - ret_val = 1; - } else { - ui_print("Installing zip file '%s'\n", value); - ret_val = TWinstall_zip(value, &wipe_cache); - } - if (ret_val != 0) { - LOGE("Error installing zip file '%s'\n", value); - ret_val = 1; - } else if (wipe_cache) - PartitionManager.Wipe_By_Path("/cache"); + // Install Zip + ret_val = Install_Command(value); } else if (strcmp(command, "wipe") == 0) { // Wipe if (strcmp(value, "cache") == 0 || strcmp(value, "/cache") == 0) { @@ -207,67 +157,7 @@ int OpenRecoveryScript::run_script_file(void) { strcpy(empt, "(Current Date)"); DataManager_SetStrValue(TW_BACKUP_NAME, empt); } - - DataManager_SetIntValue(TW_BACKUP_SYSTEM_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_DATA_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_CACHE_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_RECOVERY_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_SP1_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_SP2_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_SP3_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_BOOT_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_ANDSEC_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_SDEXT_VAR, 0); - DataManager_SetIntValue(TW_BACKUP_SDEXT_VAR, 0); - DataManager_SetIntValue(TW_USE_COMPRESSION_VAR, 0); - DataManager_SetIntValue(TW_SKIP_MD5_GENERATE_VAR, 0); - - ui_print("Setting backup options:\n"); - line_len = strlen(value1); - for (i=0; i