summaryrefslogtreecommitdiffstats
path: root/openrecoveryscript.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-01-22 02:41:09 +0100
committerDees_Troy <dees_troy@teamw.in>2013-01-24 20:48:08 +0100
commit01b6d0c9befc7fb41c989a48d3b0a403aafd6317 (patch)
tree75c787e08756fff444b7e90c042d5e10a9e3f6b2 /openrecoveryscript.cpp
parentOutput most build flags to log (diff)
downloadandroid_bootable_recovery-01b6d0c9befc7fb41c989a48d3b0a403aafd6317.tar
android_bootable_recovery-01b6d0c9befc7fb41c989a48d3b0a403aafd6317.tar.gz
android_bootable_recovery-01b6d0c9befc7fb41c989a48d3b0a403aafd6317.tar.bz2
android_bootable_recovery-01b6d0c9befc7fb41c989a48d3b0a403aafd6317.tar.lz
android_bootable_recovery-01b6d0c9befc7fb41c989a48d3b0a403aafd6317.tar.xz
android_bootable_recovery-01b6d0c9befc7fb41c989a48d3b0a403aafd6317.tar.zst
android_bootable_recovery-01b6d0c9befc7fb41c989a48d3b0a403aafd6317.zip
Diffstat (limited to 'openrecoveryscript.cpp')
-rw-r--r--openrecoveryscript.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp
index 8e95555f7..f0efae401 100644
--- a/openrecoveryscript.cpp
+++ b/openrecoveryscript.cpp
@@ -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;