summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-10-12 18:15:42 +0200
committerDees_Troy <dees_troy@teamw.in>2012-10-12 18:15:42 +0200
commitd0384ef73e2c241d92c3b5a7ea97f6f66ca7c611 (patch)
treee5f584398315526e900d41ff7221f1343f196d61
parentFix updater binary compile (diff)
downloadandroid_bootable_recovery-d0384ef73e2c241d92c3b5a7ea97f6f66ca7c611.tar
android_bootable_recovery-d0384ef73e2c241d92c3b5a7ea97f6f66ca7c611.tar.gz
android_bootable_recovery-d0384ef73e2c241d92c3b5a7ea97f6f66ca7c611.tar.bz2
android_bootable_recovery-d0384ef73e2c241d92c3b5a7ea97f6f66ca7c611.tar.lz
android_bootable_recovery-d0384ef73e2c241d92c3b5a7ea97f6f66ca7c611.tar.xz
android_bootable_recovery-d0384ef73e2c241d92c3b5a7ea97f6f66ca7c611.tar.zst
android_bootable_recovery-d0384ef73e2c241d92c3b5a7ea97f6f66ca7c611.zip
-rw-r--r--partitionmanager.cpp19
-rw-r--r--partitions.hpp1
-rw-r--r--recovery.cpp1
3 files changed, 21 insertions, 0 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index b3c6adc36..101f6f493 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -86,6 +86,7 @@ int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error)
LOGI("Error creating fstab\n");
}
Update_System_Details();
+ UnMount_Main_Partitions();
return true;
}
@@ -873,6 +874,7 @@ int TWPartitionManager::Run_Backup(void) {
ui_print("[%llu MB TOTAL BACKED UP]\n", actual_backup_size);
Update_System_Details();
+ UnMount_Main_Partitions();
ui_print("[BACKUP COMPLETED IN %d SECONDS]\n\n", total_time); // the end
return true;
}
@@ -1071,6 +1073,7 @@ int TWPartitionManager::Run_Restore(string Restore_Name) {
TWFunc::GUI_Operation_Text(TW_UPDATE_SYSTEM_DETAILS_TEXT, "Updating System Details");
Update_System_Details();
+ UnMount_Main_Partitions();
time(&rStop);
ui_print("[RESTORE COMPLETED IN %d SECONDS]\n\n",(int)difftime(rStop,rStart));
return true;
@@ -1543,6 +1546,7 @@ int TWPartitionManager::Decrypt_Device(string Password) {
// Sleep for a bit so that the device will be ready
sleep(1);
Update_System_Details();
+ UnMount_Main_Partitions();
} else
LOGE("Unable to locate data partition.\n");
}
@@ -1702,6 +1706,21 @@ void TWPartitionManager::Mount_All_Storage(void) {
}
}
+void TWPartitionManager::UnMount_Main_Partitions(void) {
+ // Unmounts system and data if data is not data/media
+ // Also unmounts boot if boot is mountable
+ LOGI("Unmounting main partitions...\n");
+
+ TWPartition* Boot_Partition = Find_Partition_By_Path("/boot");
+
+ UnMount_By_Path("/system", true);
+#ifndef RECOVERY_SDCARD_ON_DATA
+ UnMount_By_Path("/data", true);
+#endif
+ if (Boot_Partition != NULL && Boot_Partition->Can_Be_Mounted)
+ Boot_Partition->UnMount(true);
+}
+
int TWPartitionManager::Partition_SDCard(void) {
char mkdir_path[255], temp[255], line[512];
string Command, Device, fat_str, ext_str, swap_str, start_loc, end_loc, ext_format, sd_path, tmpdevice;
diff --git a/partitions.hpp b/partitions.hpp
index 50757c127..3417b8c41 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -181,6 +181,7 @@ public:
virtual int usb_storage_enable(void); // Enable USB storage mode
virtual int usb_storage_disable(void); // Disable USB storage mode
virtual void Mount_All_Storage(void); // Mounts all storage locations
+ virtual void UnMount_Main_Partitions(void); // Unmounts system and data if not data/media and boot if boot is mountable
virtual int Partition_SDCard(void); // Repartitions the sdcard
virtual int Fix_Permissions();
diff --git a/recovery.cpp b/recovery.cpp
index a58692824..b8fc45f70 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -950,6 +950,7 @@ main(int argc, char **argv) {
system("mv /system/recovery-from-boot.p /system/recovery-from-boot.bak");
ui_print("Renamed stock recovery file in /system to prevent\nthe stock ROM from replacing TWRP.\n");
}
+ PartitionManager.UnMount_By_Path("/system", false);
if (DataManager_GetIntValue(TW_IS_ENCRYPTED) == 0 && OpenRecoveryScript::check_for_script_file()) {
gui_console_only();
if (OpenRecoveryScript::run_script_file() != 0) {