summaryrefslogtreecommitdiffstats
path: root/gui/action.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-09-27 18:38:38 +0200
committerDees_Troy <dees_troy@teamw.in>2012-09-27 18:40:09 +0200
commit9350b8d6ed0100c6a1a613207841629fa6303928 (patch)
tree42d90eccc39b95c27e0272c547e42f24fff4781d /gui/action.cpp
parentPort backup name checking to Partition Manager (diff)
downloadandroid_bootable_recovery-9350b8d6ed0100c6a1a613207841629fa6303928.tar
android_bootable_recovery-9350b8d6ed0100c6a1a613207841629fa6303928.tar.gz
android_bootable_recovery-9350b8d6ed0100c6a1a613207841629fa6303928.tar.bz2
android_bootable_recovery-9350b8d6ed0100c6a1a613207841629fa6303928.tar.lz
android_bootable_recovery-9350b8d6ed0100c6a1a613207841629fa6303928.tar.xz
android_bootable_recovery-9350b8d6ed0100c6a1a613207841629fa6303928.tar.zst
android_bootable_recovery-9350b8d6ed0100c6a1a613207841629fa6303928.zip
Diffstat (limited to '')
-rw-r--r--gui/action.cpp72
1 files changed, 4 insertions, 68 deletions
diff --git a/gui/action.cpp b/gui/action.cpp
index 4c3d88ed3..afa52d1f8 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -29,7 +29,6 @@ extern "C" {
#include "../common.h"
#include "../minuitwrp/minui.h"
#include "../recovery_ui.h"
-#include "../extra-functions.h"
#include "../variables.h"
#include "../twinstall.h"
@@ -825,6 +824,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
if (function == "partitionsd")
{
operation_start("Partition SD Card");
+ int ret_val = 0;
if (simulate) {
simulate_progress_bar();
@@ -834,75 +834,11 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
if (allow_partition == 0) {
ui_print("This device does not have a real SD Card!\nAborting!\n");
} else {
- // Below seen in Koush's recovery
- char sddevice[256];
- char mkdir_path[255];
-#ifdef TW_EXTERNAL_STORAGE_PATH
- TWPartition* SDCard = PartitionManager.Find_Partition_By_Path(EXPAND(TW_EXTERNAL_STORAGE_PATH));
-#else
- TWPartition* SDCard = PartitionManager.Find_Partition_By_Path("/sdcard");
-#endif
- if (SDCard == NULL) {
- LOGE("Unable to locate device to partition.\n");
- operation_end(1, simulate);
- return 0;
- }
- strcpy(sddevice, SDCard->Actual_Block_Device.c_str());
- // Just need block not whole partition
- sddevice[strlen("/dev/block/mmcblkX")] = '\0';
-
- char es[64];
- std::string ext_format, sd_path;
- int ext, swap;
- DataManager::GetValue("tw_sdext_size", ext);
- DataManager::GetValue("tw_swap_size", swap);
- DataManager::GetValue("tw_sdpart_file_system", ext_format);
- sprintf(es, "/sbin/sdparted -es %dM -ss %dM -efs ext3 -s > /cache/part.log",ext,swap);
- LOGI("\nrunning script: %s\n", es);
- run_script("\nContinue partitioning?",
- "\nPartitioning sdcard : ",
- es,
- "\nunable to execute parted!\n(%s)\n",
- "\nOops... something went wrong!\nPlease check the recovery log!\n",
- "\nPartitioning complete!\n\n",
- "\nPartitioning aborted!\n\n", 0);
-
- // recreate TWRP folder and rewrite settings - these will be gone after sdcard is partitioned
-#ifdef TW_EXTERNAL_STORAGE_PATH
- PartitionManager.Mount_By_Path(EXPAND(TW_EXTERNAL_STORAGE_PATH), 1);
- DataManager::GetValue(TW_EXTERNAL_PATH, sd_path);
- memset(mkdir_path, 0, sizeof(mkdir_path));
- sprintf(mkdir_path, "%s/TWRP", sd_path.c_str());
-#else
- PartitionManager.Mount_By_Path("/sdcard", 1);
- strcpy(mkdir_path, "/sdcard/TWRP");
-#endif
- mkdir(mkdir_path, 0777);
- DataManager::Flush();
-#ifdef TW_EXTERNAL_STORAGE_PATH
- DataManager::SetValue(TW_ZIP_EXTERNAL_VAR, EXPAND(TW_EXTERNAL_STORAGE_PATH));
- if (DataManager::GetIntValue(TW_USE_EXTERNAL_STORAGE) == 1)
- DataManager::SetValue(TW_ZIP_LOCATION_VAR, EXPAND(TW_EXTERNAL_STORAGE_PATH));
-#else
- DataManager::SetValue(TW_ZIP_EXTERNAL_VAR, "/sdcard");
- if (DataManager::GetIntValue(TW_USE_EXTERNAL_STORAGE) == 1)
- DataManager::SetValue(TW_ZIP_LOCATION_VAR, "/sdcard");
-#endif
- // This is sometimes needed to make a healthy ext4 partition
- if (ext > 0 && strcmp(ext_format.c_str(), "ext4") == 0) {
- char command[256];
- LOGE("Fix this format command!\n");
- //sprintf(command, "mke2fs -t ext4 -m 0 %s", sde.blk);
- ui_print("Formatting sd-ext as ext4...\n");
- LOGI("Formatting sd-ext after partitioning, command: '%s'\n", command);
- system(command);
- ui_print("DONE\n");
- }
-
- PartitionManager.Update_System_Details();
+ if (!PartitionManager.Partition_SDCard())
+ ret_val = 1; // failed
}
}
- operation_end(0, simulate);
+ operation_end(ret_val, simulate);
return 0;
}
if (function == "installhtcdumlock")