summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-12-22 19:30:18 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-12-22 19:30:21 +0100
commit3aa66be4f2d5228cf35bad81e5a0a9a59a539678 (patch)
tree485a0412d9e241eab5e5408da2bcf37fe8200ed4
parentopenrecoveryscript: really append ORS command to ORS script file. (diff)
downloadandroid_bootable_recovery-3aa66be4f2d5228cf35bad81e5a0a9a59a539678.tar
android_bootable_recovery-3aa66be4f2d5228cf35bad81e5a0a9a59a539678.tar.gz
android_bootable_recovery-3aa66be4f2d5228cf35bad81e5a0a9a59a539678.tar.bz2
android_bootable_recovery-3aa66be4f2d5228cf35bad81e5a0a9a59a539678.tar.lz
android_bootable_recovery-3aa66be4f2d5228cf35bad81e5a0a9a59a539678.tar.xz
android_bootable_recovery-3aa66be4f2d5228cf35bad81e5a0a9a59a539678.tar.zst
android_bootable_recovery-3aa66be4f2d5228cf35bad81e5a0a9a59a539678.zip
Diffstat (limited to '')
-rw-r--r--twrp.cpp47
1 files changed, 17 insertions, 30 deletions
diff --git a/twrp.cpp b/twrp.cpp
index b33a6ad1a..4f426640c 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -178,8 +178,8 @@ int main(int argc, char **argv) {
PartitionManager.Mount_By_Path("/cache", true);
- string Zip_File, Reboot_Value;
- bool Cache_Wipe = false, Factory_Reset = false, Perform_Backup = false, Shutdown = false;
+ string Reboot_Value;
+ bool Shutdown = false;
{
TWPartition* misc = PartitionManager.Find_Partition_By_Path("/misc");
@@ -213,16 +213,25 @@ int main(int argc, char **argv) {
while (*ptr == '=')
ptr++;
if (*ptr) {
- Zip_File = ptr;
+ string ORSCommand = "install ";
+ ORSCommand.append(ptr);
+
+ if (!OpenRecoveryScript::Insert_ORS_Command(ORSCommand))
+ break;
} else
LOGERR("argument error specifying zip file\n");
} else if (*argptr == 'w') {
- if (len == 9)
- Factory_Reset = true;
- else if (len == 10)
- Cache_Wipe = true;
+ if (len == 9) {
+ if (!OpenRecoveryScript::Insert_ORS_Command("wipe data\n"))
+ break;
+ } else if (len == 10) {
+ if (!OpenRecoveryScript::Insert_ORS_Command("wipe cache\n"))
+ break;
+ }
} else if (*argptr == 'n') {
- Perform_Backup = true;
+ DataManager::SetValue(TW_BACKUP_NAME, gui_parse_text("{@auto_generate}"));
+ if (!OpenRecoveryScript::Insert_ORS_Command("backup BSDCAE\n"))
+ break;
} else if (*argptr == 'p') {
Shutdown = true;
} else if (*argptr == 's') {
@@ -262,28 +271,6 @@ int main(int argc, char **argv) {
LOGINFO("Backup of TWRP ramdisk done.\n");
#endif
- bool Keep_Going = true;
- if (Perform_Backup) {
- DataManager::SetValue(TW_BACKUP_NAME, "(Auto Generate)");
- if (!OpenRecoveryScript::Insert_ORS_Command("backup BSDCAE\n"))
- Keep_Going = false;
- }
- if (Keep_Going && !Zip_File.empty()) {
- string ORSCommand = "install " + Zip_File;
-
- if (!OpenRecoveryScript::Insert_ORS_Command(ORSCommand))
- Keep_Going = false;
- }
- if (Keep_Going) {
- if (Factory_Reset) {
- if (!OpenRecoveryScript::Insert_ORS_Command("wipe data\n"))
- Keep_Going = false;
- } else if (Cache_Wipe) {
- if (!OpenRecoveryScript::Insert_ORS_Command("wipe cache\n"))
- Keep_Going = false;
- }
- }
-
TWFunc::Update_Log_File();
// Offer to decrypt if the device is encrypted
if (DataManager::GetIntValue(TW_IS_ENCRYPTED) != 0) {