From 01b6d0c9befc7fb41c989a48d3b0a403aafd6317 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Tue, 22 Jan 2013 01:41:09 +0000 Subject: Convert AOSP commands to ORS for encrypted devices Change-Id: I6a76a51cd9efd7db67d7abeeb26f9bdd0eebf5a9 --- openrecoveryscript.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'openrecoveryscript.cpp') diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp index 8e95555f7..f0efae401 100644 --- a/openrecoveryscript.cpp +++ b/openrecoveryscript.cpp @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include "twrp-functions.hpp" #include "partitions.hpp" @@ -38,15 +40,13 @@ #include "variables.h" #include "adb_install.h" extern "C" { -#include "data.h" -#include "twinstall.h" -#include "gui/gui.h" -int TWinstall_zip(const char* path, int* wipe_cache); + #include "data.h" + #include "twinstall.h" + #include "gui/gui.h" + int TWinstall_zip(const char* path, int* wipe_cache); } extern RecoveryUI* ui; -static const char *SCRIPT_FILE_CACHE = "/cache/recovery/openrecoveryscript"; -static const char *SCRIPT_FILE_TMP = "/tmp/openrecoveryscript"; #define SCRIPT_COMMAND_SIZE 512 int OpenRecoveryScript::check_for_script_file(void) { @@ -378,6 +378,20 @@ int OpenRecoveryScript::run_script_file(void) { return ret_val; } +int OpenRecoveryScript::Insert_ORS_Command(string Command) { + ofstream ORSfile(SCRIPT_FILE_TMP); + if (ORSfile.is_open()) { + //if (Command.substr(Command.size() - 1, 1) != "\n") + // Command += "\n"; + LOGI("Inserting '%s'\n", Command.c_str()); + ORSfile << Command.c_str(); + ORSfile.close(); + return 1; + } + LOGE("Unable to append '%s' to '%s'\n", Command.c_str(), SCRIPT_FILE_TMP); + return 0; +} + int OpenRecoveryScript::Install_Command(string Zip) { // Install zip string ret_string; -- cgit v1.2.3