diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-08 18:25:56 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-08 18:26:29 +0200 |
commit | 9854730b4536cf2e20866b4a7aa5461450dcfa1e (patch) | |
tree | 8fa4379025013fa092ad2a18f82216b06d54324f /src/import/pull.c | |
parent | 3905f12713df17195118d9caa321299d963ee315 (diff) |
importd: for .raw and .tar images, try to download .nspawn settings file too
Diffstat (limited to 'src/import/pull.c')
-rw-r--r-- | src/import/pull.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/import/pull.c b/src/import/pull.c index e13cd6af97..98c22aeec9 100644 --- a/src/import/pull.c +++ b/src/import/pull.c @@ -37,6 +37,7 @@ static bool arg_force = false; static const char *arg_image_root = "/var/lib/machines"; static ImportVerify arg_verify = IMPORT_VERIFY_SIGNATURE; static const char* arg_dkr_index_url = DEFAULT_DKR_INDEX_URL; +static bool arg_settings = true; static int interrupt_signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) { log_notice("Transfer aborted."); @@ -118,7 +119,7 @@ static int pull_tar(int argc, char *argv[], void *userdata) { if (r < 0) return log_error_errno(r, "Failed to allocate puller: %m"); - r = tar_pull_start(pull, url, local, arg_force, arg_verify); + r = tar_pull_start(pull, url, local, arg_force, arg_verify, arg_settings); if (r < 0) return log_error_errno(r, "Failed to pull image: %m"); @@ -204,7 +205,7 @@ static int pull_raw(int argc, char *argv[], void *userdata) { if (r < 0) return log_error_errno(r, "Failed to allocate puller: %m"); - r = raw_pull_start(pull, url, local, arg_force, arg_verify); + r = raw_pull_start(pull, url, local, arg_force, arg_verify, arg_settings); if (r < 0) return log_error_errno(r, "Failed to pull image: %m"); @@ -331,8 +332,9 @@ static int help(int argc, char *argv[], void *userdata) { " -h --help Show this help\n" " --version Show package version\n" " --force Force creation of image\n" - " --verify= Verify downloaded image, one of: 'no',\n" - " 'checksum', 'signature'.\n" + " --verify=MODE Verify downloaded image, one of: 'no',\n" + " 'checksum', 'signature'\n" + " --settings=BOOL Download settings file with image\n" " --image-root=PATH Image root directory\n" " --dkr-index-url=URL Specify index URL to use for downloads\n\n" "Commands:\n" @@ -352,6 +354,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_DKR_INDEX_URL, ARG_IMAGE_ROOT, ARG_VERIFY, + ARG_SETTINGS, }; static const struct option options[] = { @@ -361,10 +364,11 @@ static int parse_argv(int argc, char *argv[]) { { "dkr-index-url", required_argument, NULL, ARG_DKR_INDEX_URL }, { "image-root", required_argument, NULL, ARG_IMAGE_ROOT }, { "verify", required_argument, NULL, ARG_VERIFY }, + { "settings", required_argument, NULL, ARG_SETTINGS }, {} }; - int c; + int c, r; assert(argc >= 0); assert(argv); @@ -407,6 +411,14 @@ static int parse_argv(int argc, char *argv[]) { break; + case ARG_SETTINGS: + r = parse_boolean(optarg); + if (r < 0) + return log_error_errno(r, "Failed to parse --settings= parameter '%s'", optarg); + + arg_settings = r; + break; + case '?': return -EINVAL; |