Revert "Implement autodetection for SAR, based on the installed system"
Change-Id: I9e6c549013c1d5564d0a2e369510535e3869dff6
diff --git a/partition.cpp b/partition.cpp
index be01b15..64b461c 100755
--- a/partition.cpp
+++ b/partition.cpp
@@ -274,7 +274,7 @@
// Do nothing
}
-bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error, std::map<string, Flags_Map> *twrp_flags, bool Sar_Detect) {
+bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error, std::map<string, Flags_Map> *twrp_flags) {
char full_line[MAX_FSTAB_LINE_LENGTH];
char twflags[MAX_FSTAB_LINE_LENGTH] = "";
char* ptr;
@@ -320,12 +320,11 @@
Mount_Point = ptr;
if (fstab_version == 2 && Is_Super == false) {
additional_entry = PartitionManager.Find_Partition_By_Path(Mount_Point);
- if (!Sar_Detect && additional_entry) {
+ if (additional_entry) {
LOGINFO("Found an additional entry for '%s'\n", Mount_Point.c_str());
}
}
- if(!Sar_Detect)
- LOGINFO("Processing '%s'\n", Mount_Point.c_str());
+ LOGINFO("Processing '%s'\n", Mount_Point.c_str());
Backup_Path = Mount_Point;
Storage_Path = Mount_Point;
Display_Name = ptr + 1;
@@ -424,13 +423,11 @@
if (Primary_Block_Device.find("*") != string::npos)
Wildcard_Block_Device = true;
- 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);
+ if (Mount_Point == "auto") {
+ Mount_Point = "/auto";
+ char autoi[5];
+ sprintf(autoi, "%i", auto_index);
+ Mount_Point += autoi;
Backup_Path = Mount_Point;
Storage_Path = Mount_Point;
Backup_Name = Mount_Point.substr(1);
@@ -455,13 +452,18 @@
Setup_File_System(Display_Error);
Backup_Name = Display_Name = Mount_Point.substr(1, Mount_Point.size() - 1);
if (Mount_Point == "/" || Mount_Point == "/system" || Mount_Point == "/system_root") {
+ Mount_Point = PartitionManager.Get_Android_Root_Path();
+ Backup_Path = Mount_Point;
+ Storage_Path = Mount_Point;
Display_Name = "System";
Backup_Name = "system";
Backup_Display_Name = Display_Name;
Storage_Name = Display_Name;
- Wipe_Available_in_GUI = true;
- Can_Be_Backed_Up = true;
+ Wipe_Available_in_GUI = false;
+ Can_Be_Backed_Up = false;
+ Can_Be_Wiped = false;
Mount_Read_Only = true;
+ Make_Dir(PartitionManager.Get_Android_Root_Path(), true);
} else if (Mount_Point == "/product") {
Display_Name = "Product";
Backup_Name = "Product";
@@ -629,24 +631,6 @@
}
}
- 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);
- }
- if (Is_Super) {
- Can_Be_Backed_Up = false;
- Can_Be_Wiped = false;
- Wipe_Available_in_GUI = false;
- }
- }
-
return true;
}
@@ -1596,24 +1580,10 @@
string Command = "/system/bin/mount -o bind '" + Symlink_Path + "' '" + Symlink_Mount_Point + "'";
TWFunc::Exec_Cmd(Command);
}
-
- #ifndef TW_NO_BIND_SYSTEM
- if (Mount_Point == "/system_root") {
- unlink("/system");
- mkdir("/system", 0755);
- mount("/system_root/system", "/system", "auto", MS_BIND, NULL);
- }
-#endif
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;
@@ -2960,7 +2930,7 @@
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, false);
+ part->Process_Fstab_Line(buffer, false, NULL);
char display[MAX_FSTAB_LINE_LENGTH];
sprintf(display, "%s %i", Storage_Name.c_str(), mount_point_index);
part->Storage_Name = display;