mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +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();
|
||||
|
||||
void post_fs_data(int client) {
|
||||
// ack
|
||||
write_int(client, 0);
|
||||
close(client);
|
||||
|
||||
mutex_guard lock(stage_lock);
|
||||
@ -336,8 +334,6 @@ unblock_init:
|
||||
}
|
||||
|
||||
void late_start(int client) {
|
||||
// ack
|
||||
write_int(client, 0);
|
||||
close(client);
|
||||
|
||||
mutex_guard lock(stage_lock);
|
||||
@ -354,8 +350,6 @@ void late_start(int client) {
|
||||
}
|
||||
|
||||
void boot_complete(int client) {
|
||||
// ack
|
||||
write_int(client, 0);
|
||||
close(client);
|
||||
|
||||
mutex_guard lock(stage_lock);
|
||||
|
@ -81,21 +81,20 @@ int magisk_main(int argc, char *argv[]) {
|
||||
cp_afc(argv[2], argv[3]);
|
||||
return 0;
|
||||
} else if (argv[1] == "--daemon"sv) {
|
||||
int fd = connect_daemon(MainRequest::START_DAEMON, true);
|
||||
close(fd);
|
||||
close(connect_daemon(MainRequest::START_DAEMON, true));
|
||||
return 0;
|
||||
} else if (argv[1] == "--stop"sv) {
|
||||
int fd = connect_daemon(MainRequest::STOP_DAEMON);
|
||||
return read_int(fd);
|
||||
} else if (argv[1] == "--post-fs-data"sv) {
|
||||
int fd = connect_daemon(MainRequest::POST_FS_DATA, true);
|
||||
return read_int(fd);
|
||||
close(connect_daemon(MainRequest::POST_FS_DATA, true));
|
||||
return 0;
|
||||
} else if (argv[1] == "--service"sv) {
|
||||
int fd = connect_daemon(MainRequest::LATE_START, true);
|
||||
return read_int(fd);
|
||||
close(connect_daemon(MainRequest::LATE_START, true));
|
||||
return 0;
|
||||
} else if (argv[1] == "--boot-complete"sv) {
|
||||
int fd = connect_daemon(MainRequest::BOOT_COMPLETE, true);
|
||||
return read_int(fd);
|
||||
close(connect_daemon(MainRequest::BOOT_COMPLETE));
|
||||
return 0;
|
||||
} else if (argv[1] == "--denylist"sv) {
|
||||
return denylist_cli(argc - 1, argv + 1);
|
||||
} else if (argc >= 3 && argv[1] == "--sqlite"sv) {
|
||||
|
@ -29,12 +29,6 @@ constexpr char MAGISK_RC[] =
|
||||
"\n"
|
||||
|
||||
"on property:sys.boot_completed=1\n"
|
||||
" start %4$s\n"
|
||||
"\n"
|
||||
|
||||
"service %4$s %1$s/magisk --boot-complete\n"
|
||||
" user root\n"
|
||||
" seclabel u:r:" SEPOL_PROC_DOMAIN ":s0\n"
|
||||
" oneshot\n"
|
||||
" exec %1$s/magisk --boot-complete\n"
|
||||
"\n"
|
||||
;
|
||||
|
@ -51,12 +51,11 @@ static void patch_init_rc(const char *src, const char *dest, const char *tmp_dir
|
||||
rc_list.clear();
|
||||
|
||||
// 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(ls_svc, sizeof(ls_svc));
|
||||
gen_rand_str(bc_svc, sizeof(bc_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, bc_svc);
|
||||
LOGD("Inject magisk services: [%s] [%s]\n", pfd_svc, ls_svc);
|
||||
fprintf(rc, MAGISK_RC, tmp_dir, pfd_svc, ls_svc);
|
||||
|
||||
fclose(rc);
|
||||
clone_attr(src, dest);
|
||||
|
Loading…
Reference in New Issue
Block a user