Update help message

This commit is contained in:
topjohnwu 2017-08-15 00:42:32 +08:00
parent a0be47ab8b
commit 93b66d26ff

View File

@ -12,48 +12,59 @@ static char err_msg[ARG_MAX];
static void statements() { static void statements() {
fprintf(stderr, fprintf(stderr,
"\nSupported policy statements:\n" "Policy statements should be enclosed by quotes in command-line;\n"
"the whole statement should be treated as a single parameter.\n"
"\n" "\n"
"\"allow #source-class #target-class permission-class #permission\"\n" "The statements has a format of \"<action> [args...]\"\n"
"\"deny #source-class #target-class permission-class #permission\"\n" "Use '*' in args to represent every possible match.\n"
"\"auditallow #source-class #target-class permission-class #permission\"\n" "Collections wrapped in curly brackets can also be used as args.\n"
"\"auditdeny #source-class #target-class permission-class #permission\"\n" "\n"
"Supported policy statements:\n"
"\n"
"Type 1:\n"
"\"<action> source-class target-class permission-class permission\"\n"
"Action: allow, deny, auditallow, auditdeny\n"
"\n"
"Type 2:\n"
"\"<action> source-class target-class permission-class ioctl range\"\n"
"Action: allowxperm, auditallowxperm, dontauditxperm\n"
"\n"
"Type 3:\n"
"\"<action> class\"\n"
"Action: create, permissive, enforcing\n"
"\n"
"Type 4:\n"
"\"attradd class attribute\"\n"
"\n"
"Type 5:\n"
"\"typetrans source-class target-class permission-class default-class (optional: object-name)\"\n" "\"typetrans source-class target-class permission-class default-class (optional: object-name)\"\n"
"\"allowxperm #source-class #target-class #permission-class ioctl range\"\n" "\n"
"\"auditallowxperm #source-class #target-class #permission-class ioctl range\"\n" "Notes:\n"
"\"dontauditxperm #source-class #target-class #permission-class ioctl range\"\n" "- typetrans does not support the all match '*' syntax\n"
"\"create #class\"\n" "- permission-class cannot be collections\n"
"\"permissive #class\"\n" "- source-class and target-class can also be attributes\n"
"\"enforcing #class\"\n" "\n"
"\"attradd #class #attribute\"\n" "Example: allow { source1 source2 } { target1 target2 } permission-class *\n"
"\nsource-class and target-class can be attributes (patches the whole group)\n"
"All sections (except typetrans) can be replaced with \'*\' to patch every possible matches\n"
"Sections marked with \'#\' can be replaced with collections in curly brackets\n"
"e.g: allow { source1 source2 } { target1 target2 } permission-class { permission1 permission2 }\n"
"Will be expanded to:\n" "Will be expanded to:\n"
"allow source1 target1 permission-class permission1\n" "\n"
"allow source1 target1 permission-class permission2\n" "allow source1 target1 permission-class { all-permissions }\n"
"allow source1 target2 permission-class permission1\n" "allow source1 target2 permission-class { all-permissions }\n"
"allow source1 target2 permission-class permission2\n" "allow source2 target1 permission-class { all-permissions }\n"
"allow source2 target1 permission-class permission1\n" "allow source2 target2 permission-class { all-permissions }\n"
"allow source2 target1 permission-class permission2\n"
"allow source2 target2 permission-class permission1\n"
"allow source2 target2 permission-class permission2\n"
"\n" "\n"
); );
} }
static void usage(char *arg0) { static void usage(char *arg0) {
fprintf(stderr, fprintf(stderr,
"MagiskPolicy v" xstr(MAGISK_VERSION) "(" xstr(MAGISK_VER_CODE) ") (by topjohnwu & phh) - SEPolicy Modification Tool\n\n" "MagiskPolicy v" xstr(MAGISK_VERSION) "(" xstr(MAGISK_VER_CODE) ") (by topjohnwu & phh) - sepolicy Modification Tool\n\n"
"%s [--options...] [policystatements...]\n\n" "Usage: %s [--options...] [policystatements...]\n\n"
"Options:\n" "Options:\n"
" --live: directly load patched policy to device\n" " --live directly load patched policy to device\n"
// " --magisk: complete (very large!) patches for Magisk and MagiskSU\n" " --minimal minimal patches, used for boot image patches\n"
" --minimal: minimal patches, used for boot image patches\n" " --load <infile> load policies from <infile>\n"
" --load <infile>: load policies from <infile>\n" " (load from live policies if not specified)\n"
" (load from current policies if not specified)\n" " --save <outfile> save policies to <outfile>\n\n"
" --save <outfile>: save policies to <outfile>\n"
, arg0); , arg0);
statements(); statements();
exit(1); exit(1);