| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="sysupdate.d" conditional='ENABLE_SYSUPDATE' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>sysupdate.d</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>sysupdate.d</refentrytitle> |
| 16 |
<manvolnum>5</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>sysupdate.d</refname> |
| 21 |
<refpurpose>Transfer Definition Files for Automatic Updates</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<para><simplelist> |
| 26 |
<member><filename>/etc/sysupdate.d/*.transfer</filename></member> |
| 27 |
<member><filename>/run/sysupdate.d/*.transfer</filename></member> |
| 28 |
<member><filename>/usr/local/lib/sysupdate.d/*.transfer</filename></member> |
| 29 |
<member><filename>/usr/lib/sysupdate.d/*.transfer</filename></member> |
| 30 |
</simplelist></para> |
| 31 |
</refsynopsisdiv> |
| 32 |
|
| 33 |
<refsect1> |
| 34 |
<title>Description</title> |
| 35 |
|
| 36 |
<para>These files describe how specific resources on the local system shall be updated from a remote |
| 37 |
source. |
| 38 |
Each such file defines one such transfer: typically a remote HTTP/HTTPS resource as source; and a local |
| 39 |
file, directory or partition as target. |
| 40 |
This may be used as a simple, automatic, atomic update mechanism for the OS itself, for containers, |
| 41 |
portable services or system extension images — but in fact may be used to update any kind of file from a |
| 42 |
remote source.</para> |
| 43 |
|
| 44 |
<para>The |
| 45 |
<citerefentry><refentrytitle>systemd-sysupdate</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 46 |
command reads these files and uses them to determine which local resources should be updated, and then |
| 47 |
executes the update.</para> |
| 48 |
|
| 49 |
<para>Both the remote HTTP/HTTPS source and the local target typically exist in multiple, concurrent |
| 50 |
versions, in order to implement flexible update schemes, e.g. A/B updating (or a superset thereof, |
| 51 |
e.g. A/B/C, A/B/C/D, …).</para> |
| 52 |
|
| 53 |
<para>Each <filename>*.transfer</filename> file defines one transfer, i.e. describes one resource to |
| 54 |
update. |
| 55 |
Typically, multiple of these files (i.e. multiple of such transfers) are defined together, and |
| 56 |
are bound together by a common version identifier in order to update multiple resources at once on each |
| 57 |
update operation, for example to update a kernel, a root file system and a Verity partition in a single, |
| 58 |
combined, synchronized operation, so that only a combined update of all three together constitutes a |
| 59 |
complete update. |
| 60 |
We'll call such a collection of transfers a target. |
| 61 |
<citerefentry><refentrytitle>systemd-sysupdate</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 62 |
always operates on a single target.</para> |
| 63 |
|
| 64 |
<para>Transfers may be grouped together into sets that can be individually enabled or disabled by the |
| 65 |
system administrator, called "Optional Features": |
| 66 |
<citerefentry><refentrytitle>sysupdate.features</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 67 |
</para> |
| 68 |
|
| 69 |
<para>Each <filename>*.transfer</filename> file contains three sections: [Transfer], [Source] and [Target].</para> |
| 70 |
</refsect1> |
| 71 |
|
| 72 |
<refsect1> |
| 73 |
<title>Basic Mode of Operation</title> |
| 74 |
|
| 75 |
<para>Disk-image based OS updates typically consist of multiple different resources that need to be |
| 76 |
updated together, for example a secure OS update might consist of a root file system image to drop into a |
| 77 |
partition, a matching Verity integrity data partition image, and a kernel image prepared to boot into the |
| 78 |
combination of the two partitions. The first two resources are files that are downloaded and placed in a |
| 79 |
disk partition, the latter is a file that is downloaded and placed in a regular file in the boot file |
| 80 |
system (e.g. EFI system partition). Hence, during an update of a hypothetical operating system "foobarOS" |
| 81 |
to a hypothetical version 47 the following operations should take place:</para> |
| 82 |
|
| 83 |
<orderedlist> |
| 84 |
<listitem><para>A file <literal>https://download.example.com/foobarOS_47.root.xz</literal> should be |
| 85 |
downloaded, decompressed and written to a previously unused partition with GPT partition type UUID |
| 86 |
4f68bce3-e8cd-4db1-96e7-fbcaf984b709 for x86-64, as per <ulink |
| 87 |
url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 |
| 88 |
Discoverable Partitions Specification</ulink>.</para></listitem> |
| 89 |
|
| 90 |
<listitem><para>Similarly, a file <literal>https://download.example.com/foobarOS_47.verity.xz</literal> |
| 91 |
should be downloaded, decompressed and written to a previously empty partition with GPT partition type |
| 92 |
UUID of 2c7357ed-ebd2-46d9-aec1-23d437ec2bf5 (i.e. the partition type for Verity integrity information |
| 93 |
for x86-64 root file systems).</para></listitem> |
| 94 |
|
| 95 |
<listitem><para>Finally, a file <literal>https://download.example.com/foobarOS_47.efi</literal> (a |
| 96 |
unified kernel, as per <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader |
| 97 |
Specification</ulink> Type #2) should be downloaded, decompressed and written to the $BOOT file system, |
| 98 |
i.e. to <filename>EFI/Linux/foobarOS_47.efi</filename> in the ESP or XBOOTLDR partition.</para></listitem> |
| 99 |
</orderedlist> |
| 100 |
|
| 101 |
<para>The version-independent generalization of this would be (using the special marker |
| 102 |
<literal>@v</literal> as wildcard for the version identifier):</para> |
| 103 |
|
| 104 |
<orderedlist> |
| 105 |
<listitem><para>A transfer of a file <literal>https://download.example.com/[email protected]</literal> |
| 106 |
→ a local, previously empty GPT partition of type 4f68bce3-e8cd-4db1-96e7-fbcaf984b709, with the label to |
| 107 |
be set to <literal>foobarOS_@v</literal>.</para></listitem> |
| 108 |
|
| 109 |
<listitem><para>A transfer of a file <literal>https://download.example.com/[email protected]</literal> |
| 110 |
→ a local, previously empty GPT partition of type 2c7357ed-ebd2-46d9-aec1-23d437ec2bf5, with the label to be |
| 111 |
set to <literal>foobarOS_@v_verity</literal>.</para></listitem> |
| 112 |
|
| 113 |
<listitem><para>A transfer of a file <literal>https://download.example.com/[email protected]</literal> |
| 114 |
→ a local file <filename>$BOOT/EFI/Linux/[email protected]</filename>.</para></listitem> |
| 115 |
</orderedlist> |
| 116 |
|
| 117 |
<para>An update can only complete if the relevant URLs provide their resources for the same version, |
| 118 |
i.e. for the same value of <literal>@v</literal>.</para> |
| 119 |
|
| 120 |
<para>The above may be translated into three <filename>*.transfer</filename> files in |
| 121 |
<filename>sysupdate.d/</filename>, one for each resource to transfer. The <filename>*.transfer</filename> |
| 122 |
files configure the type of download, and what place to write the download to (i.e. whether to a |
| 123 |
partition or a file in the file system). Most importantly these files contain the URL, partition name and |
| 124 |
filename patterns shown above that describe how these resources are called on the source and how they |
| 125 |
shall be called on the target.</para> |
| 126 |
|
| 127 |
<para>In order to enumerate available versions and figuring out candidates to update to, a mechanism is |
| 128 |
necessary to list suitable files:</para> |
| 129 |
|
| 130 |
<itemizedlist> |
| 131 |
<listitem><para>For partitions: the surrounding GPT partition table contains a list of defined |
| 132 |
partitions, including a partition type UUID and a partition label (in this scheme the partition label |
| 133 |
plays a role for the partition similar to the filename for a regular file).</para></listitem> |
| 134 |
|
| 135 |
<listitem><para>For regular files: the directory listing of the directory the files are contained in |
| 136 |
provides a list of existing files in a straightforward way.</para></listitem> |
| 137 |
|
| 138 |
<listitem><para>For HTTP/HTTPS sources a simple scheme is used: a manifest file |
| 139 |
<filename>SHA256SUMS</filename>, following the format defined by <citerefentry |
| 140 |
project='man-pages'><refentrytitle>sha256sum</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
| 141 |
lists file names and their SHA256 hashes.</para></listitem> |
| 142 |
</itemizedlist> |
| 143 |
|
| 144 |
<para>Transfers are done in the alphabetical order of the <filename>.transfer</filename> file names they are |
| 145 |
defined in. First, the resource data is downloaded directly into a target file/directory/partition. Once |
| 146 |
this is completed for all defined transfers, in a second step the files/directories/partitions are |
| 147 |
renamed to their final names as defined by the target <varname>MatchPattern=</varname>, again in the |
| 148 |
order the <filename>.transfer</filename> transfer file names dictate. This step is not atomic, however it is |
| 149 |
guaranteed to be executed strictly in order with suitable disk synchronization in place. Typically, when |
| 150 |
updating an OS one of the transfers defines the entry point when booting. Thus it is generally a good idea |
| 151 |
to order the resources via the transfer configuration file names so that the entry point is written |
| 152 |
last, ensuring that any abnormal termination does not leave an entry point around whose backing is not |
| 153 |
established yet. In the example above it would hence make sense to establish the EFI kernel image last |
| 154 |
and thus give its transfer configuration file the alphabetically last name.</para> |
| 155 |
|
| 156 |
<para>See below for an extended, more specific example based on the above.</para> |
| 157 |
</refsect1> |
| 158 |
|
| 159 |
<refsect1> |
| 160 |
<title>Resource Types</title> |
| 161 |
|
| 162 |
<para>Each transfer file defines one source resource to transfer to one target resource. The following |
| 163 |
resource types are supported:</para> |
| 164 |
|
| 165 |
<orderedlist> |
| 166 |
|
| 167 |
<listitem><para>Resources of type <literal>url-file</literal> encapsulate a file on a web server, |
| 168 |
referenced via a HTTP or HTTPS URL. When an update takes place, the file is downloaded and decompressed |
| 169 |
and then written to the target file or partition. This resource type is only available for sources, not |
| 170 |
for targets. The list of available versions of resources of this type is encoded in |
| 171 |
<filename>SHA256SUMS</filename> manifest files, accompanied by |
| 172 |
<filename>SHA256SUMS.gpg</filename> detached signatures.</para></listitem> |
| 173 |
|
| 174 |
<listitem><para>The <literal>url-tar</literal> resource type is similar, but the file must be a |
| 175 |
<filename>.tar</filename> archive. When an update takes place, the file is decompressed and unpacked |
| 176 |
into a directory or btrfs subvolume. This resource type is only available for sources, not for |
| 177 |
targets. Just like <literal>url-file</literal>, <literal>url-tar</literal> version enumeration makes |
| 178 |
use of <filename>SHA256SUMS</filename> files, authenticated via |
| 179 |
<filename>SHA256SUMS.gpg</filename>.</para></listitem> |
| 180 |
|
| 181 |
<listitem><para>The <literal>regular-file</literal> resource type encapsulates a local regular file on |
| 182 |
disk. During updates the file is uncompressed and written to the target file or partition. This |
| 183 |
resource type is available both as source and as target. When updating no integrity or authentication |
| 184 |
verification is done for resources of this type.</para></listitem> |
| 185 |
|
| 186 |
<listitem><para>The <literal>partition</literal> resource type is similar to |
| 187 |
<literal>regular-file</literal>, and encapsulates a GPT partition on disk. When updating, the partition |
| 188 |
must exist already, and have the correct GPT partition type. A partition whose GPT partition label is |
| 189 |
set to <literal>_empty</literal> is considered empty, and a candidate to place a newly downloaded |
| 190 |
resource in. The GPT partition label is used to store version information, once a partition is |
| 191 |
updated. This resource type is only available for target resources.</para></listitem> |
| 192 |
|
| 193 |
<listitem><para>The <literal>tar</literal> resource type encapsulates local <filename>.tar</filename> |
| 194 |
archive files. When an update takes place, the files are uncompressed and unpacked into a target |
| 195 |
directory or btrfs subvolume. Behaviour of <literal>tar</literal> and <literal>url-tar</literal> is |
| 196 |
generally similar, but the latter downloads from remote sources, and does integrity and authentication |
| 197 |
checks while the former does not. The <literal>tar</literal> resource type is only available for source |
| 198 |
resources.</para></listitem> |
| 199 |
|
| 200 |
<listitem><para>The <literal>directory</literal> resource type encapsulates local directory trees. This |
| 201 |
type is available both for source and target resources. If an update takes place on a source resource |
| 202 |
of this type, a recursive copy of the directory is done.</para></listitem> |
| 203 |
|
| 204 |
<listitem><para>The <literal>subvolume</literal> resource type is identical to |
| 205 |
<literal>directory</literal>, except when used as the target, in which case the file tree is placed in |
| 206 |
a btrfs subvolume instead of a plain directory, if the backing file system supports it (i.e. is |
| 207 |
btrfs).</para></listitem> |
| 208 |
</orderedlist> |
| 209 |
|
| 210 |
<para>As already indicated, only a subset of source and target resource type combinations are |
| 211 |
supported:</para> |
| 212 |
|
| 213 |
<table> |
| 214 |
<title>Resource Types</title> |
| 215 |
|
| 216 |
<tgroup cols='3' align='left' colsep='1' rowsep='1'> |
| 217 |
<colspec colname="name" /> |
| 218 |
<colspec colname="explanation" /> |
| 219 |
|
| 220 |
<thead> |
| 221 |
<row> |
| 222 |
<entry>Identifier</entry> |
| 223 |
<entry>Description</entry> |
| 224 |
<entry>Usable as Source</entry> |
| 225 |
<entry>When Used as Source: Compatible Targets</entry> |
| 226 |
<entry>When Used as Source: Integrity + Authentication</entry> |
| 227 |
<entry>When Used as Source: Decompression</entry> |
| 228 |
<entry>Usable as Target</entry> |
| 229 |
<entry>When Used as Target: Compatible Sources</entry> |
| 230 |
</row> |
| 231 |
</thead> |
| 232 |
|
| 233 |
<tbody> |
| 234 |
<row> |
| 235 |
<entry><constant>url-file</constant></entry> |
| 236 |
<entry>HTTP/HTTPS files</entry> |
| 237 |
<entry>yes</entry> |
| 238 |
<entry><constant>regular-file</constant>, <constant>partition</constant></entry> |
| 239 |
<entry>yes</entry> |
| 240 |
<entry>yes</entry> |
| 241 |
<entry>no</entry> |
| 242 |
<entry>-</entry> |
| 243 |
</row> |
| 244 |
|
| 245 |
<row> |
| 246 |
<entry><constant>url-tar</constant></entry> |
| 247 |
<entry>HTTP/HTTPS <filename>.tar</filename> archives</entry> |
| 248 |
<entry>yes</entry> |
| 249 |
<entry><constant>directory</constant>, <constant>subvolume</constant></entry> |
| 250 |
<entry>yes</entry> |
| 251 |
<entry>yes</entry> |
| 252 |
<entry>no</entry> |
| 253 |
<entry>-</entry> |
| 254 |
</row> |
| 255 |
|
| 256 |
<row> |
| 257 |
<entry><constant>regular-file</constant></entry> |
| 258 |
<entry>Local files</entry> |
| 259 |
<entry>yes</entry> |
| 260 |
<entry><constant>regular-file</constant>, <constant>partition</constant></entry> |
| 261 |
<entry>no</entry> |
| 262 |
<entry>yes</entry> |
| 263 |
<entry>yes</entry> |
| 264 |
<entry><constant>url-file</constant>, <constant>regular-file</constant></entry> |
| 265 |
</row> |
| 266 |
|
| 267 |
<row> |
| 268 |
<entry><constant>partition</constant></entry> |
| 269 |
<entry>Local GPT partitions</entry> |
| 270 |
<entry>no</entry> |
| 271 |
<entry>-</entry> |
| 272 |
<entry>-</entry> |
| 273 |
<entry>-</entry> |
| 274 |
<entry>yes</entry> |
| 275 |
<entry><constant>url-file</constant>, <constant>regular-file</constant></entry> |
| 276 |
</row> |
| 277 |
|
| 278 |
<row> |
| 279 |
<entry><constant>tar</constant></entry> |
| 280 |
<entry>Local <filename>.tar</filename> archives</entry> |
| 281 |
<entry>yes</entry> |
| 282 |
<entry><constant>directory</constant>, <constant>subvolume</constant></entry> |
| 283 |
<entry>no</entry> |
| 284 |
<entry>yes</entry> |
| 285 |
<entry>no</entry> |
| 286 |
<entry>-</entry> |
| 287 |
</row> |
| 288 |
|
| 289 |
<row> |
| 290 |
<entry><constant>directory</constant></entry> |
| 291 |
<entry>Local directories</entry> |
| 292 |
<entry>yes</entry> |
| 293 |
<entry><constant>directory</constant>, <constant>subvolume</constant></entry> |
| 294 |
<entry>no</entry> |
| 295 |
<entry>no</entry> |
| 296 |
<entry>yes</entry> |
| 297 |
<entry><constant>url-tar</constant>, <constant>tar</constant>, <constant>directory</constant>, <constant>subvolume</constant></entry> |
| 298 |
</row> |
| 299 |
|
| 300 |
<row> |
| 301 |
<entry><constant>subvolume</constant></entry> |
| 302 |
<entry>Local btrfs subvolumes</entry> |
| 303 |
<entry>yes</entry> |
| 304 |
<entry><constant>directory</constant>, <constant>subvolume</constant></entry> |
| 305 |
<entry>no</entry> |
| 306 |
<entry>no</entry> |
| 307 |
<entry>yes</entry> |
| 308 |
<entry><constant>url-tar</constant>, <constant>tar</constant>, <constant>directory</constant>, <constant>subvolume</constant></entry> |
| 309 |
</row> |
| 310 |
|
| 311 |
</tbody> |
| 312 |
</tgroup> |
| 313 |
</table> |
| 314 |
|
| 315 |
<para>The <filename>SHA256SUMS</filename> manifest files used by <literal>url-file</literal> and |
| 316 |
<literal>url-tar</literal> resource types follow the usual file format generated by GNU's <citerefentry |
| 317 |
project='man-pages'><refentrytitle>sha256sum</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 318 |
tool. It is recommended to use <option>--binary</option> mode, even if that has no real effect on Linux |
| 319 |
systems. The listing should only contain ASCII characters, and only regular file names (i.e. no absolute |
| 320 |
or relative paths). If the <filename>SHA256SUMS</filename> listing contains a special file |
| 321 |
<literal>BEST-BEFORE-YYYY-MM-DD</literal> (with the year, month, day filled in), then the file listing |
| 322 |
will not be considered valid past the specified date, and the transfer will fail in such a case. This may |
| 323 |
be used to detect "freshness" of the manifest file.</para> |
| 324 |
</refsect1> |
| 325 |
|
| 326 |
<refsect1> |
| 327 |
<title>Match Patterns</title> |
| 328 |
|
| 329 |
<para>Both the source and target resources typically exist in multiple versions concurrently. An update |
| 330 |
operation is done whenever the newest of the source versions is newer than the newest of the target |
| 331 |
versions. To determine the newest version of the resources a directory listing, partition listing or |
| 332 |
manifest listing is used, a subset of qualifying entries selected from that, and the version identifier |
| 333 |
extracted from the file names or partition labels of these selected entries. Subset selection and |
| 334 |
extraction of the version identifier (plus potentially other metadata) is done via match patterns, |
| 335 |
configured in <varname>MatchPattern=</varname> in the [Source] and [Target] sections. These patterns are |
| 336 |
strings that describe how files or partitions are named, with named wildcards for specific fields such as |
| 337 |
the version identifier. The following wildcards are defined:</para> |
| 338 |
|
| 339 |
<table> |
| 340 |
<title>Match Pattern Wildcards</title> |
| 341 |
|
| 342 |
<tgroup cols='2' align='left' colsep='1' rowsep='1'> |
| 343 |
<colspec colname="name" /> |
| 344 |
<colspec colname="explanation" /> |
| 345 |
|
| 346 |
<thead> |
| 347 |
<row> |
| 348 |
<entry>Wildcard</entry> |
| 349 |
<entry>Description</entry> |
| 350 |
<entry>Format</entry> |
| 351 |
<entry>Notes</entry> |
| 352 |
</row> |
| 353 |
</thead> |
| 354 |
|
| 355 |
<tbody> |
| 356 |
<row> |
| 357 |
<entry><literal>@v</literal></entry> |
| 358 |
<entry>Version identifier</entry> |
| 359 |
<entry>Valid version string</entry> |
| 360 |
<entry>Mandatory</entry> |
| 361 |
</row> |
| 362 |
|
| 363 |
<row> |
| 364 |
<entry><literal>@u</literal></entry> |
| 365 |
<entry>GPT partition UUID</entry> |
| 366 |
<entry>Valid 128-Bit UUID string</entry> |
| 367 |
<entry>Only relevant if target resource type chosen as <constant>partition</constant></entry> |
| 368 |
</row> |
| 369 |
|
| 370 |
<row> |
| 371 |
<entry><literal>@f</literal></entry> |
| 372 |
<entry>GPT partition flags</entry> |
| 373 |
<entry>Formatted hexadecimal integer</entry> |
| 374 |
<entry>Only relevant if target resource type chosen as <constant>partition</constant></entry> |
| 375 |
</row> |
| 376 |
|
| 377 |
<row> |
| 378 |
<entry><literal>@a</literal></entry> |
| 379 |
<entry>GPT partition flag NoAuto</entry> |
| 380 |
<entry>Either <literal>0</literal> or <literal>1</literal></entry> |
| 381 |
<entry>Controls NoAuto bit of the GPT partition flags, as per <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable Partitions Specification</ulink>; only relevant if target resource type chosen as <constant>partition</constant></entry> |
| 382 |
</row> |
| 383 |
|
| 384 |
<row> |
| 385 |
<entry><literal>@g</literal></entry> |
| 386 |
<entry>GPT partition flag GrowFileSystem</entry> |
| 387 |
<entry>Either <literal>0</literal> or <literal>1</literal></entry> |
| 388 |
<entry>Controls GrowFileSystem bit of the GPT partition flags, as per <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable Partitions Specification</ulink>; only relevant if target resource type chosen as <constant>partition</constant></entry> |
| 389 |
</row> |
| 390 |
|
| 391 |
<row> |
| 392 |
<entry><literal>@r</literal></entry> |
| 393 |
<entry>Read-only flag</entry> |
| 394 |
<entry>Either <literal>0</literal> or <literal>1</literal></entry> |
| 395 |
<entry>Controls ReadOnly bit of the GPT partition flags, as per <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable Partitions Specification</ulink> and other output read-only flags, see <varname>ReadOnly=</varname> below</entry> |
| 396 |
</row> |
| 397 |
|
| 398 |
<row> |
| 399 |
<entry><literal>@t</literal></entry> |
| 400 |
<entry>File modification time</entry> |
| 401 |
<entry>Formatted decimal integer, μs since UNIX epoch Jan 1st 1970</entry> |
| 402 |
<entry>Only relevant if target resource type chosen as <constant>regular-file</constant></entry> |
| 403 |
</row> |
| 404 |
|
| 405 |
<row> |
| 406 |
<entry><literal>@m</literal></entry> |
| 407 |
<entry>File access mode</entry> |
| 408 |
<entry>Formatted octal integer, in UNIX fashion</entry> |
| 409 |
<entry>Only relevant if target resource type chosen as <constant>regular-file</constant></entry> |
| 410 |
</row> |
| 411 |
|
| 412 |
<row> |
| 413 |
<entry><literal>@s</literal></entry> |
| 414 |
<entry>File size after decompression</entry> |
| 415 |
<entry>Formatted decimal integer</entry> |
| 416 |
<entry>Useful for measuring progress and to improve partition allocation logic</entry> |
| 417 |
</row> |
| 418 |
|
| 419 |
<row> |
| 420 |
<entry><literal>@d</literal></entry> |
| 421 |
<entry>Tries done</entry> |
| 422 |
<entry>Formatted decimal integer</entry> |
| 423 |
<entry>Useful when operating with kernel image files, as per <ulink url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot Assessment</ulink></entry> |
| 424 |
</row> |
| 425 |
|
| 426 |
<row> |
| 427 |
<entry><literal>@l</literal></entry> |
| 428 |
<entry>Tries left</entry> |
| 429 |
<entry>Formatted decimal integer</entry> |
| 430 |
<entry>Useful when operating with kernel image files, as per <ulink url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot Assessment</ulink></entry> |
| 431 |
</row> |
| 432 |
|
| 433 |
<row> |
| 434 |
<entry><literal>@h</literal></entry> |
| 435 |
<entry>SHA256 hash of compressed file</entry> |
| 436 |
<entry>64 hexadecimal characters</entry> |
| 437 |
<entry>The SHA256 hash of the compressed file; not useful for <constant>url-file</constant> or <constant>url-tar</constant> where the SHA256 hash is already included in the manifest file anyway</entry> |
| 438 |
</row> |
| 439 |
</tbody> |
| 440 |
</tgroup> |
| 441 |
</table> |
| 442 |
|
| 443 |
<para>Of these wildcards only <literal>@v</literal> must be present in a valid pattern, all other |
| 444 |
wildcards are optional. Each wildcard may be used at most once in each pattern. A typical wildcard |
| 445 |
matching a file system source image could be <literal>[email protected]</literal>, i.e. any file |
| 446 |
whose name begins with <literal>foobar_</literal>, followed by a version ID and suffixed by |
| 447 |
<literal>.raw.xz</literal>.</para> |
| 448 |
|
| 449 |
<para>Do not confuse the <literal>@</literal> pattern matching wildcard prefix with the |
| 450 |
<literal>%</literal> specifier expansion prefix. The former encapsulate a variable part of a match |
| 451 |
pattern string, the latter are simple shortcuts that are expanded while the drop-in files are |
| 452 |
parsed. For details about specifiers, see below.</para> |
| 453 |
</refsect1> |
| 454 |
|
| 455 |
<refsect1> |
| 456 |
<title>[Transfer] Section Options</title> |
| 457 |
|
| 458 |
<para>This section defines general properties of this transfer.</para> |
| 459 |
|
| 460 |
<variablelist> |
| 461 |
<varlistentry> |
| 462 |
<term><varname>MinVersion=</varname></term> |
| 463 |
|
| 464 |
<listitem><para>Specifies the minimum version to require for this transfer to take place. If the |
| 465 |
source or target patterns in this transfer definition match files older than this version they will |
| 466 |
be considered obsolete, and never be considered for the update operation.</para> |
| 467 |
|
| 468 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 469 |
</varlistentry> |
| 470 |
|
| 471 |
<varlistentry> |
| 472 |
<term><varname>ProtectVersion=</varname></term> |
| 473 |
|
| 474 |
<listitem><para>Takes one or more version strings to mark as "protected". Protected versions are |
| 475 |
never removed while making room for new, updated versions. This is useful to ensure that the |
| 476 |
currently booted OS version (or auxiliary resources associated with it) is not replaced/overwritten |
| 477 |
during updates, in order to avoid runtime file system corruptions.</para> |
| 478 |
|
| 479 |
<para>Like many of the settings in these configuration files this setting supports specifier |
| 480 |
expansion. It's particularly useful to set this setting to one of the <literal>%A</literal>, |
| 481 |
<literal>%B</literal> or <literal>%w</literal> specifiers to automatically refer to the current OS |
| 482 |
version of the running system. See below for details on supported specifiers.</para> |
| 483 |
|
| 484 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 485 |
</varlistentry> |
| 486 |
|
| 487 |
<varlistentry> |
| 488 |
<term><varname>Verify=</varname></term> |
| 489 |
|
| 490 |
<listitem><para>Takes a boolean, defaults to yes. Controls whether to cryptographically verify |
| 491 |
downloaded resources (specifically: validate the GPG signatures for downloaded |
| 492 |
<filename>SHA256SUMS</filename> manifest files, via their detached signature files |
| 493 |
<filename>SHA256SUMS.gpg</filename> in combination with the system keyring |
| 494 |
<filename>/usr/lib/systemd/import-pubring.pgp</filename> or |
| 495 |
<filename>/etc/systemd/import-pubring.pgp</filename>).</para> |
| 496 |
|
| 497 |
<para>This option is essential to provide integrity guarantees for downloaded resources and thus |
| 498 |
should be left enabled, outside of test environments.</para> |
| 499 |
|
| 500 |
<para>Note that the downloaded payload files are unconditionally checked against the SHA256 hashes |
| 501 |
listed in the manifest. This option only controls whether the signatures of these manifests are |
| 502 |
verified.</para> |
| 503 |
|
| 504 |
<para>This option only has an effect if the source resource type is selected as |
| 505 |
<constant>url-file</constant> or <constant>url-tar</constant>, as integrity and authentication |
| 506 |
checking is only available for transfers from remote sources.</para> |
| 507 |
|
| 508 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 509 |
</varlistentry> |
| 510 |
|
| 511 |
<varlistentry> |
| 512 |
<term><varname>ChangeLog=</varname></term> |
| 513 |
|
| 514 |
<listitem><para>Optionally takes a human-presentable URL to a website containing a change-log of |
| 515 |
the resource being updated.</para> |
| 516 |
|
| 517 |
<para>This may be set multiple times in a single transfer definition. If set multiple times, the |
| 518 |
values are gathered into a list of URLs. Adding a value of the empty string will clear the existing |
| 519 |
list of all values.</para> |
| 520 |
|
| 521 |
<para>This setting supports specifier expansion. See below for details on supported |
| 522 |
specifiers. This setting will also expand the <literal>@v</literal> wildcard pattern. See above |
| 523 |
for details.</para> |
| 524 |
|
| 525 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 526 |
</varlistentry> |
| 527 |
|
| 528 |
<varlistentry> |
| 529 |
<term><varname>AppStream=</varname></term> |
| 530 |
|
| 531 |
<listitem><para>Optionally takes a URL to an |
| 532 |
<ulink url="https://www.freedesktop.org/software/appstream/docs/chap-CatalogData.html">AppStream catalog</ulink> |
| 533 |
XML file. This may be used by software centers (such as GNOME Software or KDE Discover) to present |
| 534 |
rich metadata about the resources being updated. This includes display names, changelogs, icons, |
| 535 |
and more. The specified catalog must include <ulink url="https://systemd.io/APPSTREAM_BUNDLE">special metadata</ulink> |
| 536 |
to be correctly associated with |
| 537 |
<citerefentry><refentrytitle>systemd-sysupdate</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 538 |
by the software centers.</para> |
| 539 |
|
| 540 |
<para>This setting supports specifier expansion. See below for details on supported |
| 541 |
specifiers.</para> |
| 542 |
|
| 543 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 544 |
</varlistentry> |
| 545 |
|
| 546 |
<varlistentry> |
| 547 |
<term><varname>Features=</varname></term> |
| 548 |
|
| 549 |
<listitem><para>A space-separated list of |
| 550 |
<citerefentry><refentrytitle>sysupdate.features</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 551 |
that this transfer belongs to, by name. |
| 552 |
This option may be specified more than once, in which case the specified list of features is merged. |
| 553 |
If the empty string is assigned to this option, the list is reset and all prior assignments will have |
| 554 |
no effect. |
| 555 |
For example: <literal>Features=foo bar</literal> specifies that the transfer belongs to |
| 556 |
<literal>foo.feature</literal> and <literal>bar.feature</literal>.</para> |
| 557 |
|
| 558 |
<para>If the list of features is empty, then this transfer is always used. |
| 559 |
If this transfer belongs to more than one feature, then it will be used if <emphasis>any</emphasis> |
| 560 |
one of the listed features is enabled. |
| 561 |
A name that does not correspond to a defined feature will resolve to an implicit feature that is |
| 562 |
always disabled.</para> |
| 563 |
|
| 564 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 565 |
</varlistentry> |
| 566 |
|
| 567 |
<varlistentry> |
| 568 |
<term><varname>RequisiteFeatures=</varname></term> |
| 569 |
|
| 570 |
<listitem><para>This is like <varname>Features=</varname>, except that <emphasis>all</emphasis> |
| 571 |
features listed here must be enabled for this transfer to be enabled. |
| 572 |
If both options are specified, then they both apply: the transfer will be enabled only if all |
| 573 |
features specified here are enabled, and at least one feature listed in <varname>Features=</varname> |
| 574 |
is enabled.</para> |
| 575 |
|
| 576 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 577 |
</varlistentry> |
| 578 |
</variablelist> |
| 579 |
</refsect1> |
| 580 |
|
| 581 |
<refsect1> |
| 582 |
<title>[Source] Section Options</title> |
| 583 |
|
| 584 |
<para>This section defines properties of the transfer source.</para> |
| 585 |
|
| 586 |
<variablelist> |
| 587 |
<varlistentry> |
| 588 |
<term><varname>Type=</varname></term> |
| 589 |
|
| 590 |
<listitem><para>Specifies the resource type of the source for the transfer. Takes one of |
| 591 |
<constant>url-file</constant>, <constant>url-tar</constant>, <constant>tar</constant>, |
| 592 |
<constant>regular-file</constant>, <constant>directory</constant> or |
| 593 |
<constant>subvolume</constant>. For details about the resource types, see above. This option is |
| 594 |
mandatory.</para> |
| 595 |
|
| 596 |
<para>Note that only certain combinations of source and target resource types are supported, see |
| 597 |
above.</para> |
| 598 |
|
| 599 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 600 |
</varlistentry> |
| 601 |
</variablelist> |
| 602 |
|
| 603 |
<variablelist> |
| 604 |
<varlistentry> |
| 605 |
<term><varname>Path=</varname></term> |
| 606 |
|
| 607 |
<listitem><para>Specifies where to find source versions of this resource.</para> |
| 608 |
|
| 609 |
<para>If the source type is selected as <constant>url-file</constant> or |
| 610 |
<constant>url-tar</constant> this must be a HTTP/HTTPS URL. The URL is suffixed with |
| 611 |
<filename>/SHA256SUMS</filename> to acquire the manifest file, with |
| 612 |
<filename>/SHA256SUMS.gpg</filename> to acquire the detached signature file for it, and with the file |
| 613 |
names listed in the manifest file in case an update is executed and a resource shall be |
| 614 |
downloaded.</para> |
| 615 |
|
| 616 |
<para>For all other source resource types this must be a local path in the file system, referring to |
| 617 |
a local directory to find the versions of this resource in.</para> |
| 618 |
|
| 619 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 620 |
</varlistentry> |
| 621 |
|
| 622 |
<varlistentry> |
| 623 |
<term><varname>MatchPattern=</varname></term> |
| 624 |
|
| 625 |
<listitem><para>Specifies one or more file name match patterns that select the subset of files that |
| 626 |
are update candidates as source for this transfer. See above for details on match patterns.</para> |
| 627 |
|
| 628 |
<para>This option is mandatory. Any pattern listed must contain at least the <literal>@v</literal> |
| 629 |
wildcard, so that a version identifier may be extracted from the filename. All other wildcards are |
| 630 |
optional.</para> |
| 631 |
|
| 632 |
<para>If the source type is <constant>regular-file</constant> or <constant>directory</constant>, the |
| 633 |
pattern may contain slash characters. In this case, it will match the file or directory in |
| 634 |
corresponding subdirectory. For example <literal>MatchPattern=foo_@v/bar.efi</literal> will match |
| 635 |
<literal>bar.efi</literal> in directory <literal>foo_1</literal>. </para> |
| 636 |
|
| 637 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 638 |
</varlistentry> |
| 639 |
</variablelist> |
| 640 |
</refsect1> |
| 641 |
|
| 642 |
<refsect1> |
| 643 |
<title>[Target] Section Options</title> |
| 644 |
|
| 645 |
<para>This section defines properties of the transfer target.</para> |
| 646 |
|
| 647 |
<variablelist> |
| 648 |
<varlistentry> |
| 649 |
<term><varname>Type=</varname></term> |
| 650 |
|
| 651 |
<listitem><para>Specifies the resource type of the target for the transfer. Takes one of |
| 652 |
<constant>partition</constant>, <constant>regular-file</constant>, <constant>directory</constant> or |
| 653 |
<constant>subvolume</constant>. For details about the resource types, see above. This option is |
| 654 |
mandatory.</para> |
| 655 |
|
| 656 |
<para>Note that only certain combinations of source and target resource types are supported, see |
| 657 |
above.</para> |
| 658 |
|
| 659 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 660 |
</varlistentry> |
| 661 |
|
| 662 |
<varlistentry> |
| 663 |
<term><varname>Path=</varname></term> |
| 664 |
|
| 665 |
<listitem><para>Specifies a file system path where to look for already installed versions or place |
| 666 |
newly downloaded versions of this configured resource. If <varname>Type=</varname> is set to |
| 667 |
<constant>partition</constant>, expects a path to a (whole) block device node, or the special string |
| 668 |
<literal>auto</literal> in which case the block device which contains the root file system of the |
| 669 |
currently booted system is automatically determined and used. If <varname>Type=</varname> is set to |
| 670 |
<constant>regular-file</constant>, <constant>directory</constant> or <constant>subvolume</constant>, |
| 671 |
must refer to a path in the local file system referencing the directory to find or place the version |
| 672 |
files or directories under.</para> |
| 673 |
|
| 674 |
<para>Note that this mechanism cannot be used to create or remove partitions, in case |
| 675 |
<varname>Type=</varname> is set to <constant>partition</constant>. Partitions must exist already, and |
| 676 |
a special partition label <literal>_empty</literal> is used to indicate empty partitions. To |
| 677 |
automatically generate suitable partitions on first boot, use a tool such as |
| 678 |
<citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para> |
| 679 |
|
| 680 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 681 |
</varlistentry> |
| 682 |
|
| 683 |
<varlistentry> |
| 684 |
<term><varname>PathRelativeTo=</varname></term> |
| 685 |
|
| 686 |
<listitem><para>Specifies what anchor point <varname>Path=</varname> should be relative to. Takes one |
| 687 |
of <constant>root</constant>, <constant>esp</constant>, <constant>xbootldr</constant>, |
| 688 |
<constant>boot</constant> or <constant>explicit</constant>. If unspecified, defaults to |
| 689 |
<constant>root</constant>.</para> |
| 690 |
|
| 691 |
<para>If set to <constant>root</constant>, <constant>esp</constant>, <constant>xbootldr</constant>, |
| 692 |
the specified <varname>Path=</varname> will be resolved relative to the mount point of the |
| 693 |
corresponding partition, as defined by the |
| 694 |
<ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader |
| 695 |
Specification</ulink>.</para> |
| 696 |
|
| 697 |
<para>If set to <constant>boot</constant>, the specified <varname>Path=</varname> will be resolved |
| 698 |
relative to the mount point of the $BOOT partition (i.e. the ESP or XBOOTLDR), as defined by the |
| 699 |
<ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader |
| 700 |
Specification</ulink>.</para> |
| 701 |
|
| 702 |
<para>If set to <constant>explicit</constant>, the specified <varname>Path=</varname> will be |
| 703 |
resolved relative to the directory specified with <option>--transfer-source=</option> when invoking |
| 704 |
<citerefentry><refentrytitle>systemd-sysupdate</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 705 |
</para> |
| 706 |
|
| 707 |
<para>The values <constant>esp</constant>, <constant>xbootldr</constant>, and |
| 708 |
<constant>boot</constant> are only supported when <varname>Type=</varname> is set to |
| 709 |
<constant>regular-file</constant> or <constant>directory</constant>.</para> |
| 710 |
|
| 711 |
<xi:include href="version-info.xml" xpointer="v254"/></listitem> |
| 712 |
</varlistentry> |
| 713 |
|
| 714 |
<varlistentry> |
| 715 |
<term><varname>MatchPattern=</varname></term> |
| 716 |
|
| 717 |
<listitem><para>Specifies one or more file name or partition label match patterns that select the |
| 718 |
subset of files or partitions that are update candidates as targets for this transfer. See above for |
| 719 |
details on match patterns.</para> |
| 720 |
|
| 721 |
<para>This option is mandatory. Any pattern listed must contain at least the <literal>@v</literal> |
| 722 |
wildcard, so that a version identifier may be extracted from the filename. All other wildcards are |
| 723 |
optional.</para> |
| 724 |
|
| 725 |
<para>This pattern is both used for matching existing installed versions and for determining the name |
| 726 |
of new versions to install. If multiple patterns are specified, the first specified is used for |
| 727 |
naming newly installed versions.</para> |
| 728 |
|
| 729 |
<para>If the target type is <constant>regular-file</constant> or <constant>directory</constant>, the |
| 730 |
pattern may contain slash characters. In this case, it will match the file or directory in |
| 731 |
corresponding subdirectory. For example <literal>MatchPattern=foo_@v/bar.efi</literal> will match |
| 732 |
<literal>bar.efi</literal> in directory <literal>foo_1</literal>. Directories in the path will be |
| 733 |
created when file is installed. Empty directories will be removed when file is removed.</para> |
| 734 |
|
| 735 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 736 |
</varlistentry> |
| 737 |
|
| 738 |
<varlistentry> |
| 739 |
<term><varname>MatchPartitionType=</varname></term> |
| 740 |
|
| 741 |
<listitem><para>When the target <varname>Type=</varname> is chosen as <constant>partition</constant>, |
| 742 |
specifies the GPT partition type to look for. Only partitions of this type are considered, all other |
| 743 |
partitions are ignored. If not specified, the GPT partition type <constant>linux-generic</constant> |
| 744 |
is used. Accepts either a literal type UUID or a symbolic type identifier. For a list of supported |
| 745 |
type identifiers, see the <varname>Type=</varname> setting in |
| 746 |
<citerefentry><refentrytitle>repart.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> |
| 747 |
|
| 748 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 749 |
</varlistentry> |
| 750 |
|
| 751 |
<varlistentry> |
| 752 |
<term><varname>PartitionUUID=</varname></term> |
| 753 |
<term><varname>PartitionFlags=</varname></term> |
| 754 |
<term><varname>PartitionNoAuto=</varname></term> |
| 755 |
<term><varname>PartitionGrowFileSystem=</varname></term> |
| 756 |
|
| 757 |
<listitem><para>When the target <varname>Type=</varname> is picked as <constant>partition</constant>, |
| 758 |
selects the GPT partition UUID and partition flags to use for the updated partition. Expects a valid |
| 759 |
UUID string, a hexadecimal integer, or booleans, respectively. If not set, but the source match |
| 760 |
pattern includes wildcards for these fields (i.e. <literal>@u</literal>, <literal>@f</literal>, |
| 761 |
<literal>@a</literal>, or <literal>@g</literal>), the values from the patterns are used. If neither |
| 762 |
configured with wildcards or these explicit settings, the values are left untouched. If both the |
| 763 |
overall <varname>PartitionFlags=</varname> flags setting and the individual flag settings |
| 764 |
<varname>PartitionNoAuto=</varname> and <varname>PartitionGrowFileSystem=</varname> are used (or the |
| 765 |
wildcards for them), then the latter override the former, i.e. the individual flag bit overrides the |
| 766 |
overall flags value. See <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable |
| 767 |
Partitions Specification</ulink> for details about these flags.</para> |
| 768 |
|
| 769 |
<para>Note that these settings are not used for matching, they only have effect on newly written |
| 770 |
partitions in case a transfer takes place.</para> |
| 771 |
|
| 772 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 773 |
</varlistentry> |
| 774 |
|
| 775 |
<varlistentry> |
| 776 |
<term><varname>ReadOnly=</varname></term> |
| 777 |
|
| 778 |
<listitem><para>Controls whether to mark the resulting file, subvolume or partition read-only. If the |
| 779 |
target type is <constant>partition</constant> this controls the ReadOnly partition flag, as per |
| 780 |
<ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable Partitions |
| 781 |
Specification</ulink>, similar to the <varname>PartitionNoAuto=</varname> and |
| 782 |
<varname>PartitionGrowFileSystem=</varname> flags described above. If the target type is |
| 783 |
<constant>regular-file</constant>, the writable bit is removed from the access mode. If the |
| 784 |
target type is <constant>subvolume</constant>, the subvolume will be marked read-only as a |
| 785 |
whole. Finally, if the target <varname>Type=</varname> is selected as <constant>directory</constant>, |
| 786 |
the "immutable" file attribute is set, see <citerefentry |
| 787 |
project='man-pages'><refentrytitle>chattr</refentrytitle><manvolnum>1</manvolnum></citerefentry> for |
| 788 |
details.</para> |
| 789 |
|
| 790 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 791 |
</varlistentry> |
| 792 |
|
| 793 |
<varlistentry> |
| 794 |
<term><varname>Mode=</varname></term> |
| 795 |
|
| 796 |
<listitem><para>The UNIX file access mode to use for newly created files in case the target resource |
| 797 |
type is picked as <constant>regular-file</constant>. Expects an octal integer, in typical UNIX |
| 798 |
fashion. If not set, but the source match pattern includes a wildcard for this field |
| 799 |
(i.e. <literal>@t</literal>), the value from the pattern is used.</para> |
| 800 |
|
| 801 |
<para>Note that this setting is not used for matching, it only has an effect on newly written |
| 802 |
files when a transfer takes place.</para> |
| 803 |
|
| 804 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 805 |
</varlistentry> |
| 806 |
|
| 807 |
<varlistentry> |
| 808 |
<term><varname>TriesDone=</varname></term> |
| 809 |
<term><varname>TriesLeft=</varname></term> |
| 810 |
|
| 811 |
<listitem><para>These options take positive, decimal integers, and control the number of attempts |
| 812 |
done and left for this file. These settings are useful for managing kernel images, following the |
| 813 |
scheme defined in <ulink url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot |
| 814 |
Assessment</ulink>, and only have an effect if the target pattern includes the <literal>@d</literal> |
| 815 |
or <literal>@l</literal> wildcards.</para> |
| 816 |
|
| 817 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 818 |
</varlistentry> |
| 819 |
|
| 820 |
<varlistentry> |
| 821 |
<term><varname>InstancesMax=</varname></term> |
| 822 |
|
| 823 |
<listitem><para>Takes a decimal integer equal to or greater than 2. This configures how many concurrent |
| 824 |
versions of the resource to keep. Whenever a new update is initiated it is made sure that no more |
| 825 |
than the number of versions specified here minus one exist in the target. Any excess versions are |
| 826 |
deleted (in case the target <varname>Type=</varname> of <constant>regular-file</constant>, |
| 827 |
<constant>directory</constant>, <constant>subvolume</constant> is used) or emptied (in case the |
| 828 |
target <varname>Type=</varname> of <constant>partition</constant> is used; emptying in this case |
| 829 |
simply means to set the partition label to the special string <literal>_empty</literal>; note that no |
| 830 |
partitions are actually removed). After an update is completed the number of concurrent versions of |
| 831 |
the target resources is equal to or below the number specified here.</para> |
| 832 |
|
| 833 |
<para>Note that this setting may be set differently for each transfer. However, it generally is |
| 834 |
advisable to keep this setting the same for all transfers, since otherwise incomplete combinations of |
| 835 |
files or partitions will be left installed.</para> |
| 836 |
|
| 837 |
<para>If the target <varname>Type=</varname> is selected as <constant>partition</constant>, the number |
| 838 |
of concurrent versions to keep is additionally restricted by the number of partition slots of the |
| 839 |
right type in the partition table. I.e. if there are only 2 partition slots for the selected |
| 840 |
partition type, setting this value larger than 2 is without effect, since no more than 2 concurrent |
| 841 |
versions could be stored in the image anyway.</para> |
| 842 |
|
| 843 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 844 |
</varlistentry> |
| 845 |
|
| 846 |
<varlistentry> |
| 847 |
<term><varname>RemoveTemporary=</varname></term> |
| 848 |
|
| 849 |
<listitem><para>Takes a boolean argument. If this option is enabled (which is the default) before |
| 850 |
initiating an update, all left-over, incomplete updates from a previous attempt are removed from the |
| 851 |
target directory. This only has an effect if the target resource <varname>Type=</varname> is selected |
| 852 |
as <constant>regular-file</constant>, <constant>directory</constant> or |
| 853 |
<constant>subvolume</constant>.</para> |
| 854 |
|
| 855 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 856 |
</varlistentry> |
| 857 |
|
| 858 |
<varlistentry> |
| 859 |
<term><varname>CurrentSymlink=</varname></term> |
| 860 |
|
| 861 |
<listitem><para>Takes a symlink name as argument. If this option is used, as the last step of the |
| 862 |
update a symlink under the specified name is created/updated pointing to the completed update. This |
| 863 |
is useful in to provide a stable name always pointing to the newest version of the resource. This is |
| 864 |
only supported if the target resource <varname>Type=</varname> is selected as |
| 865 |
<constant>regular-file</constant>, <constant>directory</constant> or |
| 866 |
<constant>subvolume</constant>.</para> |
| 867 |
|
| 868 |
<xi:include href="version-info.xml" xpointer="v251"/></listitem> |
| 869 |
</varlistentry> |
| 870 |
|
| 871 |
</variablelist> |
| 872 |
</refsect1> |
| 873 |
|
| 874 |
<refsect1> |
| 875 |
<title>Specifiers</title> |
| 876 |
|
| 877 |
<para>Specifiers may be used in the <varname>MinVersion=</varname>, <varname>ProtectVersion=</varname>, |
| 878 |
<varname>Path=</varname>, <varname>MatchPattern=</varname> and <varname>CurrentSymlink=</varname> |
| 879 |
settings. The following expansions are understood:</para> |
| 880 |
<table class='specifiers'> |
| 881 |
<title>Specifiers available</title> |
| 882 |
<tgroup cols='3' align='left' colsep='1' rowsep='1'> |
| 883 |
<colspec colname="spec" /> |
| 884 |
<colspec colname="mean" /> |
| 885 |
<colspec colname="detail" /> |
| 886 |
<thead> |
| 887 |
<row> |
| 888 |
<entry>Specifier</entry> |
| 889 |
<entry>Meaning</entry> |
| 890 |
<entry>Details</entry> |
| 891 |
</row> |
| 892 |
</thead> |
| 893 |
<tbody> |
| 894 |
<xi:include href="standard-specifiers.xml" xpointer="a"/> |
| 895 |
<xi:include href="standard-specifiers.xml" xpointer="A"/> |
| 896 |
<xi:include href="standard-specifiers.xml" xpointer="b"/> |
| 897 |
<xi:include href="standard-specifiers.xml" xpointer="B"/> |
| 898 |
<xi:include href="standard-specifiers.xml" xpointer="H"/> |
| 899 |
<xi:include href="standard-specifiers.xml" xpointer="l"/> |
| 900 |
<xi:include href="standard-specifiers.xml" xpointer="m"/> |
| 901 |
<xi:include href="standard-specifiers.xml" xpointer="M"/> |
| 902 |
<xi:include href="standard-specifiers.xml" xpointer="o"/> |
| 903 |
<xi:include href="standard-specifiers.xml" xpointer="v"/> |
| 904 |
<xi:include href="standard-specifiers.xml" xpointer="w"/> |
| 905 |
<xi:include href="standard-specifiers.xml" xpointer="W"/> |
| 906 |
<xi:include href="standard-specifiers.xml" xpointer="T"/> |
| 907 |
<xi:include href="standard-specifiers.xml" xpointer="V"/> |
| 908 |
<xi:include href="standard-specifiers.xml" xpointer="percent"/> |
| 909 |
</tbody> |
| 910 |
</tgroup> |
| 911 |
</table> |
| 912 |
|
| 913 |
<para>Do not confuse the <literal>%</literal> specifier expansion prefix with the <literal>@</literal> |
| 914 |
pattern matching wildcard prefix. The former are simple shortcuts that are expanded while the drop-in |
| 915 |
files are parsed, the latter encapsulate a variable part of a match pattern string. For details about |
| 916 |
pattern matching wildcards, see above.</para> |
| 917 |
</refsect1> |
| 918 |
|
| 919 |
<refsect1> |
| 920 |
<title>Examples</title> |
| 921 |
|
| 922 |
<example> |
| 923 |
<title>Updates for a Verity Enabled Secure OS</title> |
| 924 |
|
| 925 |
<para>With the following three files we define a root file system partition, a matching Verity |
| 926 |
partition, and a unified kernel image to update as one. This example is an extension of the example |
| 927 |
discussed earlier in this man page.</para> |
| 928 |
|
| 929 |
<para><programlisting># /usr/lib/sysupdate.d/50-verity.transfer |
| 930 |
[Transfer] |
| 931 |
ProtectVersion=%A |
| 932 |
|
| 933 |
[Source] |
| 934 |
Type=url-file |
| 935 |
Path=https://download.example.com/ |
| 936 |
MatchPattern=foobarOS_@[email protected] |
| 937 |
|
| 938 |
[Target] |
| 939 |
Type=partition |
| 940 |
Path=auto |
| 941 |
MatchPattern=foobarOS_@v_verity |
| 942 |
MatchPartitionType=root-verity |
| 943 |
PartitionFlags=0 |
| 944 |
ReadOnly=1</programlisting></para> |
| 945 |
|
| 946 |
<para>The above defines the update mechanism for the Verity partition of the root file system. Verity |
| 947 |
partition images are downloaded from |
| 948 |
<literal>https://download.example.com/foobarOS_@[email protected]</literal> and written to a suitable |
| 949 |
local partition, which is marked read-only. Under the assumption this update is run from the image |
| 950 |
itself the current image version (i.e. the <literal>%A</literal> specifier) is marked as protected, to |
| 951 |
ensure it is not corrupted while booted. Note that the partition UUID for the target partition is |
| 952 |
encoded in the source file name. Fixating the partition UUID can be useful to ensure that |
| 953 |
<literal>roothash=</literal> on the kernel command line is sufficient to pinpoint both the Verity and |
| 954 |
root file system partition, and also encode the Verity root level hash (under the assumption the UUID |
| 955 |
in the file names match their top-level hash, the way |
| 956 |
<citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 957 |
suggests).</para> |
| 958 |
|
| 959 |
<para><programlisting># /usr/lib/sysupdate.d/60-root.transfer |
| 960 |
[Transfer] |
| 961 |
ProtectVersion=%A |
| 962 |
|
| 963 |
[Source] |
| 964 |
Type=url-file |
| 965 |
Path=https://download.example.com/ |
| 966 |
MatchPattern=foobarOS_@[email protected] |
| 967 |
|
| 968 |
[Target] |
| 969 |
Type=partition |
| 970 |
Path=auto |
| 971 |
MatchPattern=foobarOS_@v |
| 972 |
MatchPartitionType=root |
| 973 |
PartitionFlags=0 |
| 974 |
ReadOnly=1</programlisting></para> |
| 975 |
|
| 976 |
<para>The above defines a matching transfer definition for the root file system.</para> |
| 977 |
|
| 978 |
<para><programlisting># /usr/lib/sysupdate.d/70-kernel.transfer |
| 979 |
[Transfer] |
| 980 |
ProtectVersion=%A |
| 981 |
|
| 982 |
[Source] |
| 983 |
Type=url-file |
| 984 |
Path=https://download.example.com/ |
| 985 |
[email protected] |
| 986 |
|
| 987 |
[Target] |
| 988 |
Type=regular-file |
| 989 |
Path=/EFI/Linux |
| 990 |
PathRelativeTo=boot |
| 991 |
MatchPattern=foobarOS_@v+@[email protected] \ |
| 992 |
foobarOS_@[email protected] \ |
| 993 |
[email protected] |
| 994 |
Mode=0644 |
| 995 |
TriesLeft=3 |
| 996 |
TriesDone=0 |
| 997 |
InstancesMax=2</programlisting></para> |
| 998 |
|
| 999 |
<para>The above installs a unified kernel image into the $BOOT partition, as per |
| 1000 |
<ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification">UAPI.1 Boot Loader |
| 1001 |
Specification</ulink> Type #2. This defines three possible patterns for the names of the kernel |
| 1002 |
images, as per <ulink url="https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT">Automatic Boot Assessment</ulink>, |
| 1003 |
and ensures when installing new kernels, they are set up with 3 tries left. No more than two parallel |
| 1004 |
kernels are kept.</para> |
| 1005 |
|
| 1006 |
<para>With this setup the web server would serve the following files, for a hypothetical version 7 of |
| 1007 |
the OS:</para> |
| 1008 |
|
| 1009 |
<itemizedlist> |
| 1010 |
<listitem><para><filename>SHA256SUMS</filename> – The manifest file, containing available files and their SHA256 hashes</para></listitem> |
| 1011 |
<listitem><para><filename>SHA256SUMS.gpg</filename> – The detached cryptographic signature for the manifest file</para></listitem> |
| 1012 |
<listitem><para><filename>foobarOS_7_8b8186b1-2b4e-4eb6-ad39-8d4d18d2a8fb.verity.xz</filename> – The Verity image for version 7</para></listitem> |
| 1013 |
<listitem><para><filename>foobarOS_7_f4d1234f-3ebf-47c4-b31d-4052982f9a2f.root.xz</filename> – The root file system image for version 7</para></listitem> |
| 1014 |
<listitem><para><filename>foobarOS_7.efi</filename> – The unified kernel image for version 7</para></listitem> |
| 1015 |
</itemizedlist> |
| 1016 |
|
| 1017 |
<para>For each new OS release a new set of the latter three files would be added, each time with an |
| 1018 |
updated version. The <filename>SHA256SUMS</filename> manifest should then be updated accordingly, |
| 1019 |
listing all files for all versions that shall be offered for download.</para> |
| 1020 |
</example> |
| 1021 |
|
| 1022 |
<example> |
| 1023 |
<title>Updates for Plain Directory Container Image</title> |
| 1024 |
|
| 1025 |
<para><programlisting> |
| 1026 |
[Source] |
| 1027 |
Type=url-tar |
| 1028 |
Path=https://download.example.com/ |
| 1029 |
[email protected] |
| 1030 |
|
| 1031 |
[Target] |
| 1032 |
Type=subvolume |
| 1033 |
Path=/var/lib/machines |
| 1034 |
MatchPattern=myContainer_@v |
| 1035 |
CurrentSymlink=myContainer</programlisting></para> |
| 1036 |
|
| 1037 |
<para>On updates this downloads <literal>https://download.example.com/[email protected]</literal> |
| 1038 |
and decompresses/unpacks it to <filename>/var/lib/machines/myContainer_@v</filename>. After each update |
| 1039 |
a symlink <filename>/var/lib/machines/myContainer</filename> is created/updated always pointing to the |
| 1040 |
most recent update.</para> |
| 1041 |
</example> |
| 1042 |
</refsect1> |
| 1043 |
|
| 1044 |
<refsect1> |
| 1045 |
<title>See Also</title> |
| 1046 |
<para><simplelist type="inline"> |
| 1047 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 1048 |
<member><citerefentry><refentrytitle>systemd-sysupdate</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 1049 |
<member><citerefentry><refentrytitle>systemd-repart</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 1050 |
</simplelist></para> |
| 1051 |
</refsect1> |
| 1052 |
|
| 1053 |
</refentry> |