mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 23:57:39 +00:00
Don't copy sepolicy.rule to /persist on boot
* This seems to be a logic that has been abandoned for a long time. Now we automatically choose which partition to store sepolicy.rule. Furthermore, touching /persist is what we should avoid doing whenever possible.
This commit is contained in:
parent
013b6e68ec
commit
44f005077d
@ -545,43 +545,32 @@ void magic_mount() {
|
|||||||
auto system = new root_node("system");
|
auto system = new root_node("system");
|
||||||
root->insert(system);
|
root->insert(system);
|
||||||
|
|
||||||
char buf1[4096];
|
char buf[4096];
|
||||||
char buf2[4096];
|
|
||||||
LOGI("* Loading modules\n");
|
LOGI("* Loading modules\n");
|
||||||
for (const auto &m : module_list) {
|
for (const auto &m : module_list) {
|
||||||
auto module = m.data();
|
auto module = m.data();
|
||||||
char *b1 = buf1 + sprintf(buf1, MODULEROOT "/%s/", module);
|
char *b = buf + sprintf(buf, MODULEROOT "/%s/", module);
|
||||||
|
|
||||||
// Read props
|
// Read props
|
||||||
strcpy(b1, "system.prop");
|
strcpy(b, "system.prop");
|
||||||
if (access(buf1, F_OK) == 0) {
|
if (access(buf, F_OK) == 0) {
|
||||||
LOGI("%s: loading [system.prop]\n", module);
|
LOGI("%s: loading [system.prop]\n", module);
|
||||||
load_prop_file(buf1, false);
|
load_prop_file(buf, false);
|
||||||
}
|
|
||||||
|
|
||||||
// Copy sepolicy rules
|
|
||||||
strcpy(b1, "sepolicy.rule");
|
|
||||||
char *b2 = buf2 + sprintf(buf2, "%s/" MIRRDIR "/persist", MAGISKTMP.data());
|
|
||||||
if (access(buf1, F_OK) == 0 && access(buf2, F_OK) == 0) {
|
|
||||||
b2 += sprintf(b2, "/magisk/%s", module);
|
|
||||||
xmkdirs(buf2, 0755);
|
|
||||||
strcpy(b2, "/sepolicy.rule");
|
|
||||||
cp_afc(buf1, buf2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether skip mounting
|
// Check whether skip mounting
|
||||||
strcpy(b1, "skip_mount");
|
strcpy(b, "skip_mount");
|
||||||
if (access(buf1, F_OK) == 0)
|
if (access(buf, F_OK) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Double check whether the system folder exists
|
// Double check whether the system folder exists
|
||||||
strcpy(b1, "system");
|
strcpy(b, "system");
|
||||||
if (access(buf1, F_OK) != 0)
|
if (access(buf, F_OK) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LOGI("%s: loading mount files\n", module);
|
LOGI("%s: loading mount files\n", module);
|
||||||
b1[-1] = '\0';
|
b[-1] = '\0';
|
||||||
int fd = xopen(buf1, O_RDONLY | O_CLOEXEC);
|
int fd = xopen(buf, O_RDONLY | O_CLOEXEC);
|
||||||
system->collect_files(module, fd);
|
system->collect_files(module, fd);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user