-static int pull_gpt(int argc, char *argv[], void *userdata) {
- _cleanup_(gpt_import_unrefp) GptImport *import = NULL;
+static int strip_raw_suffixes(const char *p, char **ret) {
+ static const char suffixes[] =
+ ".xz\0"
+ ".raw\0"
+ ".qcow2\0"
+ ".img\0";
+
+ _cleanup_free_ char *q = NULL;
+
+ q = strdup(p);
+ if (!q)
+ return -ENOMEM;
+
+ for (;;) {
+ const char *sfx;
+ bool changed = false;
+
+ NULSTR_FOREACH(sfx, suffixes) {
+ char *e;
+
+ e = endswith(q, sfx);
+ if (e) {
+ *e = 0;
+ changed = true;
+ }
+ }
+
+ if (!changed)
+ break;
+ }
+
+ *ret = q;
+ q = NULL;
+
+ return 0;
+}
+
+static int pull_raw(int argc, char *argv[], void *userdata) {
+ _cleanup_(raw_import_unrefp) RawImport *import = NULL;