ors: Implement 'twrp format data' to format the data partition
Change-Id: Ic01685602a47d0b468616e3d5c3f26a44313cdc8
diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp
index 7a211ac..d89ab8b 100755
--- a/openrecoveryscript.cpp
+++ b/openrecoveryscript.cpp
@@ -165,6 +165,14 @@
LOGERR("Error with wipe command value: '%s'\n", value);
ret_val = 1;
}
+ } else if (strcmp(command, "format") == 0) {
+ // Format
+ if (strcmp(value, "data") == 0 || strcmp(value, "/data") == 0 || strcmp(value, "factory") == 0 || strcmp(value, "factoryreset") == 0) {
+ PartitionManager.Format_Data();
+ } else {
+ LOGERR("Error with format command value: '%s'\n", value);
+ ret_val = 1;
+ }
} else if (strcmp(command, "backup") == 0) {
// Backup
DataManager::SetValue("tw_action_text2", gui_parse_text("{@backing}"));
diff --git a/orscmd/orscmd.cpp b/orscmd/orscmd.cpp
index 0a12a08..62fefd4 100644
--- a/orscmd/orscmd.cpp
+++ b/orscmd/orscmd.cpp
@@ -43,6 +43,7 @@
printf(" backup <SDCRBAEM> [backupname]\n");
printf(" restore <SDCRBAEM> [backupname]\n");
printf(" wipe <partition name>\n");
+ printf(" format data\n");
printf(" sideload\n");
printf(" set <variable> [value]\n");
printf(" decrypt <password> [USER ID]\n");