]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/import/import-common.h
importd: add support for downloading sysext/confext/portable images too
[thirdparty/systemd.git] / src / import / import-common.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <sys/types.h>
5
6 #include "sd-event.h"
7
8 typedef enum ImportFlags {
9 IMPORT_FORCE = 1 << 0, /* replace existing image */
10 IMPORT_READ_ONLY = 1 << 1, /* make generated image read-only */
11 IMPORT_BTRFS_SUBVOL = 1 << 2, /* tar: preferably create images as btrfs subvols */
12 IMPORT_BTRFS_QUOTA = 1 << 3, /* tar: set up btrfs quota for new subvolume as child of parent subvolume */
13 IMPORT_CONVERT_QCOW2 = 1 << 4, /* raw: if we detect a qcow2 image, unpack it */
14 IMPORT_DIRECT = 1 << 5, /* import without rename games */
15 IMPORT_SYNC = 1 << 6, /* fsync() right before we are done */
16
17 /* When pulling these flags are defined too */
18 IMPORT_PULL_SETTINGS = 1 << 7, /* download .nspawn settings file */
19 IMPORT_PULL_ROOTHASH = 1 << 8, /* only for raw: download .roothash file for verity */
20 IMPORT_PULL_ROOTHASH_SIGNATURE = 1 << 9, /* only for raw: download .roothash.p7s file for verity */
21 IMPORT_PULL_VERITY = 1 << 10, /* only for raw: download .verity file for verity */
22
23 /* The supported flags for the tar and the raw importing */
24 IMPORT_FLAGS_MASK_TAR = IMPORT_FORCE|IMPORT_READ_ONLY|IMPORT_BTRFS_SUBVOL|IMPORT_BTRFS_QUOTA|IMPORT_DIRECT|IMPORT_SYNC,
25 IMPORT_FLAGS_MASK_RAW = IMPORT_FORCE|IMPORT_READ_ONLY|IMPORT_CONVERT_QCOW2|IMPORT_DIRECT|IMPORT_SYNC,
26
27 /* The supported flags for the tar and the raw pulling */
28 IMPORT_PULL_FLAGS_MASK_TAR = IMPORT_FLAGS_MASK_TAR|IMPORT_PULL_SETTINGS,
29 IMPORT_PULL_FLAGS_MASK_RAW = IMPORT_FLAGS_MASK_RAW|IMPORT_PULL_SETTINGS|IMPORT_PULL_ROOTHASH|IMPORT_PULL_ROOTHASH_SIGNATURE|IMPORT_PULL_VERITY,
30
31 _IMPORT_FLAGS_INVALID = -EINVAL,
32 } ImportFlags;
33
34 int import_fork_tar_c(const char *path, pid_t *ret);
35 int import_fork_tar_x(const char *path, pid_t *ret);
36
37 int import_mangle_os_tree(const char *path);
38
39 bool import_validate_local(const char *name, ImportFlags flags);
40
41 int import_allocate_event_with_signals(sd_event **ret);