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
diff --git a/partition.cpp b/partition.cpp
index 0272708..15fc4e3 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -431,7 +431,7 @@
} else if (Is_File_System(Fstab_File_System)) {
Find_Actual_Block_Device();
Setup_File_System(Display_Error);
- if (Mount_Point == "/system") {
+ if (Mount_Point == PartitionManager.Get_Android_Root_Path()) {
Display_Name = "System";
Backup_Display_Name = Display_Name;
Storage_Name = Display_Name;
@@ -1487,7 +1487,7 @@
int never_unmount_system;
DataManager::GetValue(TW_DONT_UNMOUNT_SYSTEM, never_unmount_system);
- if (never_unmount_system == 1 && Mount_Point == "/system")
+ if (never_unmount_system == 1 && Mount_Point == PartitionManager.Get_Android_Root_Path())
return true; // Never unmount system if you're not supposed to unmount it
if (Is_Storage && MTP_Storage_ID > 0)
@@ -2607,7 +2607,7 @@
ret = true;
#ifdef HAVE_CAPABILITIES
// Restore capabilities to the run-as binary
- if (Mount_Point == "/system" && Mount(true) && TWFunc::Path_Exists("/system/bin/run-as")) {
+ if (Mount_Point == PartitionManager.Get_Android_Root_Path() && Mount(true) && TWFunc::Path_Exists("/system/bin/run-as")) {
struct vfs_cap_data cap_data;
uint64_t capabilities = (1 << CAP_SETUID) | (1 << CAP_SETGID);