diff --git a/src/veritysetup/veritysetup.c b/src/veritysetup/veritysetup.c index b4cdba6562..50bea8d66b 100644 --- a/src/veritysetup/veritysetup.c +++ b/src/veritysetup/veritysetup.c @@ -4,6 +4,7 @@ #include #include "sd-device.h" +#include "sd-json.h" #include "alloc-util.h" #include "build.h" @@ -11,9 +12,7 @@ #include "dlopen-note.h" #include "extract-word.h" #include "fileio.h" -#include "format-table.h" #include "fstab-util.h" -#include "help-util.h" #include "hexdecoct.h" #include "log.h" #include "main-func.h" @@ -51,26 +50,6 @@ STATIC_DESTRUCTOR_REGISTER(arg_fec_what, freep); STATIC_DESTRUCTOR_REGISTER(arg_root_hash_signature, freep); STATIC_DESTRUCTOR_REGISTER(arg_tpm2_measure_nvpcr, freep); -static int help(void) { - _cleanup_(table_unrefp) Table *verbs = NULL; - int r; - - r = verbs_get_help_table(&verbs); - if (r < 0) - return r; - - help_cmdline("COMMAND ..."); - help_abstract("Attach or detach a verity protected block device."); - - help_section("Commands"); - r = table_print_or_warn(verbs); - if (r < 0) - return r; - - help_man_page_reference("systemd-veritysetup@.service", "8"); - return 0; -} - static int parse_roothashsig_option(const char *option, bool strict) { _cleanup_free_ void *rhs = NULL; size_t rhss = 0; @@ -318,8 +297,14 @@ static int parse_options(const char *options) { return r; } +COMMAND( + "systemd-veritysetup\0", + "Attach or detach a verity-protected block device.", + .man_pages = "systemd-veritysetup@.service.8\0", +); + VERB(verb_attach, "attach", "VOLUME DATADEVICE HASHDEVICE ROOTHASH [OPTIONS]", 5, 6, 0, - "Attach a verity protected block device"); + "Attach a verity-protected block device"); static int verb_attach(int argc, char *argv[], uintptr_t _data, void *userdata) { _cleanup_(crypt_freep) struct crypt_device *cd = NULL; _cleanup_free_ void *rh = NULL; @@ -457,7 +442,7 @@ static int verb_attach(int argc, char *argv[], uintptr_t _data, void *userdata) } VERB(verb_detach, "detach", "VOLUME", 2, 2, 0, - "Detach a verity protected block device"); + "Detach a verity-protected block device"); static int verb_detach(int argc, char *argv[], uintptr_t _data, void *userdata) { _cleanup_(crypt_freep) struct crypt_device *cd = NULL; int r; @@ -486,7 +471,7 @@ static int verb_detach(int argc, char *argv[], uintptr_t _data, void *userdata) return 0; } -VERB_COMMON_HELP_HIDDEN(help); +VERB_COMMON_HELP_AUTO_HIDDEN("systemd-veritysetup"); static int parse_argv(int argc, char *argv[], char ***ret_args) { assert(argc >= 0); @@ -499,7 +484,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) { switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("systemd-veritysetup"); OPTION_COMMON_VERSION: return version();