Merge remote-tracking branch 'origin/android-9.0' into android-10.0
Change-Id: Ie850f431f0d2c39c86b9c10701676a24770ab447
This commit is contained in:
+42
-12
@@ -272,7 +272,7 @@ TWPartition::~TWPartition(void) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error, std::map<string, Flags_Map> *twrp_flags) {
|
||||
bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error, std::map<string, Flags_Map> *twrp_flags, bool Sar_Detect) {
|
||||
char full_line[MAX_FSTAB_LINE_LENGTH];
|
||||
char twflags[MAX_FSTAB_LINE_LENGTH] = "";
|
||||
char* ptr;
|
||||
@@ -309,11 +309,12 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
|
||||
Mount_Point = ptr;
|
||||
if (fstab_version == 2) {
|
||||
additional_entry = PartitionManager.Find_Partition_By_Path(Mount_Point);
|
||||
if (additional_entry) {
|
||||
if (!Sar_Detect && additional_entry) {
|
||||
LOGINFO("Found an additional entry for '%s'\n", Mount_Point.c_str());
|
||||
}
|
||||
}
|
||||
LOGINFO("Processing '%s'\n", Mount_Point.c_str());
|
||||
if(!Sar_Detect)
|
||||
LOGINFO("Processing '%s'\n", Mount_Point.c_str());
|
||||
Backup_Path = Mount_Point;
|
||||
Storage_Path = Mount_Point;
|
||||
Display_Name = ptr + 1;
|
||||
@@ -410,13 +411,16 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
|
||||
if (Primary_Block_Device.find("*") != string::npos)
|
||||
Wildcard_Block_Device = true;
|
||||
|
||||
if (Mount_Point == "auto") {
|
||||
Mount_Point = "/auto";
|
||||
char autoi[5];
|
||||
sprintf(autoi, "%i", auto_index);
|
||||
Mount_Point += autoi;
|
||||
if (Sar_Detect) {
|
||||
if(Is_File_System(Fstab_File_System) && (Mount_Point == "/" || Mount_Point == "/system" || Mount_Point == "/system_root"))
|
||||
Find_Actual_Block_Device();
|
||||
else
|
||||
return true;
|
||||
} else if (Mount_Point == "auto") {
|
||||
Mount_Point = "/auto" + to_string(auto_index);
|
||||
Backup_Path = Mount_Point;
|
||||
Storage_Path = Mount_Point;
|
||||
Backup_Name = Mount_Point.substr(1);
|
||||
auto_index++;
|
||||
Setup_File_System(Display_Error);
|
||||
Display_Name = "Storage";
|
||||
@@ -436,8 +440,10 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
|
||||
} else if (Is_File_System(Fstab_File_System)) {
|
||||
Find_Actual_Block_Device();
|
||||
Setup_File_System(Display_Error);
|
||||
if (Mount_Point == PartitionManager.Get_Android_Root_Path()) {
|
||||
Backup_Name = Display_Name = Mount_Point.substr(1, Mount_Point.size() - 1);
|
||||
if (Mount_Point == "/" || Mount_Point == "/system" || Mount_Point == "/system_root") {
|
||||
Display_Name = "System";
|
||||
Backup_Name = "system";
|
||||
Backup_Display_Name = Display_Name;
|
||||
Storage_Name = Display_Name;
|
||||
Wipe_Available_in_GUI = true;
|
||||
@@ -598,6 +604,19 @@ bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error,
|
||||
}
|
||||
}
|
||||
|
||||
if (Is_File_System(Fstab_File_System) && (Mount_Point == "/" || Mount_Point == "/system" || Mount_Point == "/system_root")) {
|
||||
if (Sar_Detect) {
|
||||
Mount_Point = "/s";
|
||||
Mount_Read_Only = true;
|
||||
Can_Be_Mounted = true;
|
||||
} else {
|
||||
Mount_Point = PartitionManager.Get_Android_Root_Path();
|
||||
Backup_Path = Mount_Point;
|
||||
Storage_Path = Mount_Point;
|
||||
Make_Dir(Mount_Point, Display_Error);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1074,8 +1093,6 @@ void TWPartition::Setup_File_System(bool Display_Error) {
|
||||
|
||||
// Make the mount point folder if it doesn't exist
|
||||
Make_Dir(Mount_Point, Display_Error);
|
||||
Display_Name = Mount_Point.substr(1, Mount_Point.size() - 1);
|
||||
Backup_Name = Display_Name;
|
||||
Backup_Method = BM_FILES;
|
||||
}
|
||||
|
||||
@@ -1525,10 +1542,23 @@ bool TWPartition::Mount(bool Display_Error) {
|
||||
string Command = "mount -o bind '" + Symlink_Path + "' '" + Symlink_Mount_Point + "'";
|
||||
TWFunc::Exec_Cmd(Command);
|
||||
}
|
||||
|
||||
if (Mount_Point == "/system_root") {
|
||||
unlink("/system");
|
||||
mkdir("/system", 0755);
|
||||
mount("/system_root/system", "/system", "auto", MS_BIND, NULL);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TWPartition::UnMount(bool Display_Error) {
|
||||
if (Mount_Point == "/system_root") {
|
||||
if (umount("/system") == -1)
|
||||
umount2("/system", MNT_DETACH);
|
||||
rmdir("/system");
|
||||
symlink("/system_root/system", "/system");
|
||||
}
|
||||
if (Is_Mounted()) {
|
||||
int never_unmount_system;
|
||||
|
||||
@@ -2895,7 +2925,7 @@ bool TWPartition::Find_Wildcard_Block_Devices(const string& Device) {
|
||||
TWPartition *part = new TWPartition;
|
||||
char buffer[MAX_FSTAB_LINE_LENGTH];
|
||||
sprintf(buffer, "%s %s-%i auto defaults defaults", item.c_str(), Mount_Point.c_str(), ++mount_point_index);
|
||||
part->Process_Fstab_Line(buffer, false, NULL);
|
||||
part->Process_Fstab_Line(buffer, false, NULL, false);
|
||||
char display[MAX_FSTAB_LINE_LENGTH];
|
||||
sprintf(display, "%s %i", Storage_Name.c_str(), mount_point_index);
|
||||
part->Storage_Name = display;
|
||||
|
||||
Reference in New Issue
Block a user