char *remote;
char *local;
+ char *image_root;
ImageClass class;
ImportFlags flags;
char *format;
free(t->remote);
free(t->local);
free(t->format);
+ free(t->image_root);
free(t->object_path);
pidref_done_sigkill_wait(&t->pidref);
NULL, /* if so: the actual URL */
NULL, /* maybe --format= */
NULL, /* if so: the actual format */
+ NULL, /* maybe --image-root= */
+ NULL, /* if so: the image root path */
NULL, /* remote */
NULL, /* local */
NULL
cmd[k++] = t->format;
}
+ if (t->image_root) {
+ cmd[k++] = "--image-root";
+ cmd[k++] = t->image_root;
+ }
+
if (!IN_SET(t->type, TRANSFER_EXPORT_TAR, TRANSFER_EXPORT_RAW)) {
if (t->remote)
cmd[k++] = t->remote;
bool force;
bool read_only;
bool keep_download;
+ const char *image_root;
} p = {
.class = _IMAGE_CLASS_INVALID,
.verify = IMPORT_VERIFY_SIGNATURE,
{ "force", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(struct p, force), 0 },
{ "readOnly", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(struct p, read_only), 0 },
{ "keepDownload", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(struct p, keep_download), 0 },
+ { "imageRoot", SD_JSON_VARIANT_BOOLEAN, json_dispatch_const_path, offsetof(struct p, image_root), SD_JSON_STRICT },
VARLINK_DISPATCH_POLKIT_FIELD,
{},
};
return -ENOMEM;
}
+ if (p.image_root) {
+ t->image_root = strdup(p.image_root);
+ if (!t->image_root)
+ return -ENOMEM;
+ }
+
r = transfer_start(t);
if (r < 0)
return r;
SD_VARLINK_DEFINE_INPUT(readOnly, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("Whether to keep a pristine copy of the download separate from the locally installed image. Defaults to false."),
SD_VARLINK_DEFINE_INPUT(keepDownload, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
+ SD_VARLINK_FIELD_COMMENT("Root directory for images. If not specified derived from the image class, and located below /var/lib/."),
+ SD_VARLINK_DEFINE_INPUT(imageRoot, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
VARLINK_DEFINE_POLKIT_INPUT,
SD_VARLINK_FIELD_COMMENT("A progress update, as percent value"),
SD_VARLINK_DEFINE_OUTPUT(progress, SD_VARLINK_FLOAT, SD_VARLINK_NULLABLE),