chiark / gitweb /
machinectl: parse verify setting client-side
[elogind.git] / src / machine / machinectl.c
index 11b2c004b86fdf51584b4b7f9bfa933fd00f1940..ec403e8f33482df5404d2dde1a6af6ead2e10cef 100644 (file)
@@ -71,7 +71,7 @@ static bool arg_ask_password = true;
 static unsigned arg_lines = 10;
 static OutputMode arg_output = OUTPUT_SHORT;
 static bool arg_force = false;
-static const char* arg_verify = NULL;
+static ImportVerify arg_verify = IMPORT_VERIFY_SIGNATURE;
 static const char* arg_dkr_index_url = NULL;
 
 static void pager_open_if_enabled(void) {
@@ -1914,7 +1914,7 @@ static int pull_tar(int argc, char *argv[], void *userdata) {
                         "sssb",
                         remote,
                         local,
-                        arg_verify,
+                        import_verify_to_string(arg_verify),
                         arg_force);
         if (r < 0)
                 return bus_log_create_error(r);
@@ -1978,7 +1978,7 @@ static int pull_raw(int argc, char *argv[], void *userdata) {
                         "sssb",
                         remote,
                         local,
-                        arg_verify,
+                        import_verify_to_string(arg_verify),
                         arg_force);
         if (r < 0)
                 return bus_log_create_error(r);
@@ -2051,7 +2051,7 @@ static int pull_dkr(int argc, char *argv[], void *userdata) {
                         remote,
                         tag,
                         local,
-                        arg_verify,
+                        import_verify_to_string(arg_verify),
                         arg_force);
         if (r < 0)
                 return bus_log_create_error(r);
@@ -2218,8 +2218,8 @@ static int help(int argc, char *argv[], void *userdata) {
                "  -o --output=STRING          Change journal output mode (short,\n"
                "                              short-monotonic, verbose, export, json,\n"
                "                              json-pretty, json-sse, cat)\n"
-               "      --verify=MODE           Verification mode for downloaded images (no, sum,\n"
-               "                              signature)\n"
+               "      --verify=MODE           Verification mode for downloaded images (no,\n"
+               "                              checksum, signature)\n"
                "      --force                 Download image even if already exists\n"
                "      --dkr-index-url=URL     Specify the index URL to use for DKR image\n"
                "                              downloads\n\n"
@@ -2239,18 +2239,18 @@ static int help(int argc, char *argv[], void *userdata) {
                "  copy-from NAME PATH [PATH]  Copy files from a container to the host\n"
                "  bind NAME PATH [PATH]       Bind mount a path from the host into a container\n\n"
                "Image Commands:\n"
-               "  list-images                 Show available images\n"
+               "  list-images                 Show available container annd VM images\n"
                "  image-status NAME...        Show image details\n"
                "  show-image NAME...          Show properties of image\n"
                "  clone NAME NAME             Clone an image\n"
                "  rename NAME NAME            Rename an image\n"
                "  read-only NAME [BOOL]       Mark or unmark image read-only\n"
                "  remove NAME...              Remove an image\n\n"
-               "Transfer Commands:\n"
-               "  pull-tar URL [NAME]         Download a TAR image\n"
-               "  pull-raw URL [NAME]         Download a RAW image\n"
-               "  pull-dkr REMOTE [NAME]      Download a DKR image\n"
-               "  list-transfers              Show list of current downloads\n"
+               "Image Transfer Commands:\n"
+               "  pull-tar URL [NAME]         Download a TAR container image\n"
+               "  pull-raw URL [NAME]         Download a RAW container or VM image\n"
+               "  pull-dkr REMOTE [NAME]      Download a DKR container image\n"
+               "  list-transfers              Show list of downloads in progress\n"
                "  cancel-transfer             Cancel a download\n"
                , program_invocation_short_name);
 
@@ -2394,7 +2394,11 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
 
                 case ARG_VERIFY:
-                        arg_verify = optarg;
+                        arg_verify = import_verify_from_string(optarg);
+                        if (arg_verify < 0) {
+                                log_error("Failed to parse --verify= setting: %s", optarg);
+                                return -EINVAL;
+                        }
                         break;
 
                 case ARG_FORCE: