用 borgmatic 导出数据库备份并定向恢复

备份正在运行的数据库,不能简单理解为把数据库目录复制一遍。内部文件可能在读取过程中发生变化;对大多数数据库系统,更合适的起点是先由数据库自己的导出工具生成一致性快照,再把导出结果送进备份仓库。borgmatic 把这个过程接入 Borg 备份流程,也提供从归档中选择数据库并恢复的入口。

本文完整整理官方《How to backup your databases》的备份、容器、恢复、版本限制与排障内容,并补核环境变量及运行时目录文档。它以 2026 年 10 月 5 日读取的滚动文档为准,涉及从 1.5.3 到 2.1.9 的多个版本边界。所有配置和命令只做了静态审阅;没有运行 Borg/borgmatic、接触实际数据库或发送监控事件。

数据库导出后进入 Borg 归档,再按来源选择并恢复到预先建立的隔离数据库;来源筛选与恢复目标是不同参数
未完纪绘制的备份与恢复流程图,不是实际执行结果。

先把数据库导出接进现有备份配置

在已经配置好 Borg 仓库的 borgmatic 配置中,下面这些片段会导出本机两个 PostgreSQL 数据库和一个 MySQL 数据库:

postgresql_databases:
  - name: users
  - name: orders
mysql_databases:
  - name: posts

这些只是数据库部分,不是完整的仓库初始化方案;数据库客户端、连接认证与所需权限仍须可用。1.8.0 之前,这些选项放在 hooks:下面,不能把当前顶层写法直接复制到旧版。

每次备份时,borgmatic 为配置的数据库生成导出流,并直接送给 Borg,通常无需先存下一份完整的临时 dump。例外是 PostgreSQL 与 MongoDB 的 directory格式,以及 InfluxDB:它们需要临时磁盘空间。1.5.3 之前,所有数据库导出都会占用临时磁盘。

为了读取导出流,数据库钩子会隐式启用 read_special,即使你在配置里把它设为假。这个行为与普通文件备份的边界有关,后文会单独说明。

远程连接、凭据与格式

官方示例覆盖 PostgreSQL、MariaDB、MySQL、MongoDB、InfluxDB、SQLite 和 OpenLDAP。远程数据库一般需配置 hostname、port、username和认证方式;PostgreSQL 还展示了 label、format: tar与 options: "--role=someone"。MongoDB 示例指定认证数据库,SQLite 指定数据库文件路径,OpenLDAP 则使用 cn=config或目录树名称。

原文风险:示例多次直接写入演示密码 trustsome1,并在 InfluxDB 中同时设置 tls: true与 verify_tls: false。这个密码不是本次发现的真实秘密,但照抄为固定密码会形成不安全默认值;关闭证书验证会失去对服务器身份的有效校验。

以下是编辑修订的配置片段:用已经由运行环境注入的变量提供密码,不设置默认密码,并将 InfluxDB 的证书验证设为真。账号名和主机名都只是示例;必须按所选数据库确认实际所需权限与受信证书。

postgresql_databases:
  - name: users
    label: database_server1
    hostname: database1.example.org
    username: backup_user
    password: ${BACKUP_DB_PASSWORD}
    format: custom

influxdb_databases:
  - name: all
    hostname: database6.example.org
    port: 8087
    tls: true
    verify_tls: true
    password: ${INFLUX_BACKUP_PASSWORD}
    organization_name: BorgCorp

sqlite_databases:
  - name: mydb
    path: /var/lib/sqlite3/mydb.sqlite

openldap_databases:
  - name: cn=config
  - name: dc=example,dc=com

环境变量插值自 1.6.4 起支持,必须写成 ${VARIABLE},不能省掉花括号;不提供默认值时,变量缺失会报错。环境变量也可能被子进程或操作系统进程信息看到,因此它只是避免把秘密写死到 YAML 的一种办法,不等于保险箱。官方还支持外部凭据来源,应按部署环境选择。不要把真实密码放到命令行历史或提交进版本库。

本文不展开每个数据库客户端的全部专用参数。导出、列库与恢复时支持哪些参数,应继续查对应的数据源文档;这也决定了 TLS、权限和备份一致性的具体约束。

全部数据库与名称匹配

PostgreSQL、MariaDB、MySQL、MongoDB 与 InfluxDB 支持 name: all。PostgreSQL 在导出所有库时可能需要 postgres超级用户权限;这不能推广成所有备份一律以超级用户运行。SQLite 不把 all当特殊名称,OpenLDAP 则不接受它。

