Fix fail over to vfat from exfat

Fix issues with MD5 checking using chdir and leaving the working
dir in a subfolder that prevented unmounting sometimes.

Change-Id: I01a563d722f474297ed3f7a30064c3a61748ade3
This commit is contained in:
Dees_Troy
2013-02-01 16:56:34 +00:00
parent dc771da4fb
commit 3f5c4e8dfe
4 changed files with 69 additions and 40 deletions
+5 -5
View File
@@ -485,8 +485,7 @@ bool TWPartitionManager::Make_MD5(bool generate_md5, string Backup_Folder, strin
ui_print(" * Generating md5...\n");
if (TWFunc::Path_Exists(Full_File)) {
command = "md5sum " + Backup_Filename + " > " + Backup_Filename + ".md5";
chdir(Backup_Folder.c_str());
command = "cd '" + Backup_Folder + "' && md5sum '" + Backup_Filename + "' > '" + Backup_Filename + ".md5'";
if (TWFunc::Exec_Cmd(command, result) == 0) {
ui_print(" * MD5 Created.\n");
return true;
@@ -503,8 +502,7 @@ bool TWPartitionManager::Make_MD5(bool generate_md5, string Backup_Folder, strin
intToStr << index;
ostringstream fn;
fn << setw(3) << setfill('0') << intToStr.str();
command = "md5sum " + Backup_Filename + fn.str() + " >" + Backup_Filename + fn.str() + ".md5";
chdir(Backup_Folder.c_str());
command = "cd '" + Backup_Folder + "' && md5sum '" + Backup_Filename + fn.str() + "' > '" + Backup_Filename + fn.str() + ".md5'";
if (TWFunc::Exec_Cmd(command, result) != 0) {
ui_print(" * MD5 Error.\n");
return false;
@@ -887,7 +885,9 @@ int TWPartitionManager::Run_Backup(void) {
Update_System_Details();
UnMount_Main_Partitions();
ui_print("[BACKUP COMPLETED IN %d SECONDS]\n\n", total_time); // the end
return true;
string backup_log = Full_Backup_Path + "recovery.log";
TWFunc::copy_file("/tmp/recovery.log", backup_log, 0644);
return true;
}
bool TWPartitionManager::Restore_Partition(TWPartition* Part, string Restore_Name, int partition_count) {