blob: 38311959bac3fb3c662401650e2c089f968c2680 [file] [log] [blame]
Dees Troy3be70a82013-10-22 14:25:12 +00001/*
2 Copyright 2012 bigbiff/Dees_Troy TeamWin
3 This file is part of TWRP/TeamWin Recovery Project.
4
5 TWRP is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 TWRP is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with TWRP. If not, see <http://www.gnu.org/licenses/>.
17*/
Dees_Troy812660f2012-09-20 09:55:17 -040018
19#ifndef _OPENRECOVERYSCRIPT_HPP
20#define _OPENRECOVERYSCRIPT_HPP
21
22#include <string>
23
24using namespace std;
25
Dees_Troy812660f2012-09-20 09:55:17 -040026class OpenRecoveryScript
27{
that10ae24f2015-12-26 20:53:51 +010028 typedef void (*VoidFunction)();
29 static VoidFunction call_after_cli_command; // callback to GUI after Run_CLI_Command
30
Dees_Troy812660f2012-09-20 09:55:17 -040031 static int check_for_script_file(); // Checks to see if the ORS file is present in /cache
Ethan Yonker03a42f62014-08-08 11:03:51 -050032 static int copy_script_file(string filename); // Copies a script file to the temp folder
Dees_Troy812660f2012-09-20 09:55:17 -040033 static int run_script_file(); // Executes the commands in the ORS file
Dees_Troy83a3b122012-10-01 14:16:43 -040034 static int Install_Command(string Zip); // Installs a zip
Dees_Troy812660f2012-09-20 09:55:17 -040035 static string Locate_Zip_File(string Path, string File); // Attempts to locate the zip file in storage
Dees_Troy83a3b122012-10-01 14:16:43 -040036 static int Backup_Command(string Options); // Runs a backup
that10ae24f2015-12-26 20:53:51 +010037public:
38 static int Insert_ORS_Command(string Command); // Inserts the Command into the SCRIPT_FILE_TMP file
Dees_Troy6ed34b72013-01-25 15:01:29 +000039 static void Run_OpenRecoveryScript(); // Starts the GUI Page for running OpenRecoveryScript
that10ae24f2015-12-26 20:53:51 +010040 static int Run_OpenRecoveryScript_Action(); // Actually runs the ORS scripts for the GUI action
41 static void Call_After_CLI_Command(VoidFunction fn) { call_after_cli_command = fn; }
42 static void Run_CLI_Command(const char* command); // Runs a command for orscmd (twrp binary)
Dees_Troy812660f2012-09-20 09:55:17 -040043};
44
45#endif // _OPENRECOVERYSCRIPT_HPP