自 1.7.6 起,PostgreSQL、MariaDB 和 MySQL 可以把“全部数据库”分别导出,便于以后只恢复其中一个。做法是在 all条目下明确指定格式:

postgresql_databases:
  - name: all
    format: custom
mariadb_databases:
  - name: all
    format: sql
mysql_databases:
  - name: all
    format: sql

自 2.1.9 起,上述三种数据库还可在名称中使用 *模式,例如 PostgreSQL 的 "users_*"、MariaDB 的 "*sessions"或 MySQL 的 "beta*db"。YAML 中带星号的模式应保留引号;恢复命令中同样要加引号,以免先被 shell 当作本地文件通配符展开。

数据库在容器里时,先决定客户端在哪里运行

需要区分“数据库服务器在容器中”和“导出客户端也在容器中”。通常 borgmatic 在自身所在环境运行 pg_dump等客户端,然后连接配置的主机与端口。

如果 borgmatic 与数据库都在可互通的容器网络中,使用数据库容器名称作为 hostname,并填写服务器在该网络实际监听的端口。不要把文档中的 5433 机械当成 PostgreSQL 默认端口。

borgmatic 在宿主机时,2.0.8 起可用 container:指定容器名或 ID,让 borgmatic 通过 docker或 podman找出容器 IP。它要求相应命令在运行环境可用;borgmatic 本身在容器里且无法访问容器运行时的情况下,不会因此自动获得这项能力。更老的版本可以把数据库端口发布到宿主机,再连接 localhost的发布端口。编辑建议是只绑定必要的本地接口,不为备份演练额外暴露公网服务。

如果宿主机没有数据库客户端,也可以覆盖导出命令,让它在已运行的数据库容器内执行:

postgresql_databases:
  - name: users
    hostname: 127.0.0.1
    port: 5433
    username: postgres
    password: ${BACKUP_DB_PASSWORD}
    pg_dump_command: docker exec my_pg_container pg_dump

这里仅把原文固定密码替换为外部变量,未改变命令含义。恢复时还需相应配置 pg_restore_command与 psql_command。原文提到利用容器内 localhost 的 trust认证,但实际是否如此取决于容器的数据库配置;不应为了让示例工作就放宽认证,也不应假定所有容器默认信任本地连接。

跨容器传密码的限制

MariaDB 客户端在另一容器中运行时,原文使用下面的传递方式:

mariadb_databases:
  - name: users
    hostname: 127.0.0.1
    username: example
    password: ${BACKUP_DB_PASSWORD}
    password_transport: environment
    mariadb_dump_command: docker exec --env MYSQL_PWD my_mariadb_container mariadb-dump

password_transport: environment让密码通过环境变量传递,替代默认匿名管道。官方明确指出环境变量方式可能更不安全,但当客户端与 borgmatic 分处容器时可能需要它。MySQL 可对应使用 mysql_dump_command与 mysqldump。MariaDB/MySQL 的具体命令行标志应放在 options、list_options或 restore_options,而不是任意混入客户端命令配置。

MongoDB 的对应选项是 password_transport: file:通过临时文件代替命名管道,并把运行时目录挂载进数据库容器,让 mongodump能读取文件。这个临时文件也可能比管道更易泄露;需要严格限制目录权限与可访问容器。

另一种办法是每次启动临时客户端容器,例如原文的 docker run --rm --env PGPASSWORD postgres:17-alpine pg_dump。--env PGPASSWORD用于将 borgmatic 提供的密码带入临时容器。镜像标签并非不可变版本;部署时应核对客户端与服务器兼容性并固定可信镜像。这些客户端覆盖值属于可执行配置,不应把不可信文本拼入其中。

运行时目录必须让双方看到同一条路径

对 directory格式和 InfluxDB,导出结果先落在临时磁盘。如果客户端在容器内,borgmatic 在宿主机,就要把运行时目录以相同路径挂进容器,否则导出文件留在容器内部,Borg 无法读取。

# borgmatic 配置片段
user_runtime_directory: /tmp/backup-tmp
# Compose 配置片段
services:
  influxdb:
    volumes:
      - /tmp/backup-tmp:/tmp/backup-tmp

这还要求两侧实际使用的用户具有必要读写权限,磁盘容量足以容纳导出,且目录不被无关用户读取。不要为省事把整个运行时根目录或容器引擎 socket 暴露给不可信容器。

