mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-15 22:13:11 +00:00
Start Magisk in SAR
This commit is contained in:
@@ -381,6 +381,11 @@ static bool magisk_env() {
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (access(MIRRMNT(system), F_OK) != 0 && access(MIRRMNT(system_root), F_OK) == 0) {
|
||||
// Pre-init mirrors
|
||||
xsymlink(MIRRMNT(system_root) "/system", MIRRMNT(system));
|
||||
VLOGI("link", MIRRMNT(system_root) "/system", MIRRMNT(system));
|
||||
}
|
||||
if (access(MIRRMNT(vendor), F_OK) != 0) {
|
||||
xsymlink(MIRRMNT(system) "/vendor", MIRRMNT(vendor));
|
||||
VLOGI("link", MIRRMNT(system) "/vendor", MIRRMNT(vendor));
|
||||
@@ -606,13 +611,13 @@ void post_fs_data(int client) {
|
||||
|
||||
prepare_modules();
|
||||
|
||||
restorecon();
|
||||
chmod(SECURE_DIR, 0700);
|
||||
|
||||
// Core only mode
|
||||
if (access(DISABLEFILE, F_OK) == 0)
|
||||
core_only();
|
||||
|
||||
restorecon();
|
||||
chmod(SECURE_DIR, 0700);
|
||||
|
||||
collect_modules();
|
||||
|
||||
// Execute module scripts
|
||||
|
@@ -108,6 +108,12 @@ static void main_daemon() {
|
||||
setcon("u:r:" SEPOL_PROC_DOMAIN ":s0");
|
||||
restore_rootcon();
|
||||
|
||||
// Unmount pre-init patches
|
||||
umount2("/init", MNT_DETACH);
|
||||
umount2("/init.rc", MNT_DETACH);
|
||||
umount2("/system/lib/libselinux.so", MNT_DETACH);
|
||||
umount2("/system/lib64/libselinux.so", MNT_DETACH);
|
||||
|
||||
int fd = xopen("/dev/null", O_RDWR | O_CLOEXEC);
|
||||
xdup2(fd, STDOUT_FILENO);
|
||||
xdup2(fd, STDERR_FILENO);
|
||||
|
Reference in New Issue
Block a user