teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0324-importd-drop-dkr-support.patch

1abbee
From b4bfb025f7ab0878e8e7e980dbad5b0a5bed1555 Mon Sep 17 00:00:00 2001
1abbee
From: Lennart Poettering <lennart@poettering.net>
1abbee
Date: Thu, 10 Dec 2015 12:40:04 +0100
1abbee
Subject: [PATCH] importd: drop dkr support
1abbee
1abbee
The current code is not compatible with current dkr protocols anyway,
1abbee
and dkr has a different focus ("microservices") than nspawn anyway
1abbee
("whole machine containers"), hence drop support for it, we cannot
1abbee
reasonably keep this up to date, and it creates the impression we'd
1abbee
actually care for the microservices usecase.
1abbee
1abbee
Cherry-picked from: b43d75c
1abbee
Related: #1284974
1abbee
---
1abbee
 Makefile.am                             |   2 -
1abbee
 TODO                                    |   4 -
1abbee
 configure.ac                            |   9 -
1abbee
 man/machinectl.xml                      |  58 ---
1abbee
 src/import/import-dkr.c                 | 891 --------------------------------
1abbee
 src/import/import-dkr.h                 |  36 --
1abbee
 src/import/importd.c                    | 111 +---
1abbee
 src/import/org.freedesktop.import1.conf |   4 -
1abbee
 src/import/pull.c                       | 119 +----
1abbee
 src/machine/machinectl.c                |  90 +---
1abbee
 src/shared/import-util.c                |  31 --
1abbee
 src/shared/import-util.h                |   4 -
1abbee
 12 files changed, 5 insertions(+), 1354 deletions(-)
1abbee
 delete mode 100644 src/import/import-dkr.c
1abbee
 delete mode 100644 src/import/import-dkr.h
1abbee
1abbee
diff --git a/Makefile.am b/Makefile.am
1abbee
index 3a09e0a..b0a34b2 100644
1abbee
--- a/Makefile.am
1abbee
+++ b/Makefile.am
1abbee
@@ -5369,8 +5369,6 @@ systemd_pull_SOURCES = \
1abbee
 	src/import/import-raw.h \
1abbee
 	src/import/import-tar.c \
1abbee
 	src/import/import-tar.h \
1abbee
-	src/import/import-dkr.c \
1abbee
-	src/import/import-dkr.h \
1abbee
 	src/import/import-job.c \
1abbee
 	src/import/import-job.h \
1abbee
 	src/import/import-common.c \
1abbee
diff --git a/TODO b/TODO
1abbee
index 90b2c4b..d96d2bf 100644
1abbee
--- a/TODO
1abbee
+++ b/TODO
1abbee
@@ -126,10 +126,6 @@ Features:
1abbee
 
1abbee
 * rework journald sigbus stuff to use mutex
1abbee
 
1abbee
-* import-dkr: support tarsum checksum verification, if it becomes reality one day...
1abbee
-
1abbee
-* import-dkr: convert json bits to nspawn configuration
1abbee
-
1abbee
 * import: support import from local files, and export to local files
1abbee
 
1abbee
 * core/cgroup: support net_cls modules, and support automatically allocating class ids, then add support for making firewall changes depending on it, to implement a per-service firewall
1abbee
diff --git a/configure.ac b/configure.ac
1abbee
index 9103f9b..2734368 100644
1abbee
--- a/configure.ac
1abbee
+++ b/configure.ac
1abbee
@@ -1389,14 +1389,6 @@ AC_ARG_ENABLE([split-usr],
1abbee
                 enable_split_usr=no
1abbee
         ])])
1abbee
 