如果 borgmatic 是 systemd 服务,PrivateTmp=yes会改变服务内看到的 /tmp。原文建议按服务设置用 BindPaths映射需要的目录,确保容器和服务指向同一实际位置。运行时目录文档另说明:1.9.0 起使用这一目录机制,2.1.8 起在选出的目录内统一使用随机 borgmatic-子目录。临时文件清理服务也可能中途删掉 /tmp内容;应选择合适目录或设置针对性的清理排除。

只备份数据库,也要保存恢复所需配置

1.7.1 起,如果不备份普通目录,可以省略 source_directories。更旧的版本仍要求这个配置项,应在旧版 location:节下写空列表。不要混用旧版分节结构和当前顶层结构。

恢复时必须能取得数据库配置。1.7.15 起 borgmatic 自动把配置文件加入备份,可结合 config bootstrap恢复配置;更早版本要自行纳入。由于配置可能含秘密,自动备份配置也意味着仓库和解密材料需要妥善保护。尚未原生支持的数据库,可以用准备与清理钩子运行数据库官方导出工具,但这部分脚本的正确性需要自行验证。

恢复前:选归档,确认这是覆盖操作

borgmatic restore会用选定 dump 替换现有数据库内容,而且当前不会自动创建目标数据库。目标必须已存在。先在隔离环境预建目标、核对连接参数与归档,再考虑真正执行;下面命令均为语法说明,本次没有运行。

borgmatic repo-list

repo-list用于查看归档名和时间。旧版没有这个 action 时,原文建议查看 rlist或 list,也可升级。--archive接受归档名称或哈希;latest是一种便捷选择,但重要恢复应记录实际选定的归档,避免把“最新”当成永远不变的身份。

配置文件与仓库也必须明确选择:如果没有 --config,borgmatic 会尝试对发现的每个配置文件执行恢复;如果配置了多个仓库,则应通过 --repository指定路径或标签。

# 覆盖写入命令示例:仅面向已经预建的隔离目标
borgmatic restore \
  --config /path/to/isolated-restore.yaml \
  --repository repo.borg \
  --archive host-2023-01-02T04:06:07.080910 \
  --database users \
  --hostname 127.0.0.1 \
  --port 55432 \
  --username restore_user

编辑修订:这条组合命令相较原文明确配置、仓库、具体归档与隔离目标,省去会进入命令历史的 --password。它不是现成可运行配置;密码与仓库信息必须在独立受控配置/凭据来源中准备好。这里的 55432 也只有在隔离服务确实监听该端口时才有意义。

选择哪份数据库,与写入哪里是两件事

--database可重复使用,例如 --database users --database orders。2.1.9 起还支持 --database 'users_*'匹配多个库。对以 name: all备份的 PostgreSQL、MariaDB 和 MySQL,只有通过适当 format分别导出,才方便单库恢复。

1.9.5 起,可进一步区分同名但来源主机、端口或钩子不同的数据库:

选择参数 实际含义
--original-hostname host1.example.org 只选择当初来自该主机的备份。
--original-port 5433 只选择当初来自该端口、且配置能匹配的备份。
--hook postgresql 只选择通过 postgresql_databases钩子导出的备份。

这些选择参数不改变恢复目的地。如果要换目标,1.7.15 起可使用 --hostname、--port、--username等恢复连接参数,或配置 restore_hostname、restore_port、restore_username与 restore_password:

postgresql_databases:
  - name: users
    hostname: database1.example.org
    restore_hostname: 127.0.0.1
    restore_port: 55432
    restore_username: restore_user
    restore_password: ${RESTORE_DB_PASSWORD}

这个片段修正了原页面恢复配置示例中过深的缩进,并把固定密码与远程演示目的地改成外部变量和隔离端口;字段彼此同级。原来源 hostname与恢复目标 restore_hostname保留不同值,便于识别其职责。

省略 --database,或设置 --database all,会恢复选定归档中的所有数据库 dump。1.7.6 起,“all”包含名为 all 的组合 dump 和其余单独 dump;此前只恢复组合 all 文件。不要把这个默认行为误认成“仅恢复配置中当前关心的一个库”。

1.7.13 起 PostgreSQL 和 MongoDB 支持用 --schema限制到备份中的指定 schema,例如 --database users --schema tenant1。这里把原文示例中的 tentant1改成了较清楚的示例名 tenant1;真实名称必须来自实际 dump。

需要手工恢复时

