#include "cryptsetup-util.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"
#include "parse-util.h"
#include "path-util.h"
#include "pcrextend-util.h"
-#include "pretty-print.h"
#include "string-util.h"
#include "strv.h"
#include "tpm2-util.h"
STATIC_DESTRUCTOR_REGISTER(arg_tpm2_measure_nvpcr, freep);
static int help(void) {
- _cleanup_free_ char *link = NULL;
+ _cleanup_(table_unrefp) Table *verbs = NULL;
int r;
- r = terminal_urlify_man("systemd-veritysetup@.service", "8", &link);
+ r = verbs_get_help_table(&verbs);
if (r < 0)
- return log_oom();
+ return r;
- printf("%s attach VOLUME DATADEVICE HASHDEVICE ROOTHASH [OPTIONS]\n"
- "%s detach VOLUME\n\n"
- "Attach or detach a verity protected block device.\n"
- "\nSee the %s for details.\n",
- program_invocation_short_name,
- program_invocation_short_name,
- link);
+ 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;
}
return r;
}
+VERB(verb_attach, "attach", "VOLUME DATADEVICE HASHDEVICE ROOTHASH [OPTIONS]", 5, 6, 0,
+ "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;
return 0;
}
+VERB(verb_detach, "detach", "VOLUME", 2, 2, 0,
+ "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;
umask(0022);
- static const Verb verbs[] = {
- { "attach", 5, 6, 0, verb_attach },
- { "detach", 2, 2, 0, verb_detach },
- {}
- };
-
- return dispatch_verb(argc, argv, verbs, NULL);
+ return dispatch_verb_with_args(strv_skip(argv, 1), /* userdata= */ NULL);
}
DEFINE_MAIN_FUNCTION(run);