#include "verbs.h"
#include "build.h"
#include "machine-image.h"
-#include "import-tar.h"
-#include "import-raw.h"
-#include "import-dkr.h"
#include "import-util.h"
+#include "pull-tar.h"
+#include "pull-raw.h"
+#include "pull-dkr.h"
static bool arg_force = false;
static const char *arg_image_root = "/var/lib/machines";
return 0;
}
-static void on_tar_finished(TarImport *import, int error, void *userdata) {
+static void on_tar_finished(TarPull *pull, int error, void *userdata) {
sd_event *event = userdata;
- assert(import);
+ assert(pull);
if (error == 0)
log_info("Operation completed successfully.");
}
static int pull_tar(int argc, char *argv[], void *userdata) {
- _cleanup_(tar_import_unrefp) TarImport *import = NULL;
+ _cleanup_(tar_pull_unrefp) TarPull *pull = NULL;
_cleanup_event_unref_ sd_event *event = NULL;
const char *url, *local;
_cleanup_free_ char *l = NULL, *ll = NULL;
sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
- r = tar_import_new(&import, event, arg_image_root, on_tar_finished, event);
+ r = tar_pull_new(&pull, event, arg_image_root, on_tar_finished, event);
if (r < 0)
- return log_error_errno(r, "Failed to allocate importer: %m");
+ return log_error_errno(r, "Failed to allocate puller: %m");
- r = tar_import_pull(import, url, local, arg_force, arg_verify);
+ r = tar_pull_start(pull, url, local, arg_force, arg_verify);
if (r < 0)
return log_error_errno(r, "Failed to pull image: %m");
return -r;
}
-static void on_raw_finished(RawImport *import, int error, void *userdata) {
+static void on_raw_finished(RawPull *pull, int error, void *userdata) {
sd_event *event = userdata;
- assert(import);
+ assert(pull);
if (error == 0)
log_info("Operation completed successfully.");
}
static int pull_raw(int argc, char *argv[], void *userdata) {
- _cleanup_(raw_import_unrefp) RawImport *import = NULL;
+ _cleanup_(raw_pull_unrefp) RawPull *pull = NULL;
_cleanup_event_unref_ sd_event *event = NULL;
const char *url, *local;
_cleanup_free_ char *l = NULL, *ll = NULL;
sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
- r = raw_import_new(&import, event, arg_image_root, on_raw_finished, event);
+ r = raw_pull_new(&pull, event, arg_image_root, on_raw_finished, event);
if (r < 0)
- return log_error_errno(r, "Failed to allocate importer: %m");
+ return log_error_errno(r, "Failed to allocate puller: %m");
- r = raw_import_pull(import, url, local, arg_force, arg_verify);
+ r = raw_pull_start(pull, url, local, arg_force, arg_verify);
if (r < 0)
return log_error_errno(r, "Failed to pull image: %m");
return -r;
}
-static void on_dkr_finished(DkrImport *import, int error, void *userdata) {
+static void on_dkr_finished(DkrPull *pull, int error, void *userdata) {
sd_event *event = userdata;
- assert(import);
+ assert(pull);
if (error == 0)
log_info("Operation completed successfully.");
}
static int pull_dkr(int argc, char *argv[], void *userdata) {
- _cleanup_(dkr_import_unrefp) DkrImport *import = NULL;
+ _cleanup_(dkr_pull_unrefp) DkrPull *pull = NULL;
_cleanup_event_unref_ sd_event *event = NULL;
const char *name, *tag, *local;
int r;
}
if (arg_verify != IMPORT_VERIFY_NO) {
- log_error("Imports from dkr do not support image verification, please pass --verify=no.");
+ log_error("Pulls from dkr do not support image verification, please pass --verify=no.");
return -EINVAL;
}
sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler, NULL);
sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
- r = dkr_import_new(&import, event, arg_dkr_index_url, arg_image_root, on_dkr_finished, event);
+ r = dkr_pull_new(&pull, event, arg_dkr_index_url, arg_image_root, on_dkr_finished, event);
if (r < 0)
- return log_error_errno(r, "Failed to allocate importer: %m");
+ return log_error_errno(r, "Failed to allocate puller: %m");
- r = dkr_import_pull(import, name, tag, local, arg_force);
+ r = dkr_pull_start(pull, name, tag, local, arg_force);
if (r < 0)
return log_error_errno(r, "Failed to pull image: %m");
static int help(int argc, char *argv[], void *userdata) {
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
- "Import container or virtual machine image.\n\n"
+ "Download container or virtual machine image.\n\n"
" -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"
- " --image-root= Image root directory\n"
+ " --image-root=PATH Image root directory\n"
" --dkr-index-url=URL Specify index URL to use for downloads\n\n"
"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",
+ " tar URL [NAME] Download a TAR image\n"
+ " raw URL [NAME] Download a RAW image\n"
+ " dkr REMOTE [NAME] Download a DKR image\n",
program_invocation_short_name);
return 0;
return 1;
}
-static int import_main(int argc, char *argv[]) {
+static int pull_main(int argc, char *argv[]) {
static const Verb verbs[] = {
- { "help", VERB_ANY, VERB_ANY, 0, help },
- { "pull-tar", 2, 3, 0, pull_tar },
- { "pull-raw", 2, 3, 0, pull_raw },
- { "pull-dkr", 2, 3, 0, pull_dkr },
+ { "help", VERB_ANY, VERB_ANY, 0, help },
+ { "tar", 2, 3, 0, pull_tar },
+ { "raw", 2, 3, 0, pull_raw },
+ { "dkr", 2, 3, 0, pull_dkr },
{}
};
if (r <= 0)
goto finish;
- r = import_main(argc, argv);
+ r = pull_main(argc, argv);
finish:
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;