Add separate product partition support
This commit is contained in:
parent
f1112fdf37
commit
e8b73ba6d1
@ -88,12 +88,14 @@ node_entry::~node_entry() {
|
||||
delete node;
|
||||
}
|
||||
|
||||
#define SPECIAL_NODE (parent->parent ? false : (name == "vendor" || name == "product"))
|
||||
|
||||
bool node_entry::is_special() {
|
||||
return parent ? (parent->parent ? false : name == "vendor") : false;
|
||||
return parent ? SPECIAL_NODE : false;
|
||||
}
|
||||
|
||||
bool node_entry::is_root() {
|
||||
return parent ? (parent->parent ? false : name == "vendor") : true;
|
||||
return parent ? SPECIAL_NODE : true;
|
||||
}
|
||||
|
||||
string node_entry::get_path() {
|
||||
@ -374,6 +376,8 @@ static bool magisk_env() {
|
||||
mount_mirror(system, MS_RDONLY);
|
||||
} else if (DIR_IS(vendor)) {
|
||||
mount_mirror(vendor, MS_RDONLY);
|
||||
} else if (DIR_IS(product)) {
|
||||
mount_mirror(product, MS_RDONLY);
|
||||
} else if (DIR_IS(data) && me->mnt_type != "tmpfs"sv) {
|
||||
mount_mirror(data, 0);
|
||||
} else if (SDK_INT >= 24 && DIR_IS(proc) && !strstr(me->mnt_opts, "hidepid=2")) {
|
||||
@ -661,6 +665,13 @@ void post_fs_data(int client) {
|
||||
unlink(buf2);
|
||||
xsymlink(buf, buf2);
|
||||
}
|
||||
// If /system/product exists in module, create a link outside
|
||||
snprintf(buf, PATH_MAX, "%s/%s/system/product", MODULEROOT, module);
|
||||
if (access(buf, F_OK) == 0) {
|
||||
snprintf(buf2, PATH_MAX, "%s/%s/product", MODULEROOT, module);
|
||||
unlink(buf2);
|
||||
xsymlink(buf, buf2);
|
||||
}
|
||||
sys_root->create_module_tree(module);
|
||||
}
|
||||
|
||||
@ -671,6 +682,10 @@ void post_fs_data(int client) {
|
||||
special->magic_mount();
|
||||
delete special;
|
||||
}
|
||||
if ((special = sys_root->extract("product"))) {
|
||||
special->magic_mount();
|
||||
delete special;
|
||||
}
|
||||
|
||||
sys_root->magic_mount();
|
||||
}
|
||||
|
@ -201,9 +201,9 @@ void SARCommon::patch_rootdir() {
|
||||
sbin_overlay(self, config);
|
||||
|
||||
// Mount system_root mirror
|
||||
xmkdir(MIRRDIR, 0777);
|
||||
xmkdir(ROOTMIR, 0777);
|
||||
xmkdir(BLOCKDIR, 0777);
|
||||
xmkdir(MIRRDIR, 0);
|
||||
xmkdir(ROOTMIR, 0755);
|
||||
xmkdir(BLOCKDIR, 0);
|
||||
mknod(ROOTBLK, S_IFBLK | 0600, system_dev);
|
||||
if (xmount(ROOTBLK, ROOTMIR, "ext4", MS_RDONLY, nullptr))
|
||||
xmount(ROOTBLK, ROOTMIR, "erofs", MS_RDONLY, nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user