Add more cmdline options and specify as internal API

This commit is contained in:
topjohnwu 2019-02-12 04:05:51 -05:00
parent ed4df87b57
commit b3fd79cbb9

View File

@ -25,9 +25,12 @@
" --list list all available applets\n" " --list list all available applets\n"
" --daemon manually start magisk daemon\n" " --daemon manually start magisk daemon\n"
" --[init trigger] start service for init trigger\n" " --[init trigger] start service for init trigger\n"
"\n"
"Advanced Options (Internal APIs):"
" --unlock-blocks set BLKROSET flag to OFF for all block devices\n" " --unlock-blocks set BLKROSET flag to OFF for all block devices\n"
" --restorecon fix selinux context on Magisk files and folders\n" " --restorecon restore selinux context on Magisk files\n"
" --clone-attr SRC DEST clone permission, owner, and selinux context\n" " --clone-attr SRC DEST clone permission, owner, and selinux context\n"
" --clone SRC DEST clone SRC to DEST\n"
" --sqlite SQL exec SQL to Magisk database\n" " --sqlite SQL exec SQL to Magisk database\n"
"\n" "\n"
"Supported init triggers:\n" "Supported init triggers:\n"
@ -73,6 +76,10 @@ int magisk_main(int argc, char *argv[]) {
if (argc < 4) usage(); if (argc < 4) usage();
clone_attr(argv[2], argv[3]); clone_attr(argv[2], argv[3]);
return 0; return 0;
} else if (strcmp(argv[1], "--clone") == 0) {
if (argc < 4) usage();
cp_afc(argv[2], argv[3]);
return 0;
} else if (strcmp(argv[1], "--daemon") == 0) { } else if (strcmp(argv[1], "--daemon") == 0) {
int fd = connect_daemon(); int fd = connect_daemon();
write_int(fd, DO_NOTHING); write_int(fd, DO_NOTHING);