mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-26 06:27:24 +00:00
Use exec for boot_complete
This commit is contained in:
parent
99afe7ac07
commit
9c774f96db
@ -274,8 +274,6 @@ static pthread_mutex_t stage_lock = PTHREAD_MUTEX_INITIALIZER;
|
|||||||
extern int disable_deny();
|
extern int disable_deny();
|
||||||
|
|
||||||
void post_fs_data(int client) {
|
void post_fs_data(int client) {
|
||||||
// ack
|
|
||||||
write_int(client, 0);
|
|
||||||
close(client);
|
close(client);
|
||||||
|
|
||||||
mutex_guard lock(stage_lock);
|
mutex_guard lock(stage_lock);
|
||||||
@ -336,8 +334,6 @@ unblock_init:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void late_start(int client) {
|
void late_start(int client) {
|
||||||
// ack
|
|
||||||
write_int(client, 0);
|
|
||||||
close(client);
|
close(client);
|
||||||
|
|
||||||
mutex_guard lock(stage_lock);
|
mutex_guard lock(stage_lock);
|
||||||
@ -354,8 +350,6 @@ void late_start(int client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void boot_complete(int client) {
|
void boot_complete(int client) {
|
||||||
// ack
|
|
||||||
write_int(client, 0);
|
|
||||||
close(client);
|
close(client);
|
||||||
|
|
||||||
mutex_guard lock(stage_lock);
|
mutex_guard lock(stage_lock);
|
||||||
|
@ -81,21 +81,20 @@ int magisk_main(int argc, char *argv[]) {
|
|||||||
cp_afc(argv[2], argv[3]);
|
cp_afc(argv[2], argv[3]);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argv[1] == "--daemon"sv) {
|
} else if (argv[1] == "--daemon"sv) {
|
||||||
int fd = connect_daemon(MainRequest::START_DAEMON, true);
|
close(connect_daemon(MainRequest::START_DAEMON, true));
|
||||||
close(fd);
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (argv[1] == "--stop"sv) {
|
} else if (argv[1] == "--stop"sv) {
|
||||||
int fd = connect_daemon(MainRequest::STOP_DAEMON);
|
int fd = connect_daemon(MainRequest::STOP_DAEMON);
|
||||||
return read_int(fd);
|
return read_int(fd);
|
||||||
} else if (argv[1] == "--post-fs-data"sv) {
|
} else if (argv[1] == "--post-fs-data"sv) {
|
||||||
int fd = connect_daemon(MainRequest::POST_FS_DATA, true);
|
close(connect_daemon(MainRequest::POST_FS_DATA, true));
|
||||||
return read_int(fd);
|
return 0;
|
||||||
} else if (argv[1] == "--service"sv) {
|
} else if (argv[1] == "--service"sv) {
|
||||||
int fd = connect_daemon(MainRequest::LATE_START, true);
|
close(connect_daemon(MainRequest::LATE_START, true));
|
||||||
return read_int(fd);
|
return 0;
|
||||||
} else if (argv[1] == "--boot-complete"sv) {
|
} else if (argv[1] == "--boot-complete"sv) {
|
||||||
int fd = connect_daemon(MainRequest::BOOT_COMPLETE, true);
|
close(connect_daemon(MainRequest::BOOT_COMPLETE));
|
||||||
return read_int(fd);
|
return 0;
|
||||||
} else if (argv[1] == "--denylist"sv) {
|
} else if (argv[1] == "--denylist"sv) {
|
||||||
return denylist_cli(argc - 1, argv + 1);
|
return denylist_cli(argc - 1, argv + 1);
|
||||||
} else if (argc >= 3 && argv[1] == "--sqlite"sv) {
|
} else if (argc >= 3 && argv[1] == "--sqlite"sv) {
|
||||||
|
@ -29,12 +29,6 @@ constexpr char MAGISK_RC[] =
|
|||||||
"\n"
|
"\n"
|
||||||
|
|
||||||
"on property:sys.boot_completed=1\n"
|
"on property:sys.boot_completed=1\n"
|
||||||
" start %4$s\n"
|
" exec %1$s/magisk --boot-complete\n"
|
||||||
"\n"
|
|
||||||
|
|
||||||
"service %4$s %1$s/magisk --boot-complete\n"
|
|
||||||
" user root\n"
|
|
||||||
" seclabel u:r:" SEPOL_PROC_DOMAIN ":s0\n"
|
|
||||||
" oneshot\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
;
|
;
|
||||||
|
@ -51,12 +51,11 @@ static void patch_init_rc(const char *src, const char *dest, const char *tmp_dir
|
|||||||
rc_list.clear();
|
rc_list.clear();
|
||||||
|
|
||||||
// Inject Magisk rc scripts
|
// Inject Magisk rc scripts
|
||||||
char pfd_svc[16], ls_svc[16], bc_svc[16];
|
char pfd_svc[16], ls_svc[16];
|
||||||
gen_rand_str(pfd_svc, sizeof(pfd_svc));
|
gen_rand_str(pfd_svc, sizeof(pfd_svc));
|
||||||
gen_rand_str(ls_svc, sizeof(ls_svc));
|
gen_rand_str(ls_svc, sizeof(ls_svc));
|
||||||
gen_rand_str(bc_svc, sizeof(bc_svc));
|
LOGD("Inject magisk services: [%s] [%s]\n", pfd_svc, ls_svc);
|
||||||
LOGD("Inject magisk services: [%s] [%s] [%s]\n", pfd_svc, ls_svc, bc_svc);
|
fprintf(rc, MAGISK_RC, tmp_dir, pfd_svc, ls_svc);
|
||||||
fprintf(rc, MAGISK_RC, tmp_dir, pfd_svc, ls_svc, bc_svc);
|
|
||||||
|
|
||||||
fclose(rc);
|
fclose(rc);
|
||||||
clone_attr(src, dest);
|
clone_attr(src, dest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user