Convert AOSP commands to ORS for encrypted devices

Change-Id: I6a76a51cd9efd7db67d7abeeb26f9bdd0eebf5a9
This commit is contained in:
Dees_Troy
2013-01-22 01:41:09 +00:00
parent f4499816e3
commit 01b6d0c9be
5 changed files with 76 additions and 21 deletions
+20 -6
View File
@@ -30,6 +30,8 @@
#include <dirent.h>
#include <time.h>
#include <errno.h>
#include <iostream>
#include <fstream>
#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;