1abbee
-AC_ARG_WITH([dkr-index-url],
1abbee
-        [AS_HELP_STRING([--dkr-index-url=URL], [Specify the default index URL to use for image downloads])],
1abbee
-        [DEFAULT_DKR_INDEX_URL="\"$withval\""],
1abbee
-        [DEFAULT_DKR_INDEX_URL="NULL"])
1abbee
-
1abbee
-AC_DEFINE_UNQUOTED(DEFAULT_DKR_INDEX_URL, [$DEFAULT_DKR_INDEX_URL], [Default index URL to use for image downloads])
1abbee
-AC_SUBST(DEFAULT_DKR_INDEX_URL)
1abbee
-
1abbee
 AS_IF([test "x${enable_split_usr}" = "xyes"], [
1abbee
         AC_DEFINE(HAVE_SPLIT_USR, 1, [Define if /bin, /sbin aren't symlinks into /usr])
1abbee
 ])
1abbee
@@ -1564,7 +1556,6 @@ AC_MSG_RESULT([
1abbee
         Maximum System UID:      ${SYSTEM_UID_MAX}
1abbee
         Maximum System GID:      ${SYSTEM_GID_MAX}
1abbee
         Certificate root:        ${CERTIFICATEROOT}
1abbee
-        Default dkr Index        ${DEFAULT_DKR_INDEX_URL}
1abbee
 
1abbee
         CFLAGS:                  ${OUR_CFLAGS} ${CFLAGS}
1abbee
         CPPFLAGS:                ${OUR_CPPFLAGS} ${CPPFLAGS}
1abbee
diff --git a/man/machinectl.xml b/man/machinectl.xml
1abbee
index 640cb8b..b0a7f2a 100644
1abbee
--- a/man/machinectl.xml
1abbee
+++ b/man/machinectl.xml
1abbee
@@ -204,16 +204,6 @@
1abbee
         image.</para></listitem>
1abbee
       </varlistentry>
1abbee
 
1abbee
-      <varlistentry>
1abbee
-        <term><option>--dkr-index-url</option></term>
1abbee
-
1abbee
-        <listitem><para>Specifies the index server to use for
1abbee
-        downloading <literal>dkr</literal> images with the
1abbee
-        <command>pull-dkr</command>. Takes a
1abbee
-        <literal>http://</literal>, <literal>https://</literal>
1abbee
-        URL.</para></listitem>
1abbee
-      </varlistentry>
1abbee
-
1abbee
       <xi:include href="user-system-options.xml" xpointer="host" />
1abbee
       <xi:include href="user-system-options.xml" xpointer="machine" />
1abbee
 
1abbee
@@ -603,42 +593,6 @@
1abbee
       </varlistentry>
1abbee
 
1abbee
       <varlistentry>
1abbee
-        <term><command>pull-dkr</command> <replaceable>REMOTE</replaceable> [<replaceable>NAME</replaceable>]</term>
1abbee
-
1abbee
-        <listitem><para>Downloads a <literal>dkr</literal> container
1abbee
-        image and makes it available locally. The remote name refers
1abbee
-        to a <literal>dkr</literal> container name. If omitted, the
1abbee
-        local machine name is derived from the <literal>dkr</literal>
1abbee
-        container name.</para>
1abbee
-
1abbee
-        <para>Image verification is not available for
1abbee
-        <literal>dkr</literal> containers, and thus
1abbee
-        <option>--verify=no</option> must always be specified with
1abbee
-        this command.</para>
1abbee
-
1abbee
-        <para>This command downloads all (missing) layers for the
1abbee
-        specified container and places them in read-only subvolumes in
1abbee
-        <filename>/var/lib/machines/</filename>. A writable snapshot
1abbee
-        of the newest layer is then created under the specified local
1abbee
-        machine name. To omit creation of this writable snapshot, pass
1abbee
-        <literal>-</literal> as local machine name.</para>
1abbee
-
1abbee
-        <para>The read-only layer subvolumes are prefixed with
1abbee
-        <filename>.dkr-</filename>, and thus now shown by
1abbee
-        <command>list-images</command>, unless <option>--all</option>
1abbee
-        is passed.</para>
1abbee
-
1abbee
-        <para>To specify the <literal>dkr</literal> index server to
1abbee
-        use for looking up the specified container, use
1abbee
-        <option>--dkr-index-url=</option>.</para>
1abbee
-
1abbee
-        <para>Note that pressing C-c during execution of this command
1abbee
-        will not abort the download. Use
1abbee
-        <command>cancel-transfer</command>, described
1abbee
-        below.</para></listitem>
1abbee
-      </varlistentry>
1abbee
-
1abbee
-      <varlistentry>
1abbee
         <term><command>list-transfers</command></term>
1abbee
 
1abbee
         <listitem><para>Shows a list of container or VM image
1abbee
@@ -728,18 +682,6 @@
1abbee
       the machine started as system service. With the last command a
1abbee
       login prompt into the container is requested.</para>
1abbee
     </example>
1abbee
-
1abbee
-    <example>
1abbee
-      <title>Download a Fedora <literal>dkr</literal> image</title>
1abbee
-
1abbee
-      <programlisting># machinectl pull-dkr --verify=no mattdm/fedora
1abbee
-# systemd-nspawn -M fedora</programlisting>
1abbee
-
1abbee
-      <para>Downloads a <literal>dkr</literal> image and opens a shell
1abbee
-      in it. Note that the specified download command might require an
1abbee
-      index server to be specified with the
1abbee
-      <literal>--dkr-index-url=</literal>.</para>
1abbee
-    </example>
1abbee
   </refsect1>
1abbee
 
1abbee
   <refsect1>
1abbee
diff --git a/src/import/import-dkr.c b/src/import/import-dkr.c
1abbee
deleted file mode 100644
1abbee
index fb72f6c..0000000
1abbee
--- a/src/import/import-dkr.c
1abbee
+++ /dev/null
1abbee
@@ -1,891 +0,0 @@
1abbee
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1abbee
-
1abbee
-/***
1abbee
-  This file is part of systemd.
1abbee
-
1abbee
-  Copyright 2014 Lennart Poettering
1abbee
-
1abbee
-  systemd is free software; you can redistribute it and/or modify it
1abbee
-  under the terms of the GNU Lesser General Public License as published by
1abbee
-  the Free Software Foundation; either version 2.1 of the License, or
1abbee
-  (at your option) any later version.
1abbee
-
1abbee
-  systemd is distributed in the hope that it will be useful, but
1abbee
-  WITHOUT ANY WARRANTY; without even the implied warranty of
1abbee
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1abbee
-  Lesser General Public License for more details.
1abbee
-
1abbee
-  You should have received a copy of the GNU Lesser General Public License
1abbee
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
1abbee
-***/
1abbee
-
1abbee
-#include <curl/curl.h>
1abbee
-#include <sys/prctl.h>
1abbee
-
1abbee
-#include "sd-daemon.h"
1abbee
-#include "json.h"
1abbee
-#include "strv.h"
1abbee
-#include "btrfs-util.h"
1abbee
-#include "utf8.h"
1abbee
-#include "mkdir.h"
1abbee
-#include "import-util.h"
1abbee
-#include "curl-util.h"
1abbee
-#include "aufs-util.h"
1abbee
-#include "import-job.h"
1abbee
-#include "import-common.h"
1abbee
-#include "import-dkr.h"
1abbee
-
1abbee
-typedef enum DkrProgress {
1abbee
-        DKR_SEARCHING,
1abbee
-        DKR_RESOLVING,
1abbee
-        DKR_METADATA,
1abbee
-        DKR_DOWNLOADING,
1abbee
-        DKR_COPYING,
1abbee
-} DkrProgress;
1abbee
-
1abbee
-struct DkrImport {
1abbee
-        sd_event *event;
1abbee
-        CurlGlue *glue;
1abbee
-
1abbee
-        char *index_url;
1abbee
-        char *image_root;
1abbee
-
1abbee
-        ImportJob *images_job;
1abbee
-        ImportJob *tags_job;
1abbee
-        ImportJob *ancestry_job;
1abbee
-        ImportJob *json_job;
1abbee
-        ImportJob *layer_job;
1abbee
-
1abbee
-        char *name;
1abbee
-        char *tag;
1abbee
-        char *id;
1abbee
-
1abbee
-        char *response_token;
1abbee
-        char **response_registries;
1abbee
-
1abbee
-        char **ancestry;
1abbee
-        unsigned n_ancestry;
1abbee
-        unsigned current_ancestry;
1abbee
-
1abbee
-        DkrImportFinished on_finished;
1abbee
-        void *userdata;
1abbee
-
1abbee
-        char *local;
1abbee
-        bool force_local;
1abbee
-
1abbee
-        char *temp_path;
1abbee
-        char *final_path;
1abbee
-
1abbee
-        pid_t tar_pid;
1abbee
-};
1abbee
-
1abbee
-#define PROTOCOL_PREFIX "https://"
1abbee
-
1abbee
-#define HEADER_TOKEN "X-Do" /* the HTTP header for the auth token */ "cker-Token:"
1abbee
-#define HEADER_REGISTRY "X-Do" /*the HTTP header for the registry */ "cker-Endpoints:"
1abbee
-
1abbee
-#define LAYERS_MAX 2048
1abbee
-
1abbee
-static void dkr_import_job_on_finished(ImportJob *j);
1abbee
-
1abbee
-DkrImport* dkr_import_unref(DkrImport *i) {
1abbee
-        if (!i)
1abbee
-                return NULL;
1abbee
-
1abbee
-        if (i->tar_pid > 1) {
1abbee
-                (void) kill_and_sigcont(i->tar_pid, SIGKILL);
1abbee
-                (void) wait_for_terminate(i->tar_pid, NULL);
1abbee
-        }
1abbee
-
1abbee
-        import_job_unref(i->images_job);
1abbee
-        import_job_unref(i->tags_job);
1abbee
-        import_job_unref(i->ancestry_job);
1abbee
-        import_job_unref(i->json_job);
1abbee
-        import_job_unref(i->layer_job);
1abbee
-
1abbee
-        curl_glue_unref(i->glue);
1abbee
-        sd_event_unref(i->event);
1abbee
-
1abbee
-        if (i->temp_path) {
1abbee
-                (void) btrfs_subvol_remove(i->temp_path);
1abbee
-                (void) rm_rf_dangerous(i->temp_path, false, true, false);
1abbee
-                free(i->temp_path);
1abbee
-        }
1abbee
-
1abbee
-        free(i->name);
1abbee
-        free(i->tag);
1abbee
-        free(i->id);
1abbee
-        free(i->response_token);
1abbee
-        free(i->response_registries);
1abbee
-        strv_free(i->ancestry);
1abbee
-        free(i->final_path);
1abbee
-        free(i->index_url);
1abbee
-        free(i->image_root);
1abbee
-        free(i->local);
1abbee
-        free(i);
1abbee
-
1abbee
-        return NULL;
1abbee
-}
1abbee
-
1abbee
-int dkr_import_new(
1abbee
-                DkrImport **ret,
1abbee
-                sd_event *event,
1abbee
-                const char *index_url,
1abbee
-                const char *image_root,
1abbee
-                DkrImportFinished on_finished,
1abbee
-                void *userdata) {
1abbee
-
1abbee
-        _cleanup_(dkr_import_unrefp) DkrImport *i = NULL;
1abbee
-        char *e;
1abbee
-        int r;
1abbee
-
1abbee
-        assert(ret);
1abbee
-        assert(index_url);
1abbee
-
1abbee
-        if (!http_url_is_valid(index_url))
1abbee
-                return -EINVAL;
1abbee
-
1abbee
-        i = new0(DkrImport, 1);
1abbee
-        if (!i)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        i->on_finished = on_finished;
1abbee
-        i->userdata = userdata;
1abbee
-
1abbee
-        i->image_root = strdup(image_root ?: "/var/lib/machines");
1abbee
-        if (!i->image_root)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        i->index_url = strdup(index_url);
1abbee
-        if (!i->index_url)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        e = endswith(i->index_url, "/");
1abbee
-        if (e)
1abbee
-                *e = 0;
1abbee
-
1abbee
-        if (event)
1abbee
-                i->event = sd_event_ref(event);
1abbee
-        else {
1abbee
-                r = sd_event_default(&i->event);
1abbee
-                if (r < 0)
1abbee
-                        return r;
1abbee
-        }
1abbee
-
1abbee
-        r = curl_glue_new(&i->glue, i->event);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-
1abbee
-        i->glue->on_finished = import_job_curl_on_finished;
1abbee
-        i->glue->userdata = i;
1abbee
-
1abbee
-        *ret = i;
1abbee
-        i = NULL;
1abbee
-
1abbee
-        return 0;
1abbee
-}
1abbee
-
1abbee
-static void dkr_import_report_progress(DkrImport *i, DkrProgress p) {
1abbee
-        unsigned percent;
1abbee
-
1abbee
-        assert(i);
1abbee
-
1abbee
-        switch (p) {
1abbee
-
1abbee
-        case DKR_SEARCHING:
1abbee
-                percent = 0;
1abbee
-                if (i->images_job)
1abbee
-                        percent += i->images_job->progress_percent * 5 / 100;
1abbee
-                break;
1abbee
-
1abbee
-        case DKR_RESOLVING:
1abbee
-                percent = 5;
1abbee
-                if (i->tags_job)
1abbee
-                        percent += i->tags_job->progress_percent * 5 / 100;
1abbee
-                break;
1abbee
-
1abbee
-        case DKR_METADATA:
1abbee
-                percent = 10;
1abbee
-                if (i->ancestry_job)
1abbee
-                        percent += i->ancestry_job->progress_percent * 5 / 100;
1abbee
-                if (i->json_job)
1abbee
-                        percent += i->json_job->progress_percent * 5 / 100;
1abbee
-                break;
1abbee
-
1abbee
-        case DKR_DOWNLOADING:
1abbee
-                percent = 20;
1abbee
-                percent += 75 * i->current_ancestry / MAX(1U, i->n_ancestry);
1abbee
-                if (i->layer_job)
1abbee
-                        percent += i->layer_job->progress_percent * 75 / MAX(1U, i->n_ancestry) / 100;
1abbee
-
1abbee
-                break;
1abbee
-
1abbee
-        case DKR_COPYING:
1abbee
-                percent = 95;
1abbee
-                break;
1abbee
-
1abbee
-        default:
1abbee
-                assert_not_reached("Unknown progress state");
1abbee
-        }
1abbee
-
1abbee
-        sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
1abbee
-        log_debug("Combined progress %u%%", percent);
1abbee
-}
1abbee
-
1abbee
-static int parse_id(const void *payload, size_t size, char **ret) {
1abbee
-        _cleanup_free_ char *buf = NULL, *id = NULL, *other = NULL;
1abbee
-        union json_value v = {};
1abbee
-        void *json_state = NULL;
1abbee
-        const char *p;
1abbee
-        int t;
1abbee
-
1abbee
-        assert(payload);
1abbee
-        assert(ret);
1abbee
-
1abbee
-        if (size <= 0)
1abbee
-                return -EBADMSG;
1abbee
-
1abbee
-        if (memchr(payload, 0, size))
1abbee
-                return -EBADMSG;
1abbee
-
1abbee
-        buf = strndup(payload, size);
1abbee
-        if (!buf)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        p = buf;
1abbee
-        t = json_tokenize(&p, &id, &v, &json_state, NULL);
1abbee
-        if (t < 0)
1abbee
-                return t;
1abbee
-        if (t != JSON_STRING)
1abbee
-                return -EBADMSG;
1abbee
-
1abbee
-        t = json_tokenize(&p, &other, &v, &json_state, NULL);
1abbee
-        if (t < 0)
1abbee
-                return t;
1abbee
-        if (t != JSON_END)
1abbee
-                return -EBADMSG;
1abbee
-
1abbee
-        if (!dkr_id_is_valid(id))
1abbee
-                return -EBADMSG;
1abbee
-
1abbee
-        *ret = id;
1abbee
-        id = NULL;
1abbee
-
1abbee
-        return 0;
1abbee
-}
1abbee
-
1abbee
-static int parse_ancestry(const void *payload, size_t size, char ***ret) {
1abbee
-        _cleanup_free_ char *buf = NULL;
1abbee
-        void *json_state = NULL;
1abbee
-        const char *p;
1abbee
-        enum {
1abbee
-                STATE_BEGIN,
1abbee
-                STATE_ITEM,
1abbee
-                STATE_COMMA,
1abbee
-                STATE_END,
1abbee
-        } state = STATE_BEGIN;
1abbee
-        _cleanup_strv_free_ char **l = NULL;
1abbee
-        size_t n = 0, allocated = 0;
1abbee
-
1abbee
-        if (size <= 0)
1abbee
-                return -EBADMSG;
1abbee
-
1abbee
-        if (memchr(payload, 0, size))
1abbee
-                return -EBADMSG;
1abbee
-
1abbee
-        buf = strndup(payload, size);
1abbee
-        if (!buf)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        p = buf;
1abbee
-        for (;;) {
1abbee
-                _cleanup_free_ char *str;
1abbee
-                union json_value v = {};
1abbee
-                int t;
1abbee
-
1abbee
-                t = json_tokenize(&p, &str, &v, &json_state, NULL);
1abbee
-                if (t < 0)
1abbee
-                        return t;
1abbee
-
1abbee
-                switch (state) {
1abbee
-
1abbee
-                case STATE_BEGIN:
1abbee
-                        if (t == JSON_ARRAY_OPEN)
1abbee
-                                state = STATE_ITEM;
1abbee
-                        else
1abbee
-                                return -EBADMSG;
1abbee
-
1abbee
-                        break;
1abbee
-
1abbee
-                case STATE_ITEM:
1abbee
-                        if (t == JSON_STRING) {
1abbee
-                                if (!dkr_id_is_valid(str))
1abbee
-                                        return -EBADMSG;
1abbee
-
1abbee
-                                if (n+1 > LAYERS_MAX)
1abbee
-                                        return -EFBIG;
1abbee
-
1abbee
-                                if (!GREEDY_REALLOC(l, allocated, n + 2))
1abbee
-                                        return -ENOMEM;
1abbee
-
1abbee
-                                l[n++] = str;
1abbee
-                                str = NULL;
1abbee
-                                l[n] = NULL;
1abbee
-
1abbee
-                                state = STATE_COMMA;
1abbee
-
1abbee
-                        } else if (t == JSON_ARRAY_CLOSE)
1abbee
-                                state = STATE_END;
1abbee
-                        else
1abbee
-                                return -EBADMSG;
1abbee
-
1abbee
-                        break;
1abbee
-
1abbee
-                case STATE_COMMA:
1abbee
-                        if (t == JSON_COMMA)
1abbee
-                                state = STATE_ITEM;
1abbee
-                        else if (t == JSON_ARRAY_CLOSE)
1abbee
-                                state = STATE_END;
1abbee
-                        else
1abbee
-                                return -EBADMSG;
1abbee
-                        break;
1abbee
-
1abbee
-                case STATE_END:
1abbee
-                        if (t == JSON_END) {
1abbee
-
1abbee
-                                if (strv_isempty(l))
1abbee
-                                        return -EBADMSG;
1abbee
-
1abbee
-                                if (!strv_is_uniq(l))
1abbee
-                                        return -EBADMSG;
1abbee
-
1abbee
-                                l = strv_reverse(l);
1abbee
-
1abbee
-                                *ret = l;
1abbee
-                                l = NULL;
1abbee
-                                return 0;
1abbee
-                        } else
1abbee
-                                return -EBADMSG;
1abbee
-                }
1abbee
-
1abbee
-        }
1abbee
-}
1abbee
-
1abbee
-static const char *dkr_import_current_layer(DkrImport *i) {
1abbee
-        assert(i);
1abbee
-
1abbee
-        if (strv_isempty(i->ancestry))
1abbee
-                return NULL;
1abbee
-
1abbee
-        return i->ancestry[i->current_ancestry];
1abbee
-}
1abbee
-
1abbee
-static const char *dkr_import_current_base_layer(DkrImport *i) {
1abbee
-        assert(i);
1abbee
-
1abbee
-        if (strv_isempty(i->ancestry))
1abbee
-                return NULL;
1abbee
-
1abbee
-        if (i->current_ancestry <= 0)
1abbee
-                return NULL;
1abbee
-
1abbee
-        return i->ancestry[i->current_ancestry-1];
1abbee
-}
1abbee
-
1abbee
-static int dkr_import_add_token(DkrImport *i, ImportJob *j) {
1abbee
-        const char *t;
1abbee
-
1abbee
-        assert(i);
1abbee
-        assert(j);
1abbee
-
1abbee
-        if (i->response_token)
1abbee
-                t = strjoina("Authorization: Token ", i->response_token);
1abbee
-        else
1abbee
-                t = HEADER_TOKEN " true";
1abbee
-
1abbee
-        j->request_header = curl_slist_new("Accept: application/json", t, NULL);
1abbee
-        if (!j->request_header)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        return 0;
1abbee
-}
1abbee
-
1abbee
-static bool dkr_import_is_done(DkrImport *i) {
1abbee
-        assert(i);
1abbee
-        assert(i->images_job);
1abbee
-
1abbee
-        if (i->images_job->state != IMPORT_JOB_DONE)
1abbee
-                return false;
1abbee
-
1abbee
-        if (!i->tags_job || i->tags_job->state != IMPORT_JOB_DONE)
1abbee
-                return false;
1abbee
-
1abbee
-        if (!i->ancestry_job || i->ancestry_job->state != IMPORT_JOB_DONE)
1abbee
-                return false;
1abbee
-
1abbee
-        if (!i->json_job || i->json_job->state != IMPORT_JOB_DONE)
1abbee
-                return false;
1abbee
-
1abbee
-        if (i->layer_job && i->layer_job->state != IMPORT_JOB_DONE)
1abbee
-                return false;
1abbee
-
1abbee
-        if (dkr_import_current_layer(i))
1abbee
-                return false;
1abbee
-
1abbee
-        return true;
1abbee
-}
1abbee
-
1abbee
-static int dkr_import_make_local_copy(DkrImport *i) {
1abbee
-        int r;
1abbee
-
1abbee
-        assert(i);
1abbee
-
1abbee
-        if (!i->local)
1abbee
-                return 0;
1abbee
-
1abbee
-        if (!i->final_path) {
1abbee
-                i->final_path = strjoin(i->image_root, "/.dkr-", i->id, NULL);
1abbee
-                if (!i->final_path)
1abbee
-                        return log_oom();
1abbee
-        }
1abbee
-
1abbee
-        r = import_make_local_copy(i->final_path, i->image_root, i->local, i->force_local);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-
1abbee
-        return 0;
1abbee
-}
1abbee
-
1abbee
-static int dkr_import_job_on_open_disk(ImportJob *j) {
1abbee
-        const char *base;
1abbee
-        DkrImport *i;
1abbee
-        int r;
1abbee
-
1abbee
-        assert(j);
1abbee
-        assert(j->userdata);
1abbee
-
1abbee
-        i = j->userdata;
1abbee
-        assert(i->layer_job == j);
1abbee
-        assert(i->final_path);
1abbee
-        assert(!i->temp_path);
1abbee
-        assert(i->tar_pid <= 0);
1abbee
-
1abbee
-        r = tempfn_random(i->final_path, &i->temp_path);
1abbee
-        if (r < 0)
1abbee
-                return log_oom();
1abbee
-
1abbee
-        mkdir_parents_label(i->temp_path, 0700);
1abbee
-
1abbee
-        base = dkr_import_current_base_layer(i);
1abbee
-        if (base) {
1abbee
-                const char *base_path;
1abbee
-
1abbee
-                base_path = strjoina(i->image_root, "/.dkr-", base);
1abbee
-                r = btrfs_subvol_snapshot(base_path, i->temp_path, false, true);
1abbee
-        } else
1abbee
-                r = btrfs_subvol_make(i->temp_path);
1abbee
-        if (r < 0)
1abbee
-                return log_error_errno(r, "Failed to make btrfs subvolume %s: %m", i->temp_path);
1abbee
-
1abbee
-        j->disk_fd = import_fork_tar(i->temp_path, &i->tar_pid);
1abbee
-        if (j->disk_fd < 0)
1abbee
-                return j->disk_fd;
1abbee
-
1abbee
-        return 0;
1abbee
-}
1abbee
-
1abbee
-static void dkr_import_job_on_progress(ImportJob *j) {
1abbee
-        DkrImport *i;
1abbee
-
1abbee
-        assert(j);
1abbee
-        assert(j->userdata);
1abbee
-
1abbee
-        i = j->userdata;
1abbee
-
1abbee
-        dkr_import_report_progress(
1abbee
-                        i,
1abbee
-                        j == i->images_job                       ? DKR_SEARCHING :
1abbee
-                        j == i->tags_job                         ? DKR_RESOLVING :
1abbee
-                        j == i->ancestry_job || j == i->json_job ? DKR_METADATA :
1abbee
-                                                                   DKR_DOWNLOADING);
1abbee
-}
1abbee
-
1abbee
-static int dkr_import_pull_layer(DkrImport *i) {
1abbee
-        _cleanup_free_ char *path = NULL;
1abbee
-        const char *url, *layer = NULL;
1abbee
-        int r;
1abbee
-
1abbee
-        assert(i);
1abbee
-        assert(!i->layer_job);
1abbee
-        assert(!i->temp_path);
1abbee
-        assert(!i->final_path);
1abbee
-
1abbee
-        for (;;) {
1abbee
-                layer = dkr_import_current_layer(i);
1abbee
-                if (!layer)
1abbee
-                        return 0; /* no more layers */
1abbee
-
1abbee
-                path = strjoin(i->image_root, "/.dkr-", layer, NULL);
1abbee
-                if (!path)
1abbee
-                        return log_oom();
1abbee
-
1abbee
-                if (laccess(path, F_OK) < 0) {
1abbee
-                        if (errno == ENOENT)
1abbee
-                                break;
1abbee
-
1abbee
-                        return log_error_errno(errno, "Failed to check for container: %m");
1abbee
-                }
1abbee
-
1abbee
-                log_info("Layer %s already exists, skipping.", layer);
1abbee
-
1abbee
-                i->current_ancestry++;
1abbee
-
1abbee
-                free(path);
1abbee
-                path = NULL;
1abbee
-        }
1abbee
-
1abbee
-        log_info("Pulling layer %s...", layer);
1abbee
-
1abbee
-        i->final_path = path;
1abbee
-        path = NULL;
1abbee
-
1abbee
-        url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", layer, "/layer");
1abbee
-        r = import_job_new(&i->layer_job, url, i->glue, i);
1abbee
-        if (r < 0)
1abbee
-                return log_error_errno(r, "Failed to allocate layer job: %m");
1abbee
-
1abbee
-        r = dkr_import_add_token(i, i->layer_job);
1abbee
-        if (r < 0)
1abbee
-                return log_oom();
1abbee
-
1abbee
-        i->layer_job->on_finished = dkr_import_job_on_finished;
1abbee
-        i->layer_job->on_open_disk = dkr_import_job_on_open_disk;
1abbee
-        i->layer_job->on_progress = dkr_import_job_on_progress;
1abbee
-
1abbee
-        r = import_job_begin(i->layer_job);
1abbee
-        if (r < 0)
1abbee
-                return log_error_errno(r, "Failed to start layer job: %m");
1abbee
-
1abbee
-        return 0;
1abbee
-}
1abbee
-
1abbee
-static void dkr_import_job_on_finished(ImportJob *j) {
1abbee
-        DkrImport *i;
1abbee
-        int r;
1abbee
-
1abbee
-        assert(j);
1abbee
-        assert(j->userdata);
1abbee
-
1abbee
-        i = j->userdata;
1abbee
-        if (j->error != 0) {
1abbee
-                if (j == i->images_job)
1abbee
-                        log_error_errno(j->error, "Failed to retrieve images list. (Wrong index URL?)");
1abbee
-                else if (j == i->tags_job)
1abbee
-                        log_error_errno(j->error, "Failed to retrieve tags list.");
1abbee
-                else if (j == i->ancestry_job)
1abbee
-                        log_error_errno(j->error, "Failed to retrieve ancestry list.");
1abbee
-                else if (j == i->json_job)
1abbee
-                        log_error_errno(j->error, "Failed to retrieve json data.");
1abbee
-                else
1abbee
-                        log_error_errno(j->error, "Failed to retrieve layer data.");
1abbee
-
1abbee
-                r = j->error;
1abbee
-                goto finish;
1abbee
-        }
1abbee
-
1abbee
-        if (i->images_job == j) {
1abbee
-                const char *url;
1abbee
-
1abbee
-                assert(!i->tags_job);
1abbee
-                assert(!i->ancestry_job);
1abbee
-                assert(!i->json_job);
1abbee
-                assert(!i->layer_job);
1abbee
-
1abbee
-                if (strv_isempty(i->response_registries)) {
1abbee
-                        r = -EBADMSG;
1abbee
-                        log_error("Didn't get registry information.");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                log_info("Index lookup succeeded, directed to registry %s.", i->response_registries[0]);
1abbee
-                dkr_import_report_progress(i, DKR_RESOLVING);
1abbee
-
1abbee
-                url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/repositories/", i->name, "/tags/", i->tag);
1abbee
-                r = import_job_new(&i->tags_job, url, i->glue, i);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to allocate tags job: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                r = dkr_import_add_token(i, i->tags_job);
1abbee
-                if (r < 0) {
1abbee
-                        log_oom();
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                i->tags_job->on_finished = dkr_import_job_on_finished;
1abbee
-                i->tags_job->on_progress = dkr_import_job_on_progress;
1abbee
-
1abbee
-                r = import_job_begin(i->tags_job);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to start tags job: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-        } else if (i->tags_job == j) {
1abbee
-                const char *url;
1abbee
-                char *id = NULL;
1abbee
-
1abbee
-                assert(!i->ancestry_job);
1abbee
-                assert(!i->json_job);
1abbee
-                assert(!i->layer_job);
1abbee
-
1abbee
-                r = parse_id(j->payload, j->payload_size, &id;;
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to parse JSON id.");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                free(i->id);
1abbee
-                i->id = id;
1abbee
-
1abbee
-                log_info("Tag lookup succeeded, resolved to layer %s.", i->id);
1abbee
-                dkr_import_report_progress(i, DKR_METADATA);
1abbee
-
1abbee
-                url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/ancestry");
1abbee
-                r = import_job_new(&i->ancestry_job, url, i->glue, i);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to allocate ancestry job: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                r = dkr_import_add_token(i, i->ancestry_job);
1abbee
-                if (r < 0) {
1abbee
-                        log_oom();
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                i->ancestry_job->on_finished = dkr_import_job_on_finished;
1abbee
-                i->ancestry_job->on_progress = dkr_import_job_on_progress;
1abbee
-
1abbee
-                url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/json");
1abbee
-                r = import_job_new(&i->json_job, url, i->glue, i);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to allocate json job: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                r = dkr_import_add_token(i, i->json_job);
1abbee
-                if (r < 0) {
1abbee
-                        log_oom();
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                i->json_job->on_finished = dkr_import_job_on_finished;
1abbee
-                i->json_job->on_progress = dkr_import_job_on_progress;
1abbee
-
1abbee
-                r = import_job_begin(i->ancestry_job);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to start ancestry job: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                r = import_job_begin(i->json_job);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to start json job: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-        } else if (i->ancestry_job == j) {
1abbee
-                char **ancestry = NULL, **k;
1abbee
-                unsigned n;
1abbee
-
1abbee
-                assert(!i->layer_job);
1abbee
-
1abbee
-                r = parse_ancestry(j->payload, j->payload_size, &ancestry);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to parse JSON id.");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                n = strv_length(ancestry);
1abbee
-                if (n <= 0 || !streq(ancestry[n-1], i->id)) {
1abbee
-                        log_error("Ancestry doesn't end in main layer.");
1abbee
-                        strv_free(ancestry);
1abbee
-                        r = -EBADMSG;
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                log_info("Ancestor lookup succeeded, requires layers:\n");
1abbee
-                STRV_FOREACH(k, ancestry)
1abbee
-                        log_info("\t%s", *k);
1abbee
-
1abbee
-                strv_free(i->ancestry);
1abbee
-                i->ancestry = ancestry;
1abbee
-                i->n_ancestry = n;
1abbee
-                i->current_ancestry = 0;
1abbee
-
1abbee
-                dkr_import_report_progress(i, DKR_DOWNLOADING);
1abbee
-
1abbee
-                r = dkr_import_pull_layer(i);
1abbee
-                if (r < 0)
1abbee
-                        goto finish;
1abbee
-
1abbee
-        } else if (i->layer_job == j) {
1abbee
-                assert(i->temp_path);
1abbee
-                assert(i->final_path);
1abbee
-
1abbee
-                j->disk_fd = safe_close(j->disk_fd);
1abbee
-
1abbee
-                if (i->tar_pid > 0) {
1abbee
-                        r = wait_for_terminate_and_warn("tar", i->tar_pid, true);
1abbee
-                        i->tar_pid = 0;
1abbee
-                        if (r < 0)
1abbee
-                                goto finish;
1abbee
-                }
1abbee
-
1abbee
-                r = aufs_resolve(i->temp_path);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to resolve aufs whiteouts: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                r = btrfs_subvol_set_read_only(i->temp_path, true);
1abbee
-                if (r < 0) {
1abbee
-                        log_error_errno(r, "Failed to mark snapshot read-only: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                if (rename(i->temp_path, i->final_path) < 0) {
1abbee
-                        log_error_errno(errno, "Failed to rename snaphsot: %m");
1abbee
-                        goto finish;
1abbee
-                }
1abbee
-
1abbee
-                log_info("Completed writing to layer %s.", i->final_path);
1abbee
-
1abbee
-                i->layer_job = import_job_unref(i->layer_job);
1abbee
-                free(i->temp_path);
1abbee
-                i->temp_path = NULL;
1abbee
-                free(i->final_path);
1abbee
-                i->final_path = NULL;
1abbee
-
1abbee
-                i->current_ancestry ++;
1abbee
-                r = dkr_import_pull_layer(i);
1abbee
-                if (r < 0)
1abbee
-                        goto finish;
1abbee
-
1abbee
-        } else if (i->json_job != j)
1abbee
-                assert_not_reached("Got finished event for unknown curl object");
1abbee
-
1abbee
-        if (!dkr_import_is_done(i))
1abbee
-                return;
1abbee
-
1abbee
-        dkr_import_report_progress(i, DKR_COPYING);
1abbee
-
1abbee
-        r = dkr_import_make_local_copy(i);
1abbee
-        if (r < 0)
1abbee
-                goto finish;
1abbee
-
1abbee
-        r = 0;
1abbee
-
1abbee
-finish:
1abbee
-        if (i->on_finished)
1abbee
-                i->on_finished(i, r, i->userdata);
1abbee
-        else
1abbee
-                sd_event_exit(i->event, r);
1abbee
-}
1abbee
-
1abbee
-static int dkr_import_job_on_header(ImportJob *j, const char *header, size_t sz)  {
1abbee
-        _cleanup_free_ char *registry = NULL;
1abbee
-        char *token;
1abbee
-        DkrImport *i;
1abbee
-        int r;
1abbee
-
1abbee
-        assert(j);
1abbee
-        assert(j->userdata);
1abbee
-
1abbee
-        i = j->userdata;
1abbee
-
1abbee
-        r = curl_header_strdup(header, sz, HEADER_TOKEN, &token);
1abbee
-        if (r < 0)
1abbee
-                return log_oom();
1abbee
-        if (r > 0) {
1abbee
-                free(i->response_token);
1abbee
-                i->response_token = token;
1abbee
-                return 0;
1abbee
-        }
1abbee
-
1abbee
-        r = curl_header_strdup(header, sz, HEADER_REGISTRY, &registry);
1abbee
-        if (r < 0)
1abbee
-                return log_oom();
1abbee
-        if (r > 0) {
1abbee
-                char **l, **k;
1abbee
-
1abbee
-                l = strv_split(registry, ",");
1abbee
-                if (!l)
1abbee
-                        return log_oom();
1abbee
-
1abbee
-                STRV_FOREACH(k, l) {
1abbee
-                        if (!hostname_is_valid(*k)) {
1abbee
-                                log_error("Registry hostname is not valid.");
1abbee
-                                strv_free(l);
1abbee
-                                return -EBADMSG;
1abbee
-                        }
1abbee
-                }
1abbee
-
1abbee
-                strv_free(i->response_registries);
1abbee
-                i->response_registries = l;
1abbee
-        }
1abbee
-
1abbee
-        return 0;
1abbee
-}
1abbee
-
1abbee
-int dkr_import_pull(DkrImport *i, const char *name, const char *tag, const char *local, bool force_local) {
1abbee
-        const char *url;
1abbee
-        int r;
1abbee
-
1abbee
-        assert(i);
1abbee
-
1abbee
-        if (!dkr_name_is_valid(name))
1abbee
-                return -EINVAL;
1abbee
-
1abbee
-        if (tag && !dkr_tag_is_valid(tag))
1abbee
-                return -EINVAL;
1abbee
-
1abbee
-        if (local && !machine_name_is_valid(local))
1abbee
-                return -EINVAL;
1abbee
-
1abbee
-        if (i->images_job)
1abbee
-                return -EBUSY;
1abbee
-
1abbee
-        if (!tag)
1abbee
-                tag = "latest";
1abbee
-
1abbee
-        r = free_and_strdup(&i->local, local);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-        i->force_local = force_local;
1abbee
-
1abbee
-        r = free_and_strdup(&i->name, name);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-        r = free_and_strdup(&i->tag, tag);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-
1abbee
-        url = strjoina(i->index_url, "/v1/repositories/", name, "/images");
1abbee
-
1abbee
-        r = import_job_new(&i->images_job, url, i->glue, i);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-
1abbee
-        r = dkr_import_add_token(i, i->images_job);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-
1abbee
-        i->images_job->on_finished = dkr_import_job_on_finished;
1abbee
-        i->images_job->on_header = dkr_import_job_on_header;
1abbee
-        i->images_job->on_progress = dkr_import_job_on_progress;
1abbee
-
1abbee
-        return import_job_begin(i->images_job);
1abbee
-}
1abbee
diff --git a/src/import/import-dkr.h b/src/import/import-dkr.h
1abbee
deleted file mode 100644
1abbee
index 633c767..0000000
1abbee
--- a/src/import/import-dkr.h
1abbee
+++ /dev/null
1abbee
@@ -1,36 +0,0 @@
1abbee
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1abbee
-
1abbee
-/***
1abbee
-  This file is part of systemd.
1abbee
-
1abbee
-  Copyright 2014 Lennart Poettering
1abbee
-
1abbee
-  systemd is free software; you can redistribute it and/or modify it
1abbee
-  under the terms of the GNU Lesser General Public License as published by
1abbee
-  the Free Software Foundation; either version 2.1 of the License, or
1abbee
-  (at your option) any later version.
1abbee
-
1abbee
-  systemd is distributed in the hope that it will be useful, but
1abbee
-  WITHOUT ANY WARRANTY; without even the implied warranty of
1abbee
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1abbee
-  Lesser General Public License for more details.
1abbee
-
1abbee
-  You should have received a copy of the GNU Lesser General Public License
1abbee
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
1abbee
-***/
1abbee
-
1abbee
-#pragma once
1abbee
-
1abbee
-#include "sd-event.h"
1abbee
-#include "util.h"
1abbee
-
1abbee
-typedef struct DkrImport DkrImport;
1abbee
-
1abbee
-typedef void (*DkrImportFinished)(DkrImport *import, int error, void *userdata);
1abbee
-
1abbee
-int dkr_import_new(DkrImport **import, sd_event *event, const char *index_url, const char *image_root, DkrImportFinished on_finished, void *userdata);
1abbee
-DkrImport* dkr_import_unref(DkrImport *import);
1abbee
-
1abbee
-DEFINE_TRIVIAL_CLEANUP_FUNC(DkrImport*, dkr_import_unref);
1abbee
-
1abbee
-int dkr_import_pull(DkrImport *import, const char *name, const char *tag, const char *local, bool force_local);
1abbee
diff --git a/src/import/importd.c b/src/import/importd.c
1abbee
index 1222bf3..9aaf991 100644
1abbee
--- a/src/import/importd.c
1abbee
+++ b/src/import/importd.c
1abbee
@@ -38,7 +38,6 @@ typedef struct Manager Manager;
1abbee
 typedef enum TransferType {
1abbee
         TRANSFER_TAR,
1abbee
         TRANSFER_RAW,
1abbee
-        TRANSFER_DKR,
1abbee
         _TRANSFER_TYPE_MAX,
1abbee
         _TRANSFER_TYPE_INVALID = -1,
1abbee
 } TransferType;
1abbee
@@ -56,8 +55,6 @@ struct Transfer {
1abbee
         char *local;
1abbee
         bool force_local;
1abbee
 
1abbee
-        char *dkr_index_url;
1abbee
-
1abbee
         pid_t pid;
1abbee
 
1abbee
         int log_fd;
1abbee
@@ -91,7 +88,6 @@ struct Manager {
1abbee
 static const char* const transfer_type_table[_TRANSFER_TYPE_MAX] = {
1abbee
         [TRANSFER_TAR] = "tar",
1abbee
         [TRANSFER_RAW] = "raw",
1abbee
-        [TRANSFER_DKR] = "dkr",
1abbee
 };
1abbee
 
1abbee
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(transfer_type, TransferType);
1abbee
@@ -108,7 +104,6 @@ static Transfer *transfer_unref(Transfer *t) {
1abbee
 
1abbee
         free(t->remote);
1abbee
         free(t->local);
1abbee
-        free(t->dkr_index_url);
1abbee
         free(t->object_path);
1abbee
 
1abbee
         if (t->pid > 0) {
1abbee
@@ -355,7 +350,6 @@ static int transfer_start(Transfer *t) {
1abbee
                         "--verify",
1abbee
                         NULL, /* verify argument */
1abbee
                         NULL, /* maybe --force */
1abbee
-                        NULL, /* maybe --dkr-index-url */
1abbee
                         NULL, /* the actual URL */
1abbee
                         NULL, /* remote */
1abbee
                         NULL, /* local */
1abbee
@@ -410,11 +404,6 @@ static int transfer_start(Transfer *t) {
1abbee
                 if (t->force_local)
1abbee
                         cmd[k++] = "--force";
1abbee
 
1abbee
-                if (t->dkr_index_url) {
1abbee
-                        cmd[k++] = "--dkr-index-url";
1abbee
-                        cmd[k++] = t->dkr_index_url;
1abbee
-                }
1abbee
-
1abbee
                 cmd[k++] = t->remote;
1abbee
                 if (t->local)
1abbee
                         cmd[k++] = t->local;
1abbee
@@ -624,7 +613,7 @@ static int manager_new(Manager **ret) {
1abbee
         return 0;
1abbee
 }
1abbee
 
1abbee
-static Transfer *manager_find(Manager *m, TransferType type, const char *dkr_index_url, const char *remote) {
1abbee
+static Transfer *manager_find(Manager *m, TransferType type, const char *remote) {
1abbee
         Transfer *t;
1abbee
         Iterator i;
1abbee
 
1abbee
@@ -635,8 +624,7 @@ static Transfer *manager_find(Manager *m, TransferType type, const char *dkr_ind
1abbee
         HASHMAP_FOREACH(t, m->transfers, i) {
1abbee
 
1abbee
                 if (t->type == type &&
1abbee
-                    streq_ptr(t->remote, remote) &&
1abbee
-                    streq_ptr(t->dkr_index_url, dkr_index_url))
1abbee
+                    streq_ptr(t->remote, remote))
1abbee
                         return t;
1abbee
         }
1abbee
 
1abbee
@@ -689,7 +677,7 @@ static int method_pull_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *userda
1abbee
 
1abbee
         type = streq_ptr(sd_bus_message_get_member(msg), "PullTar") ? TRANSFER_TAR : TRANSFER_RAW;
1abbee
 
1abbee
-        if (manager_find(m, type, NULL, remote))
1abbee
+        if (manager_find(m, type, remote))
1abbee
                 return sd_bus_error_setf(error, BUS_ERROR_TRANSFER_IN_PROGRESS, "Transfer for %s already in progress.", remote);
1abbee
 
1abbee
         r = transfer_new(m, &t);
1abbee
@@ -719,98 +707,6 @@ static int method_pull_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *userda
1abbee
         return sd_bus_reply_method_return(msg, "uo", id, object);
1abbee
 }
1abbee
 
1abbee
-static int method_pull_dkr(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) {
1abbee
-        _cleanup_(transfer_unrefp) Transfer *t = NULL;
1abbee
-        const char *index_url, *remote, *tag, *local, *verify, *object;
1abbee
-        Manager *m = userdata;
1abbee
-        ImportVerify v;
1abbee
-        int force, r;
1abbee
-        uint32_t id;
1abbee
-
1abbee
-        assert(bus);
1abbee
-        assert(msg);
1abbee
-        assert(m);
1abbee
-
1abbee
-        r = bus_verify_polkit_async(
1abbee
-                        msg,
1abbee
-                        CAP_SYS_ADMIN,
1abbee
-                        "org.freedesktop.import1.pull",
1abbee
-                        false,
1abbee
-                        &m->polkit_registry,
1abbee
-                        error);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-        if (r == 0)
1abbee
-                return 1; /* Will call us back */
1abbee
-
1abbee
-        r = sd_bus_message_read(msg, "sssssb", &index_url, &remote, &tag, &local, &verify, &force);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-
1abbee
-        if (isempty(index_url))
1abbee
-                index_url = DEFAULT_DKR_INDEX_URL;
1abbee
-        if (!index_url)
1abbee
-                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Index URL must be specified.");
1abbee
-        if (!http_url_is_valid(index_url))
1abbee
-                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Index URL %s is invalid", index_url);
1abbee
-
1abbee
-        if (!dkr_name_is_valid(remote))
1abbee
-                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Remote name %s is not valid", remote);
1abbee
-
1abbee
-        if (isempty(tag))
1abbee
-                tag = "latest";
1abbee
-        else if (!dkr_tag_is_valid(tag))
1abbee
-                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Tag %s is not valid", tag);
1abbee
-
1abbee
-        if (isempty(local))
1abbee
-                local = NULL;
1abbee
-        else if (!machine_name_is_valid(local))
1abbee
-                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Local name %s is invalid", local);
1abbee
-
1abbee
-        if (isempty(verify))
1abbee
-                v = IMPORT_VERIFY_SIGNATURE;
1abbee
-        else
1abbee
-                v = import_verify_from_string(verify);
1abbee
-        if (v < 0)
1abbee
-                return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown verification mode %s", verify);
1abbee
-
1abbee
-        if (v != IMPORT_VERIFY_NO)
1abbee
-                return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "DKR does not support verification.");
1abbee
-
1abbee
-        if (manager_find(m, TRANSFER_DKR, index_url, remote))
1abbee
-                return sd_bus_error_setf(error, BUS_ERROR_TRANSFER_IN_PROGRESS, "Transfer for %s already in progress.", remote);
1abbee
-
1abbee
-        r = transfer_new(m, &t);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-
1abbee
-        t->type = TRANSFER_DKR;
1abbee
-        t->verify = v;
1abbee
-        t->force_local = force;
1abbee
-
1abbee
-        t->dkr_index_url = strdup(index_url);
1abbee
-        if (!t->dkr_index_url)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        t->remote = strjoin(remote, ":", tag, NULL);
1abbee
-        if (!t->remote)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        t->local = strdup(local);
1abbee
-        if (!t->local)
1abbee
-                return -ENOMEM;
1abbee
-
1abbee
-        r = transfer_start(t);
1abbee
-        if (r < 0)
1abbee
-                return r;
1abbee
-
1abbee
-        object = t->object_path;
1abbee
-        id = t->id;
1abbee
-        t = NULL;
1abbee
-
1abbee
-        return sd_bus_reply_method_return(msg, "uo", id, object);
1abbee
-}
1abbee
-
1abbee
 static int method_list_transfers(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) {
1abbee
         _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
1abbee
         Manager *m = userdata;
1abbee
@@ -956,7 +852,6 @@ static const sd_bus_vtable manager_vtable[] = {
1abbee
         SD_BUS_VTABLE_START(0),
1abbee
         SD_BUS_METHOD("PullTar", "sssb", "uo", method_pull_tar_or_raw, SD_BUS_VTABLE_UNPRIVILEGED),
1abbee
         SD_BUS_METHOD("PullRaw", "sssb", "uo", method_pull_tar_or_raw, SD_BUS_VTABLE_UNPRIVILEGED),
1abbee
-        SD_BUS_METHOD("PullDkr", "sssssb", "uo", method_pull_dkr, SD_BUS_VTABLE_UNPRIVILEGED),
1abbee
         SD_BUS_METHOD("ListTransfers", NULL, "a(usssdo)", method_list_transfers, SD_BUS_VTABLE_UNPRIVILEGED),
1abbee
         SD_BUS_METHOD("CancelTransfer", "u", NULL, method_cancel_transfer, SD_BUS_VTABLE_UNPRIVILEGED),
1abbee
         SD_BUS_SIGNAL("TransferNew", "uo", 0),
1abbee
diff --git a/src/import/org.freedesktop.import1.conf b/src/import/org.freedesktop.import1.conf
1abbee
index ae36af4..ed2539a 100644
1abbee
--- a/src/import/org.freedesktop.import1.conf
1abbee
+++ b/src/import/org.freedesktop.import1.conf
1abbee
@@ -53,10 +53,6 @@
1abbee
                        send_member="PullRaw"/>
1abbee
 
1abbee
                 
1abbee
-                       send_interface="org.freedesktop.import1.Manager"
1abbee
-                       send_member="PullDkr"/>
1abbee
-
1abbee
-                
1abbee
                        send_interface="org.freedesktop.import1.Transfer"
1abbee
                        send_member="Cancel"/>
1abbee
 
1abbee
diff --git a/src/import/pull.c b/src/import/pull.c
1abbee
index ee3ff68..9cb1088 100644
1abbee
--- a/src/import/pull.c
1abbee
+++ b/src/import/pull.c
1abbee
@@ -28,13 +28,11 @@
1abbee
 #include "machine-image.h"
1abbee
 #include "import-tar.h"
1abbee
 #include "import-raw.h"
1abbee
-#include "import-dkr.h"
1abbee
 #include "import-util.h"
1abbee
 
1abbee
 static bool arg_force = false;
1abbee
 static const char *arg_image_root = "/var/lib/machines";
1abbee
 static ImportVerify arg_verify = IMPORT_VERIFY_SIGNATURE;
1abbee
-static const char* arg_dkr_index_url = DEFAULT_DKR_INDEX_URL;
1abbee
 
1abbee
 static int interrupt_signal_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
1abbee
         log_notice("Transfer aborted.");
1abbee
@@ -214,107 +212,6 @@ static int pull_raw(int argc, char *argv[], void *userdata) {
1abbee
         return -r;
1abbee
 }
1abbee
 
1abbee
-static void on_dkr_finished(DkrImport *import, int error, void *userdata) {
1abbee
-        sd_event *event = userdata;
1abbee
-        assert(import);
1abbee
-
1abbee
-        if (error == 0)
1abbee
-                log_info("Operation completed successfully.");
1abbee
-
1abbee
-        sd_event_exit(event, abs(error));
1abbee
-}
1abbee
-
1abbee
-static int pull_dkr(int argc, char *argv[], void *userdata) {
1abbee
-        _cleanup_(dkr_import_unrefp) DkrImport *import = NULL;
1abbee
-        _cleanup_event_unref_ sd_event *event = NULL;
1abbee
-        const char *name, *tag, *local;
1abbee
-        int r;
1abbee
-
1abbee
-        if (!arg_dkr_index_url) {
1abbee
-                log_error("Please specify an index URL with --dkr-index-url=");
1abbee
-                return -EINVAL;
1abbee
-        }
1abbee
-
1abbee
-        if (arg_verify != IMPORT_VERIFY_NO) {
1abbee
-                log_error("Imports from dkr do not support image verification, please pass --verify=no.");
1abbee
-                return -EINVAL;
1abbee
-        }
1abbee
-
1abbee
-        tag = strchr(argv[1], ':');
1abbee
-        if (tag) {
1abbee
-                name = strndupa(argv[1], tag - argv[1]);
1abbee
-                tag++;
1abbee
-        } else {
1abbee
-                name = argv[1];
1abbee
-                tag = "latest";
1abbee
-        }
1abbee
-
1abbee
-        if (!dkr_name_is_valid(name)) {
1abbee
-                log_error("Remote name '%s' is not valid.", name);
1abbee
-                return -EINVAL;
1abbee
-        }
1abbee
-
1abbee
-        if (!dkr_tag_is_valid(tag)) {
1abbee
-                log_error("Tag name '%s' is not valid.", tag);
1abbee
-                return -EINVAL;
1abbee
-        }
1abbee
-
1abbee
-        if (argc >= 3)
1abbee
-                local = argv[2];
1abbee
-        else {
1abbee
-                local = strchr(name, '/');
1abbee
-                if (local)
1abbee
-                        local++;
1abbee
-                else
1abbee
-                        local = name;
1abbee
-        }
1abbee
-
1abbee
-        if (isempty(local) || streq(local, "-"))
1abbee
-                local = NULL;
1abbee
-
1abbee
-        if (local) {
1abbee
-                if (!machine_name_is_valid(local)) {
1abbee
-                        log_error("Local image name '%s' is not valid.", local);
1abbee
-                        return -EINVAL;
1abbee
-                }
1abbee
-
1abbee
-                if (!arg_force) {
1abbee
-                        r = image_find(local, NULL);
1abbee
-                        if (r < 0)
1abbee
-                                return log_error_errno(r, "Failed to check whether image '%s' exists: %m", local);
1abbee
-                        else if (r > 0) {
1abbee
-                                log_error_errno(EEXIST, "Image '%s' already exists.", local);
1abbee
-                                return -EEXIST;
1abbee
-                        }
1abbee
-                }
1abbee
-
1abbee
-                log_info("Pulling '%s' with tag '%s', saving as '%s'.", name, tag, local);
1abbee
-        } else
1abbee
-                log_info("Pulling '%s' with tag '%s'.", name, tag);
1abbee
-
1abbee
-        r = sd_event_default(&event);
1abbee
-        if (r < 0)
1abbee
-                return log_error_errno(r, "Failed to allocate event loop: %m");
1abbee
-
1abbee
-        assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
1abbee
-        sd_event_add_signal(event, NULL, SIGTERM, interrupt_signal_handler,  NULL);
1abbee
-        sd_event_add_signal(event, NULL, SIGINT, interrupt_signal_handler, NULL);
1abbee
-
1abbee
-        r = dkr_import_new(&import, event, arg_dkr_index_url, arg_image_root, on_dkr_finished, event);
1abbee
-        if (r < 0)
1abbee
-                return log_error_errno(r, "Failed to allocate importer: %m");
1abbee
-
1abbee
-        r = dkr_import_pull(import, name, tag, local, arg_force);
1abbee
-        if (r < 0)
1abbee
-                return log_error_errno(r, "Failed to pull image: %m");
1abbee
-
1abbee
-        r = sd_event_loop(event);
1abbee
-        if (r < 0)
1abbee
-                return log_error_errno(r, "Failed to run event loop: %m");
1abbee
-
1abbee
-        log_info("Exiting.");
1abbee
-        return -r;
1abbee
-}
1abbee
 
1abbee
 static int help(int argc, char *argv[], void *userdata) {
1abbee
 
1abbee
@@ -326,11 +223,9 @@ static int help(int argc, char *argv[], void *userdata) {
1abbee
                "     --verify=                Verify downloaded image, one of: 'no',\n"
1abbee
                "                              'checksum', 'signature'.\n"
1abbee
                "     --image-root=            Image root directory\n"
1abbee
-               "     --dkr-index-url=URL      Specify index URL to use for downloads\n\n"
1abbee
                "Commands:\n"
1abbee
                "  tar URL [NAME]              Download a TAR image\n"
1abbee
-               "  raw URL [NAME]              Download a RAW image\n"
1abbee
-               "  dkr REMOTE [NAME]           Download a DKR image\n",
1abbee
+               "  raw URL [NAME]              Download a RAW image\n",
1abbee
                program_invocation_short_name);
1abbee
 
1abbee
         return 0;
1abbee
@@ -341,7 +236,6 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
         enum {
1abbee
                 ARG_VERSION = 0x100,
1abbee
                 ARG_FORCE,
1abbee
-                ARG_DKR_INDEX_URL,
1abbee
                 ARG_IMAGE_ROOT,
1abbee
                 ARG_VERIFY,
1abbee
         };
1abbee
@@ -350,7 +244,6 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                 { "help",            no_argument,       NULL, 'h'                 },
1abbee
                 { "version",         no_argument,       NULL, ARG_VERSION         },
1abbee
                 { "force",           no_argument,       NULL, ARG_FORCE           },
1abbee
-                { "dkr-index-url",   required_argument, NULL, ARG_DKR_INDEX_URL   },
1abbee
                 { "image-root",      required_argument, NULL, ARG_IMAGE_ROOT      },
1abbee
                 { "verify",          required_argument, NULL, ARG_VERIFY          },
1abbee
                 {}
1abbee
@@ -377,15 +270,6 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                         arg_force = true;
1abbee
                         break;
1abbee
 
1abbee
-                case ARG_DKR_INDEX_URL:
1abbee
-                        if (!http_url_is_valid(optarg)) {
1abbee
-                                log_error("Index URL is not valid: %s", optarg);
1abbee
-                                return -EINVAL;
1abbee
-                        }
1abbee
-
1abbee
-                        arg_dkr_index_url = optarg;
1abbee
-                        break;
1abbee
-
1abbee
                 case ARG_IMAGE_ROOT:
1abbee
                         arg_image_root = optarg;
1abbee
                         break;
1abbee
@@ -415,7 +299,6 @@ static int import_main(int argc, char *argv[]) {
1abbee
                 { "help", VERB_ANY, VERB_ANY, 0, help     },
1abbee
                 { "tar",  2,        3,        0, pull_tar },
1abbee
                 { "raw",  2,        3,        0, pull_raw },
1abbee
-                { "dkr",  2,        3,        0, pull_dkr },
1abbee
                 {}
1abbee
         };
1abbee
 
1abbee
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
1abbee
index ef1214a..cfd3162 100644
1abbee
--- a/src/machine/machinectl.c
1abbee
+++ b/src/machine/machinectl.c
1abbee
@@ -77,7 +77,6 @@ static unsigned arg_lines = 10;
1abbee
 static OutputMode arg_output = OUTPUT_SHORT;
1abbee
 static bool arg_force = false;
1abbee
 static ImportVerify arg_verify = IMPORT_VERIFY_SIGNATURE;
1abbee
-static const char* arg_dkr_index_url = NULL;
1abbee
 
1abbee
 static void pager_open_if_enabled(void) {
1abbee
 
1abbee
@@ -1998,78 +1997,6 @@ static int pull_raw(int argc, char *argv[], void *userdata) {
1abbee
         return pull_image_common(bus, m);
1abbee
 }
1abbee
 
1abbee
-static int pull_dkr(int argc, char *argv[], void *userdata) {
1abbee
-        _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
1abbee
-        const char *local, *remote, *tag;
1abbee
-        sd_bus *bus = userdata;
1abbee
-        int r;
1abbee
-
1abbee
-        if (arg_verify != IMPORT_VERIFY_NO) {
1abbee
-                log_error("Imports from DKR do not support image verification, please pass --verify=no.");
1abbee
-                return -EINVAL;
1abbee
-        }
1abbee
-
1abbee
-        remote = argv[1];
1abbee
-        tag = strchr(remote, ':');
1abbee
-        if (tag) {
1abbee
-                remote = strndupa(remote, tag - remote);
1abbee
-                tag++;
1abbee
-        }
1abbee
-
1abbee
-        if (!dkr_name_is_valid(remote)) {
1abbee
-                log_error("DKR name '%s' is invalid.", remote);
1abbee
-                return -EINVAL;
1abbee
-        }
1abbee
-        if (tag && !dkr_tag_is_valid(tag)) {
1abbee
-                log_error("DKR tag '%s' is invalid.", remote);
1abbee
-                return -EINVAL;
1abbee
-        }
1abbee
-
1abbee
-        if (argc >= 3)
1abbee
-                local = argv[2];
1abbee
-        else {
1abbee
-                local = strchr(remote, '/');
1abbee
-                if (local)
1abbee
-                        local++;
1abbee
-                else
1abbee
-                        local = remote;
1abbee
-        }
1abbee
-
1abbee
-        if (isempty(local) || streq(local, "-"))
1abbee
-                local = NULL;
1abbee
-
1abbee
-        if (local) {
1abbee
-                if (!machine_name_is_valid(local)) {
1abbee
-                        log_error("Local name %s is not a suitable machine name.", local);
1abbee
-                        return -EINVAL;
1abbee
-                }
1abbee
-        }
1abbee
-
1abbee
-        r = sd_bus_message_new_method_call(
1abbee
-                        bus,
1abbee
-                        &m,
1abbee
-                        "org.freedesktop.import1",
1abbee
-                        "/org/freedesktop/import1",
1abbee
-                        "org.freedesktop.import1.Manager",
1abbee
-                        "PullDkr");
1abbee
-        if (r < 0)
1abbee
-                return bus_log_create_error(r);
1abbee
-
1abbee
-        r = sd_bus_message_append(
1abbee
-                        m,
1abbee
-                        "sssssb",
1abbee
-                        arg_dkr_index_url,
1abbee
-                        remote,
1abbee
-                        tag,
1abbee
-                        local,
1abbee
-                        import_verify_to_string(arg_verify),
1abbee
-                        arg_force);
1abbee
-        if (r < 0)
1abbee
-                return bus_log_create_error(r);
1abbee
-
1abbee
-        return pull_image_common(bus, m);
1abbee
-}
1abbee
-
1abbee
 typedef struct TransferInfo {
1abbee
         uint32_t id;
1abbee
         const char *type;
1abbee
@@ -2237,8 +2164,6 @@ static int help(int argc, char *argv[], void *userdata) {
1abbee
                "      --verify=MODE           Verification mode for downloaded images (no,\n"
1abbee
                "                              checksum, signature)\n"
1abbee
                "      --force                 Download image even if already exists\n"
1abbee
-               "      --dkr-index-url=URL     Specify the index URL to use for DKR image\n"
1abbee
-               "                              downloads\n\n"
1abbee
                "Machine Commands:\n"
1abbee
                "  list                        List running VMs and containers\n"
1abbee
                "  status NAME...              Show VM/container details\n"
1abbee
@@ -2265,7 +2190,6 @@ static int help(int argc, char *argv[], void *userdata) {
1abbee
                "Image Transfer Commands:\n"
1abbee
                "  pull-tar URL [NAME]         Download a TAR container image\n"
1abbee
                "  pull-raw URL [NAME]         Download a RAW container or VM image\n"
1abbee
-               "  pull-dkr REMOTE [NAME]      Download a DKR container image\n"
1abbee
                "  list-transfers              Show list of downloads in progress\n"
1abbee
                "  cancel-transfer             Cancel a download\n"
1abbee
                , program_invocation_short_name);
1abbee
@@ -2284,8 +2208,7 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                 ARG_MKDIR,
1abbee
                 ARG_NO_ASK_PASSWORD,
1abbee
                 ARG_VERIFY,
1abbee
-                ARG_FORCE,
1abbee
-                ARG_DKR_INDEX_URL,
1abbee
+                ARG_FORCE
1abbee
         };
1abbee
 
1abbee
         static const struct option options[] = {
1abbee
@@ -2308,7 +2231,6 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                 { "no-ask-password", no_argument,       NULL, ARG_NO_ASK_PASSWORD },
1abbee
                 { "verify",          required_argument, NULL, ARG_VERIFY          },
1abbee
                 { "force",           no_argument,       NULL, ARG_FORCE           },
1abbee
-                { "dkr-index-url",   required_argument, NULL, ARG_DKR_INDEX_URL   },
1abbee
                 {}
1abbee
         };
1abbee
 
1abbee
@@ -2421,15 +2343,6 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                         arg_force = true;
1abbee
                         break;
1abbee
 
1abbee
-                case ARG_DKR_INDEX_URL:
1abbee
-                        if (!http_url_is_valid(optarg)) {
1abbee
-                                log_error("Index URL is invalid: %s", optarg);
1abbee
-                                return -EINVAL;
1abbee
-                        }
1abbee
-
1abbee
-                        arg_dkr_index_url = optarg;
1abbee
-                        break;
1abbee
-
1abbee
                 case '?':
1abbee
                         return -EINVAL;
1abbee
 
1abbee
@@ -2467,7 +2380,6 @@ static int machinectl_main(int argc, char *argv[], sd_bus *bus) {
1abbee
                 { "disable",         2,        VERB_ANY, 0,            enable_machine    },
1abbee
                 { "pull-tar",        2,        3,        0,            pull_tar          },
1abbee
                 { "pull-raw",        2,        3,        0,            pull_raw          },
1abbee
-                { "pull-dkr",        2,        3,        0,            pull_dkr          },
1abbee
                 { "list-transfers",  VERB_ANY, 1,        0,            list_transfers    },
1abbee
                 { "cancel-transfer", 2,        VERB_ANY, 0,            cancel_transfer   },
1abbee
                 {}
1abbee
diff --git a/src/shared/import-util.c b/src/shared/import-util.c
1abbee
index 660d92a..c0aba30 100644
1abbee
--- a/src/shared/import-util.c
1abbee
+++ b/src/shared/import-util.c
1abbee
@@ -149,34 +149,3 @@ int raw_strip_suffixes(const char *p, char **ret) {
1abbee
 
1abbee
         return 0;
1abbee
 }
1abbee
-
1abbee
-bool dkr_name_is_valid(const char *name) {
1abbee
-        const char *slash, *p;
1abbee
-
1abbee
-        if (isempty(name))
1abbee
-                return false;
1abbee
-
1abbee
-        slash = strchr(name, '/');
1abbee
-        if (!slash)
1abbee
-                return false;
1abbee
-
1abbee
-        if (!filename_is_valid(slash + 1))
1abbee
-                return false;
1abbee
-
1abbee
-        p = strndupa(name, slash - name);
1abbee
-        if (!filename_is_valid(p))
1abbee
-                return false;
1abbee
-
1abbee
-        return true;
1abbee
-}
1abbee
-
1abbee
-bool dkr_id_is_valid(const char *id) {
1abbee
-
1abbee
-        if (!filename_is_valid(id))
1abbee
-                return false;
1abbee
-
1abbee
-        if (!in_charset(id, "0123456789abcdef"))
1abbee
-                return false;
1abbee
-
1abbee
-        return true;
1abbee
-}
1abbee
diff --git a/src/shared/import-util.h b/src/shared/import-util.h
1abbee
index ff155b0..22773c5 100644
1abbee
--- a/src/shared/import-util.h
1abbee
+++ b/src/shared/import-util.h
1abbee
@@ -41,7 +41,3 @@ ImportVerify import_verify_from_string(const char *s) _pure_;
1abbee
 
1abbee
 int tar_strip_suffixes(const char *name, char **ret);
1abbee
 int raw_strip_suffixes(const char *name, char **ret);
1abbee
-
1abbee
-bool dkr_name_is_valid(const char *name);
1abbee
-bool dkr_id_is_valid(const char *id);
1abbee
-#define dkr_tag_is_valid(tag) filename_is_valid(tag)