为了创建一个镜像,必须定义一个源。源部分定义如下:

source:
    downloader: <string> # required
    url: <string>
    keys: <array>
    keyserver: <string>
    variant: <string>
    suite: <string>
    same_as: <boolean>
    skip_verification: <boolean>
    components: <array>

downloader 字段定义了一个下载器,它会拉取一个将用作起点的根文件系统镜像。它需要是以下之一:

  • alpinelinux-http

  • alt-http

  • apertis-http

  • archlinux-http

  • centos-http

  • debootstrap

  • docker-http

  • fedora-http

  • funtoo-http

  • gentoo-http

  • nixos-http

  • openeuler-http

  • opensuse-http

  • openwrt-http

  • oraclelinux-http

  • sabayon-http

  • rootfs-http

  • ubuntu-http

  • voidlinux-http

url 字段定义了根文件系统镜像的 URL 或镜像地址。虽然此字段不是必需的,但大多数下载器都需要它。 rootfs-http 下载器还支持以 file:// 为前缀的本地镜像文件,例如 url: file:///home/user/image.tar.gzurl: file:///home/user/image.squashfs

keys 字段是一个 GPG 密钥列表。这些密钥可以列为指纹或加密密钥。后者的好处是不必依赖密钥服务器从服务器下载密钥。如果从不安全的源(HTTP)下载,则这些密钥用于验证下载的根文件系统 tarball。

keyserver 默认为 hkps.pool.sks-keyservers.net,如果未提供则使用此默认值。

variant 字段仅在少数发行版中使用,默认为 default。以下是下载器及其可能的变体的列表:

  • centos-http: minimal, netinstall, LiveDVD

  • debootstrap: default, minbase, buildd, fakechroot

  • ubuntu-http: default, core

  • voidlinux-http: default, musl

所有其他下载器都会忽略此字段。

suite 字段仅由 debootstrap 下载器使用。如果设置,debootstrap 将使用 suite 而不是 image.release 作为其第一个位置参数。

如果设置了 same_as 字段,distrobuilder 会在 /usr/share/debootstrap/scripts 中创建一个指向该目录内 same_as 文件的临时符号链接。如果您想运行 debootstrap foo 但由于 debootstrap 未更新而缺少 foo,则可以使用此功能。

如果 skip_verification 为 true,则不会验证源 tarball。

如果设置了 components 字段,debootstrap 将使用列出的组件中的包。

如果一个包集启用了 early 标志,则该包列表将在下载源时安装。(请注意,early 包仅受 debootstrap 下载器支持。)