可以先提取包含数据库 dump 的归档,再用 pg_restore、mysql、mongorestore或对应原生工具恢复。当前导出的 dump 位于提取目的地下的 borgmatic/目录;若提取到 /tmp,就是 /tmp/borgmatic/。

1.9.0 之前,路径包含创建备份的 Unix 用户主目录,例如 root 用户对应 /tmp/root/.borgmatic。旧版还要求以创建归档时同一个 Unix 用户恢复。应先识别归档中的真实路径与格式,不要仅凭当前目录结构猜测旧备份。

read_special 与旧版限制不能忽略

数据库流式备份需要 Borg 读取特殊文件。borgmatic 因此会传入 --read-special,并自动排除其他可能让 Borg 卡住的特殊文件及其符号链接。然而,排除列表生成后,其他应用还可能创建新的特殊文件,仍会造成挂起。对这些路径需手工排除。

若明确设置 read_special: true,会退出自动排除机制,转而由你负责排除。1.7.3 之前也没有自动排除;/dev、/run是常见需考虑的路径,但并非完整清单。排除过于复杂时,原文建议把普通文件备份与数据库备份分成两个配置,使数据库的 read_special不影响另一份文件备份。

另外,1.9.5 之前不支持对不同主机或端口上的完全同名数据库正确进行这类备份/恢复区分。1.9.0 之前数据库钩子还会隐式启用 one_file_system,不跨文件系统查找文件,因此容器里可能要把每个挂载卷分别加入 source_directories;1.9.0 起不再自动启用这一选项,不应沿用过期绕行办法而不检查覆盖范围。

认证、锁表与挂起问题怎么查

认证失败时,可以提高到 --verbosity 2查看诊断,但密码不会因为提高日志级别就应该出现。borgmatic 对 PostgreSQL、MariaDB 和 MySQL 通过环境变量或匿名管道传密码;问题往往出在数据库端的连接权限与认证规则,例如 PostgreSQL 的 pg_hba.conf。不要通过在日志中打印密码来排查。

MariaDB/MySQL 还可能从 ~/mariadb.cnf或 ~/.my.cnf读到部分凭据,产生“配置中的用户名加上默认文件中的另一份密码”这种非预期组合,需要检查最终生效来源。

遇到表锁错误,原文建议通过 options: "--single-transaction"使用事务式导出。2.0.13 起 borgmatic 默认给 MariaDB/MySQL 传入此选项,通常无需重复配置。事务选项也不能自动保证所有存储引擎、DDL 变更或跨库业务过程的一致性,仍应按数据库自身约束安排备份。

若备份挂住,则回到特殊文件与运行时目录检查:命名管道、块设备、字符设备或 socket 都可能相关。不要仅因为某次任务结束正常,就把它等同于恢复演练成功。

本稿的审阅结论

这套流程能覆盖“导出、入仓库、选择备份、写入目标”的闭环,但真正的恢复能力还需在隔离目标上演练并检查业务数据。本文没有实施这项演练,也没有验证数据库权限、存储容量、客户端兼容性或备份内容完整性。

静态审阅确认了原文固定演示密码、关闭 TLS 验证、恢复覆盖风险、容器凭据传递和可执行配置边界;没有发现真实秘密不代表配置可以直接投产。文中修订均已标明,与原文不同之处不应归为原作者承诺。


原文:How to backup your databases,borgmatic 官方文档贡献者,原页未列个人作者。中文译编与示意图:未完纪,2026-10-05。项目官方只读镜像声明 borgmatic 采用 GNU GPL version 3 or later;完整 GPL 许可在本文下方完整保留。原页未另外声明独立的单页许可,本稿保留项目许可线索与原作者归属,不冒称另有宽松许可。

版权与许可全文

GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.
  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.
  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.
                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.
  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.
  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.
  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.
  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.
    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".
    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.
    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.
  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.
    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.
    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.
    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.
    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.
  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or
    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or
    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.
  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.
  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.
  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.
  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.
  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".
  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.
  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
  13. Use with the GNU Affero General Public License.
  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.
  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  16. Limitation of Liability.
  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS
            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    {one line to give the program's name and a brief idea of what it does.}
    Copyright (C) {year}  {name of author}
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
    {project}  Copyright (C) {year}  {fullname}
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

配置示例中的改写由未完纪于2026-10-05完成;适用项目代码许可的配置改编继续按 GNU GPL 第3版或任何后续版本提供。该项目许可声明与单篇网页转载权利分别记录,原作者和来源均保留。正文公开列出的配置文本为可修改的源形式。

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容