apex: mount up apex files into /sbin for library access
This patch uses the loop device to mount files under
/sbin/ from /system/apex in order for the device to
use libraries or other files store inside these files.
Each apex file is mounted over a loop device into a
directory correpsonding to the apex filename under
/sbin/.
Once apex mounting is completed, TWRP will set a
property twrp.apex.loaded to true so that init
can use them as a LD_LIBARY_PATH source.
Change-Id: I69f14a969123ac9cf1afc85b6cf76836cb092fb2
Change-Id: Ica6a7d8e479bcaec8bec4483b5e8d2b45ee105fb
diff --git a/twrp.cpp b/twrp.cpp
index 6d6e5ba..1b97f0b 100755
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -51,6 +51,7 @@
#include "openrecoveryscript.hpp"
#include "variables.h"
#include "twrpAdbBuFifo.hpp"
+#include "twrpApex.hpp"
#ifdef TW_USE_NEW_MINADBD
// #include "minadbd/minadbd.h"
#else
@@ -376,12 +377,17 @@
// Check if system has never been changed
TWPartition* sys = PartitionManager.Find_Partition_By_Path(PartitionManager.Get_Android_Root_Path());
TWPartition* ven = PartitionManager.Find_Partition_By_Path("/vendor");
-
if (sys) {
if (sys->Get_Super_Status()) {
if (!PartitionManager.Prepare_All_Super_Volumes()) {
LOGERR("Unable to prepare super volumes.\n");
}
+ sys->Mount(true);
+ twrpApex apex;
+ if (!apex.loadApexImages()) {
+ LOGERR("Unable to load apex images from %s\n", APEX_DIR);
+ }
+ property_set("twrp.apex.loaded", "true");
} else {
if ((DataManager::GetIntValue("tw_mount_system_ro") == 0 && sys->Check_Lifetime_Writes() == 0) || DataManager::GetIntValue("tw_mount_system_ro") == 2) {
if (DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) {