summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-06-11 19:22:55 +0200
committerEthan Yonker <dees_troy@teamw.in>2014-06-13 15:57:48 +0200
commit5eac222cfe65ea7458bb715e009841e1d15240c5 (patch)
treeb4178c3427202aea871dad954ef5a8491a9d662e
parentlibtar: don't set parent dir's context when extracting a file (diff)
downloadandroid_bootable_recovery-5eac222cfe65ea7458bb715e009841e1d15240c5.tar
android_bootable_recovery-5eac222cfe65ea7458bb715e009841e1d15240c5.tar.gz
android_bootable_recovery-5eac222cfe65ea7458bb715e009841e1d15240c5.tar.bz2
android_bootable_recovery-5eac222cfe65ea7458bb715e009841e1d15240c5.tar.lz
android_bootable_recovery-5eac222cfe65ea7458bb715e009841e1d15240c5.tar.xz
android_bootable_recovery-5eac222cfe65ea7458bb715e009841e1d15240c5.tar.zst
android_bootable_recovery-5eac222cfe65ea7458bb715e009841e1d15240c5.zip
Diffstat (limited to '')
-rw-r--r--fixPermissions.cpp4
-rw-r--r--partition.cpp20
2 files changed, 21 insertions, 3 deletions
diff --git a/fixPermissions.cpp b/fixPermissions.cpp
index 121fe32fe..b98a8c7f5 100644
--- a/fixPermissions.cpp
+++ b/fixPermissions.cpp
@@ -117,6 +117,10 @@ int fixPermissions::fixDataInternalContexts(void) {
dir = "/data/media/0";
else
dir = "/data/media";
+ if (!TWFunc::Path_Exists(dir)) {
+ LOGINFO("fixDataInternalContexts: '%s' does not exist!\n", dir.c_str());
+ return 0;
+ }
LOGINFO("Fixing %s contexts\n", dir.c_str());
restorecon(dir, &sb);
d = opendir(dir.c_str());
diff --git a/partition.cpp b/partition.cpp
index 699ed9d0c..37654311b 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1081,7 +1081,7 @@ bool TWPartition::UnMount(bool Display_Error) {
}
bool TWPartition::Wipe(string New_File_System) {
- bool wiped = false, update_crypt = false;
+ bool wiped = false, update_crypt = false, recreate_media = true;
int check;
string Layout_Filename = Mount_Point + "/.layout_version";
@@ -1107,6 +1107,7 @@ bool TWPartition::Wipe(string New_File_System) {
if (Has_Data_Media && Current_File_System == New_File_System) {
wiped = Wipe_Data_Without_Wiping_Media();
+ recreate_media = false;
} else {
DataManager::GetValue(TW_RM_RF_VAR, check);
@@ -1162,6 +1163,10 @@ bool TWPartition::Wipe(string New_File_System) {
}
}
}
+
+ if (Mount_Point == "/data" && Has_Data_Media && recreate_media) {
+ Recreate_Media_Folder();
+ }
}
return wiped;
}
@@ -1810,8 +1815,15 @@ bool TWPartition::Restore_Tar(string restore_folder, string Restore_File_System)
return false;
} else {
gui_print("Wiping %s...\n", Display_Name.c_str());
- if (!Wipe(Restore_File_System))
- return false;
+ if (Has_Data_Media && Mount_Point == "/data" && Restore_File_System != Current_File_System) {
+ gui_print("WARNING: This /data backup was made with %s file system!\n", Restore_File_System.c_str());
+ gui_print("The backup may not boot unless you change back to %s.\n", Restore_File_System.c_str());
+ if (!Wipe_Data_Without_Wiping_Media())
+ return false;
+ } else {
+ if (!Wipe(Restore_File_System))
+ return false;
+ }
}
TWFunc::GUI_Operation_Text(TW_RESTORE_TEXT, Backup_Display_Name, "Restoring");
gui_print("Restoring %s...\n", Backup_Display_Name.c_str());
@@ -1980,7 +1992,9 @@ void TWPartition::Recreate_Media_Folder(void) {
#ifdef HAVE_SELINUX
perms.fixDataInternalContexts();
#endif
+ // Toggle mount to ensure that "internal sdcard" gets mounted
PartitionManager.UnMount_By_Path(Symlink_Mount_Point, true);
+ PartitionManager.Mount_By_Path(Symlink_Mount_Point, true);
}
}