diff --git a/init/builtins.cpp b/init/builtins.cpp index 9f3dcc1c6..b4204d8dd 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -712,6 +712,20 @@ int do_sysclktz(int nargs, char **args) return 0; } +int do_verity_load_state(int nargs, char **args) { + if (nargs == 1) { + int mode = -1; + int rc = fs_mgr_load_verity_state(&mode); + + if (rc == 0 && mode == VERITY_MODE_LOGGING) { + action_for_each_trigger("verity-logging", action_add_queue_tail); + } + + return rc; + } + return -1; +} + int do_write(int nargs, char **args) { const char *path = args[1]; diff --git a/init/init_parser.cpp b/init/init_parser.cpp index 61a5e0a74..39323573c 100644 --- a/init/init_parser.cpp +++ b/init/init_parser.cpp @@ -204,6 +204,9 @@ static int lookup_keyword(const char *s) case 'u': if (!strcmp(s, "ser")) return K_user; break; + case 'v': + if (!strcmp(s, "erity_load_state")) return K_verity_load_state; + break; case 'w': if (!strcmp(s, "rite")) return K_write; if (!strcmp(s, "ait")) return K_wait; diff --git a/init/keywords.h b/init/keywords.h index a8f29d131..60931f168 100644 --- a/init/keywords.h +++ b/init/keywords.h @@ -41,6 +41,7 @@ int do_chmod(int nargs, char **args); int do_loglevel(int nargs, char **args); int do_load_persist_props(int nargs, char **args); int do_load_all_props(int nargs, char **args); +int do_verity_load_state(int nargs, char **args); int do_wait(int nargs, char **args); #define __MAKE_KEYWORD_ENUM__ #define KEYWORD(symbol, flags, nargs, func) K_##symbol, @@ -97,6 +98,7 @@ enum { KEYWORD(symlink, COMMAND, 1, do_symlink) KEYWORD(sysclktz, COMMAND, 1, do_sysclktz) KEYWORD(user, OPTION, 0, 0) + KEYWORD(verity_load_state, COMMAND, 0, do_verity_load_state) KEYWORD(wait, COMMAND, 1, do_wait) KEYWORD(write, COMMAND, 2, do_write) KEYWORD(copy, COMMAND, 2, do_copy)