From 19874f14699edf411951a62f5ac880ca6a84d824 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Tue, 8 Jan 2019 20:06:57 -0500 Subject: AB/Non AB Devices: updates for moving cache This patchset updates all the places we touch cache on AB devices and non AB devices so that we can write to the appropriate location. AB devices removed the cache partition and moved it to /data/cache. Change-Id: I485ec205a604f1f07ceb7700ae9c4e720fd55c3e --- openrecoveryscript.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) mode change 100644 => 100755 openrecoveryscript.cpp (limited to 'openrecoveryscript.cpp') diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp old mode 100644 new mode 100755 index 86c90a662..d4d4da514 --- a/openrecoveryscript.cpp +++ b/openrecoveryscript.cpp @@ -62,17 +62,18 @@ OpenRecoveryScript::VoidFunction OpenRecoveryScript::call_after_cli_command; #define SCRIPT_COMMAND_SIZE 512 int OpenRecoveryScript::check_for_script_file(void) { - if (!PartitionManager.Mount_By_Path(SCRIPT_FILE_CACHE, false)) { - LOGINFO("Unable to mount /cache for OpenRecoveryScript support.\n"); - gui_msg(Msg(msg::kError, "unable_to_mount=Unable to mount {1}")(SCRIPT_FILE_CACHE)); + std::string orsFile = TWFunc::get_cache_dir() + "/recovery/openrecoveryscript"; + if (!PartitionManager.Mount_By_Path(orsFile, false)) { + LOGINFO("Unable to mount %s for OpenRecoveryScript support.\n", TWFunc::get_cache_dir().c_str()); + gui_msg(Msg(msg::kError, "unable_to_mount=Unable to mount {1}")(TWFunc::get_cache_dir())); return 0; } - if (TWFunc::Path_Exists(SCRIPT_FILE_CACHE)) { - LOGINFO("Script file found: '%s'\n", SCRIPT_FILE_CACHE); + if (TWFunc::Path_Exists(orsFile)) { + LOGINFO("Script file found: '%s'\n", orsFile.c_str()); // Copy script file to /tmp - TWFunc::copy_file(SCRIPT_FILE_CACHE, SCRIPT_FILE_TMP, 0755); - // Delete the file from /cache - unlink(SCRIPT_FILE_CACHE); + TWFunc::copy_file(orsFile, SCRIPT_FILE_TMP, 0755); + // Delete the file from cache + unlink(orsFile.c_str()); return 1; } return 0; @@ -655,6 +656,10 @@ void OpenRecoveryScript::Run_CLI_Command(const char* command) { gui_msg("decrypt_cmd=Attempting to decrypt data partition via command line."); if (PartitionManager.Decrypt_Device(pass) == 0) { // set_page_done = 1; // done by singleaction_page anyway + std::string orsFile = TWFunc::get_cache_dir() + "/openrecoveryscript"; + if (TWFunc::Path_Exists(orsFile)) { + Run_OpenRecoveryScript_Action(); + } } } else if (OpenRecoveryScript::Insert_ORS_Command(command)) { OpenRecoveryScript::run_script_file(); -- cgit v1.2.3