From 5d5e43cc33637a12f743f17294cfbd3ede08a1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 31 Jul 2021 09:00:11 +0200 Subject: [PATCH 1/2] veritysetup: print help for --help/-h/help In general our commands print help on --help, but here this would trigger the error that two arguments are needed. Let's make this more user-friendly. --- src/veritysetup/veritysetup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/veritysetup/veritysetup.c b/src/veritysetup/veritysetup.c index 34208dcd876..14d7462ddbc 100644 --- a/src/veritysetup/veritysetup.c +++ b/src/veritysetup/veritysetup.c @@ -130,7 +130,10 @@ static int run(int argc, char *argv[]) { _cleanup_(crypt_freep) struct crypt_device *cd = NULL; int r; - if (argc <= 1) + if (argc <= 1 || + strv_contains(strv_skip(argv, 1), "--help") || + strv_contains(strv_skip(argv, 1), "-h") || + streq(argv[1], "help")) return help(); if (argc < 3) From d53285d551d883bb9f097eca0942e8c585e33470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 31 Jul 2021 09:16:52 +0200 Subject: [PATCH 2/2] man: describe veritysetup command syntax It makes it easier to diagnose what the generated units actually do. --- man/systemd-veritysetup@.service.xml | 47 ++++++++++++++++++++++++++++ src/veritysetup/veritysetup.c | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/man/systemd-veritysetup@.service.xml b/man/systemd-veritysetup@.service.xml index c9554b087ae..70f08374e22 100644 --- a/man/systemd-veritysetup@.service.xml +++ b/man/systemd-veritysetup@.service.xml @@ -36,6 +36,53 @@ At early boot and when the system manager configuration is reloaded kernel command line configuration for integrity protected block devices is translated into systemd-veritysetup@.service units by systemd-veritysetup-generator8. + + systemd-veritysetup@.service calls systemd-veritysetup. + + + + Commands + + The following commands are understood by systemd-veritysetup: + + + + + + volume + datadevice + hashdevice + roothash + [option...] + + + Create a block device volume using + datadevice and hashdevice as the backing + devices. roothash forms the root of the tree of hashes stored on + hashdevice. See + + Kernel dm-verity documentation for details. + + + + + + + volume + + + Detach (destroy) the block device + volume. + + + + + + + + Print short information about command syntax. + + diff --git a/src/veritysetup/veritysetup.c b/src/veritysetup/veritysetup.c index 14d7462ddbc..e58bae45d22 100644 --- a/src/veritysetup/veritysetup.c +++ b/src/veritysetup/veritysetup.c @@ -30,7 +30,7 @@ static int help(void) { printf("%s attach VOLUME DATADEVICE HASHDEVICE ROOTHASH [OPTIONS]\n" "%s detach VOLUME\n\n" - "Attaches or detaches an integrity protected block device.\n" + "Attach or detach an integrity protected block device.\n" "\nSee the %s for details.\n", program_invocation_short_name, program_invocation_short_name,