From 9d6feb53115e2dcc49a644400da4d62a16c1c3c6 Mon Sep 17 00:00:00 2001 From: Captain Throwback Date: Fri, 27 Jul 2018 10:05:24 -0400 Subject: 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 --- gui/action.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'gui') diff --git a/gui/action.cpp b/gui/action.cpp index fb05d77b4..d708dd467 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -1819,14 +1819,14 @@ int GUIAction::checkpartitionlifetimewrites(std::string arg) int GUIAction::mountsystemtoggle(std::string arg) { int op_status = 0; - bool remount_system = PartitionManager.Is_Mounted_By_Path("/system"); + bool remount_system = PartitionManager.Is_Mounted_By_Path(PartitionManager.Get_Android_Root_Path()); bool remount_vendor = PartitionManager.Is_Mounted_By_Path("/vendor"); operation_start("Toggle System Mount"); - if (!PartitionManager.UnMount_By_Path("/system", true)) { + if (!PartitionManager.UnMount_By_Path(PartitionManager.Get_Android_Root_Path(), true)) { op_status = 1; // fail } else { - TWPartition* Part = PartitionManager.Find_Partition_By_Path("/system"); + TWPartition* Part = PartitionManager.Find_Partition_By_Path(PartitionManager.Get_Android_Root_Path()); if (Part) { if (arg == "0") { DataManager::SetValue("tw_mount_system_ro", 0); @@ -1910,9 +1910,9 @@ int GUIAction::checkforapp(std::string arg __unused) DataManager::SetValue("tw_app_install_status", 1); // 0 = no status, 1 = not installed, 2 = already installed or do not install goto exit; } - if (PartitionManager.Mount_By_Path("/system", false)) { - string base_path = "/system"; - if (TWFunc::Path_Exists("/system/system")) + if (PartitionManager.Mount_By_Path(PartitionManager.Get_Android_Root_Path(), false)) { + string base_path = PartitionManager.Get_Android_Root_Path(); + if (TWFunc::Path_Exists(PartitionManager.Get_Android_Root_Path() + "/system")) base_path += "/system"; // For devices with system as a root file system (e.g. Pixel) string install_path = base_path + "/priv-app"; if (!TWFunc::Path_Exists(install_path)) @@ -2007,9 +2007,9 @@ int GUIAction::installapp(std::string arg __unused) sync(); } } else { - if (PartitionManager.Mount_By_Path("/system", true)) { - string base_path = "/system"; - if (TWFunc::Path_Exists("/system/system")) + if (PartitionManager.Mount_By_Path(PartitionManager.Get_Android_Root_Path(), true)) { + string base_path = PartitionManager.Get_Android_Root_Path(); + if (TWFunc::Path_Exists(PartitionManager.Get_Android_Root_Path() + "/system")) base_path += "/system"; // For devices with system as a root file system (e.g. Pixel) string install_path = base_path + "/priv-app"; string context = "u:object_r:system_file:s0"; @@ -2034,7 +2034,7 @@ int GUIAction::installapp(std::string arg __unused) } sync(); sync(); - PartitionManager.UnMount_By_Path("/system", true); + PartitionManager.UnMount_By_Path(PartitionManager.Get_Android_Root_Path(), true); op_status = 0; } else { LOGERR("Error making app directory '%s': %s\n", strerror(errno)); -- cgit v1.2.3