twrp: use ANDROID_ROOT environment variable
instead of hard-coded /system path I updated most of the references I found, but there might be more For devices that have to mount system at /system_root, this allows system to be bind mounted to /system and detected properly by TWRP Change-Id: I9f142fd8cec392f5b88e95476258dab9c21a9aac
This commit is contained in:
committed by
Captain Throwback
parent
58f2132bc3
commit
9d6feb5311
+10
-3
@@ -1104,7 +1104,7 @@ int TWPartitionManager::Run_Restore(const string& Restore_Name) {
|
||||
}
|
||||
}
|
||||
TWFunc::GUI_Operation_Text(TW_UPDATE_SYSTEM_DETAILS_TEXT, gui_parse_text("{@updating_system_details}"));
|
||||
UnMount_By_Path("/system", false);
|
||||
UnMount_By_Path(Get_Android_Root_Path(), false);
|
||||
Update_System_Details();
|
||||
UnMount_Main_Partitions();
|
||||
time(&rStop);
|
||||
@@ -1490,7 +1490,7 @@ void TWPartitionManager::Update_System_Details(void) {
|
||||
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
|
||||
(*iter)->Update_Size(true);
|
||||
if ((*iter)->Can_Be_Mounted) {
|
||||
if ((*iter)->Mount_Point == "/system") {
|
||||
if ((*iter)->Mount_Point == Get_Android_Root_Path()) {
|
||||
int backup_display_size = (int)((*iter)->Backup_Size / 1048576LLU);
|
||||
DataManager::SetValue(TW_BACKUP_SYSTEM_SIZE, backup_display_size);
|
||||
} else if ((*iter)->Mount_Point == "/data" || (*iter)->Mount_Point == "/datadata") {
|
||||
@@ -1859,7 +1859,7 @@ void TWPartitionManager::UnMount_Main_Partitions(void) {
|
||||
|
||||
TWPartition* Boot_Partition = Find_Partition_By_Path("/boot");
|
||||
|
||||
UnMount_By_Path("/system", true);
|
||||
UnMount_By_Path(Get_Android_Root_Path(), true);
|
||||
if (!datamedia)
|
||||
UnMount_By_Path("/data", true);
|
||||
|
||||
@@ -2726,6 +2726,13 @@ string TWPartitionManager::Get_Active_Slot_Display() {
|
||||
return Active_Slot_Display;
|
||||
}
|
||||
|
||||
string TWPartitionManager::Get_Android_Root_Path() {
|
||||
std::string Android_Root = getenv("ANDROID_ROOT");
|
||||
if (Android_Root == "")
|
||||
Android_Root = "/system";
|
||||
return Android_Root;
|
||||
}
|
||||
|
||||
void TWPartitionManager::Remove_Uevent_Devices(const string& Mount_Point) {
|
||||
std::vector<TWPartition*>::iterator iter;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user