]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/os-release.xml
man: add version info
[thirdparty/systemd.git] / man / os-release.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="os-release" xmlns:xi="http://www.w3.org/2001/XInclude">
7 <refentryinfo>
8 <title>os-release</title>
9 <productname>systemd</productname>
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>os-release</refentrytitle>
14 <manvolnum>5</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>os-release</refname>
19 <refname>initrd-release</refname>
20 <refname>extension-release</refname>
21 <refpurpose>Operating system identification</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <para><filename>/etc/os-release</filename></para>
26 <para><filename>/usr/lib/os-release</filename></para>
27 <para><filename>/etc/initrd-release</filename></para>
28 <para><filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename></para>
29 </refsynopsisdiv>
30
31 <refsect1>
32 <title>Description</title>
33
34 <para>The <filename>/etc/os-release</filename> and
35 <filename>/usr/lib/os-release</filename> files contain operating
36 system identification data.</para>
37
38 <para>The format of <filename>os-release</filename> is a newline-separated list of
39 environment-like shell-compatible variable assignments. It is possible to source the configuration from
40 Bourne shell scripts, however, beyond mere variable assignments, no shell features are supported (this
41 means variable expansion is explicitly not supported), allowing applications to read the file without
42 implementing a shell compatible execution engine. Variable assignment values must be enclosed in double
43 or single quotes if they include spaces, semicolons or other special characters outside of A–Z, a–z,
44 09. (Assignments that do not include these special characters may be enclosed in quotes too, but this is
45 optional.) Shell special characters ("$", quotes, backslash, backtick) must be escaped with backslashes,
46 following shell style. All strings should be in UTF-8 encoding, and non-printable characters should not
47 be used. Concatenation of multiple individually quoted strings is not supported. Lines beginning with "#"
48 are treated as comments. Blank lines are permitted and ignored.</para>
49
50 <para>The file <filename>/etc/os-release</filename> takes
51 precedence over <filename>/usr/lib/os-release</filename>.
52 Applications should check for the former, and exclusively use its
53 data if it exists, and only fall back to
54 <filename>/usr/lib/os-release</filename> if it is missing.
55 Applications should not read data from both files at the same
56 time. <filename>/usr/lib/os-release</filename> is the recommended
57 place to store OS release information as part of vendor trees.
58 <filename>/etc/os-release</filename> should be a relative symlink
59 to <filename>/usr/lib/os-release</filename>, to provide
60 compatibility with applications only looking at
61 <filename>/etc/</filename>. A relative symlink instead of an
62 absolute symlink is necessary to avoid breaking the link in a
63 chroot or initrd environment such as dracut.</para>
64
65 <para><filename>os-release</filename> contains data that is
66 defined by the operating system vendor and should generally not be
67 changed by the administrator.</para>
68
69 <para>As this file only encodes names and identifiers it should
70 not be localized.</para>
71
72 <para>The <filename>/etc/os-release</filename> and
73 <filename>/usr/lib/os-release</filename> files might be symlinks
74 to other files, but it is important that the file is available
75 from earliest boot on, and hence must be located on the root file
76 system.</para>
77
78 <para><filename>os-release</filename> must not contain repeating keys. Nevertheless, readers should pick
79 the entries later in the file in case of repeats, similarly to how a shell sourcing the file would. A
80 reader may warn about repeating entries.</para>
81
82 <para>For a longer rationale for <filename>os-release</filename>
83 please refer to the <ulink
84 url="https://0pointer.de/blog/projects/os-release">Announcement of <filename>/etc/os-release</filename></ulink>.</para>
85
86 <refsect2>
87 <title><filename>/etc/initrd-release</filename></title>
88
89 <para>In the <ulink
90 url="https://docs.kernel.org/admin-guide/initrd.html">initrd</ulink>,
91 <filename>/etc/initrd-release</filename> plays the same role as <filename>os-release</filename> in the
92 main system. Additionally, the presence of that file means that the system is in the initrd phase.
93 <filename>/etc/os-release</filename> should be symlinked to <filename>/etc/initrd-release</filename>
94 (or vice versa), so programs that only look for <filename>/etc/os-release</filename> (as described
95 above) work correctly.</para>
96
97 <para>The rest of this document that talks about <filename>os-release</filename> should be understood
98 to apply to <filename>initrd-release</filename> too.</para>
99 </refsect2>
100
101 <refsect2>
102 <title><filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename></title>
103
104 <para><filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename>
105 plays the same role for extension images as <filename>os-release</filename> for the main system, and
106 follows the syntax and rules as described in the <ulink
107 url="https://systemd.io/PORTABLE_SERVICES">Portable Services Documentation</ulink>. The purpose of this
108 file is to identify the extension and to allow the operating system to verify that the extension image
109 matches the base OS. This is typically implemented by checking that the <varname>ID=</varname> options
110 match, and either <varname>SYSEXT_LEVEL=</varname> exists and matches too, or if it is not present,
111 <varname>VERSION_ID=</varname> exists and matches. This ensures ABI/API compatibility between the
112 layers and prevents merging of an incompatible image in an overlay.</para>
113
114 <para>In order to identify the extension image itself, the same fields defined below can be added to the
115 <filename>extension-release</filename> file with a <varname>SYSEXT_</varname> prefix (to disambiguate
116 from fields used to match on the base image). E.g.: <varname>SYSEXT_ID=myext</varname>,
117 <varname>SYSEXT_VERSION_ID=1.2.3</varname>.</para>
118
119 <para>In the <filename>extension-release.<replaceable>IMAGE</replaceable></filename> filename, the
120 <replaceable>IMAGE</replaceable> part must exactly match the file name of the containing image with the
121 suffix removed. In case it is not possible to guarantee that an image file name is stable and doesn't
122 change between the build and the deployment phases, it is possible to relax this check: if exactly one
123 file whose name matches <literal><filename>extension-release.*</filename></literal> is present in this
124 directory, and the file is tagged with a <varname>user.extension-release.strict</varname>
125 <citerefentry project='man-pages'><refentrytitle>xattr</refentrytitle><manvolnum>7</manvolnum></citerefentry> set to the
126 string <literal>0</literal>, it will be used instead.</para>
127
128 <para>The rest of this document that talks about <filename>os-release</filename> should be understood
129 to apply to <filename>extension-release</filename> too.</para>
130 </refsect2>
131 </refsect1>
132
133 <refsect1>
134 <title>Options</title>
135
136 <para>The following OS identifications parameters may be set using
137 <filename>os-release</filename>:</para>
138
139 <refsect2>
140 <title>General information identifying the operating system</title>
141
142 <variablelist class='environment-variables'>
143 <varlistentry>
144 <term><varname>NAME=</varname></term>
145
146 <listitem><para>A string identifying the operating system, without a version component, and
147 suitable for presentation to the user. If not set, a default of <literal>NAME=Linux</literal> may
148 be used.</para>
149
150 <para>Examples: <literal>NAME=Fedora</literal>, <literal>NAME="Debian GNU/Linux"</literal>.
151 </para></listitem>
152 </varlistentry>
153
154 <varlistentry>
155 <term><varname>ID=</varname></term>
156
157 <listitem><para>A lower-case string (no spaces or other characters outside of 09, a–z, ".", "_"
158 and "-") identifying the operating system, excluding any version information and suitable for
159 processing by scripts or usage in generated filenames. If not set, a default of
160 <literal>ID=linux</literal> may be used. Note that even though this string may not include
161 characters that require shell quoting, quoting may nevertheless be used.</para>
162
163 <para>Examples: <literal>ID=fedora</literal>, <literal>ID=debian</literal>.</para></listitem>
164 </varlistentry>
165
166 <varlistentry>
167 <term><varname>ID_LIKE=</varname></term>
168
169 <listitem><para>A space-separated list of operating system identifiers in the same syntax as the
170 <varname>ID=</varname> setting. It should list identifiers of operating systems that are closely
171 related to the local operating system in regards to packaging and programming interfaces, for
172 example listing one or more OS identifiers the local OS is a derivative from. An OS should
173 generally only list other OS identifiers it itself is a derivative of, and not any OSes that are
174 derived from it, though symmetric relationships are possible. Build scripts and similar should
175 check this variable if they need to identify the local operating system and the value of
176 <varname>ID=</varname> is not recognized. Operating systems should be listed in order of how
177 closely the local operating system relates to the listed ones, starting with the closest. This
178 field is optional.</para>
179
180 <para>Examples: for an operating system with <literal>ID=centos</literal>, an assignment of
181 <literal>ID_LIKE="rhel fedora"</literal> would be appropriate. For an operating system with
182 <literal>ID=ubuntu</literal>, an assignment of <literal>ID_LIKE=debian</literal> is appropriate.
183 </para></listitem>
184 </varlistentry>
185
186 <varlistentry>
187 <term><varname>PRETTY_NAME=</varname></term>
188
189 <listitem><para>A pretty operating system name in a format suitable for presentation to the
190 user. May or may not contain a release code name or OS version of some kind, as suitable. If not
191 set, a default of <literal>PRETTY_NAME="Linux"</literal> may be used</para>
192
193 <para>Example: <literal>PRETTY_NAME="Fedora 17 (Beefy Miracle)"</literal>.</para></listitem>
194 </varlistentry>
195
196 <varlistentry>
197 <term><varname>CPE_NAME=</varname></term>
198
199 <listitem><para>A CPE name for the operating system, in URI binding syntax, following the <ulink
200 url="http://scap.nist.gov/specifications/cpe/">Common Platform Enumeration Specification</ulink> as
201 proposed by the NIST. This field is optional.</para>
202
203 <para>Example: <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal></para></listitem>
204 </varlistentry>
205
206 <varlistentry>
207 <term><varname>VARIANT=</varname></term>
208
209 <listitem><para>A string identifying a specific variant or edition of the operating system suitable
210 for presentation to the user. This field may be used to inform the user that the configuration of
211 this system is subject to a specific divergent set of rules or default configuration settings. This
212 field is optional and may not be implemented on all systems.</para>
213
214 <para>Examples: <literal>VARIANT="Server Edition"</literal>, <literal>VARIANT="Smart Refrigerator
215 Edition"</literal>.</para>
216
217 <para>Note: this field is for display purposes only. The <varname>VARIANT_ID</varname> field should
218 be used for making programmatic decisions.</para></listitem>
219 </varlistentry>
220
221 <varlistentry>
222 <term><varname>VARIANT_ID=</varname></term>
223
224 <listitem><para>A lower-case string (no spaces or other characters outside of 09, a–z, ".", "_" and
225 "-"), identifying a specific variant or edition of the operating system. This may be interpreted by
226 other packages in order to determine a divergent default configuration. This field is optional and
227 may not be implemented on all systems.</para>
228
229 <para>Examples: <literal>VARIANT_ID=server</literal>, <literal>VARIANT_ID=embedded</literal>.
230 </para></listitem>
231 </varlistentry>
232 </variablelist>
233 </refsect2>
234
235 <refsect2>
236 <title>Information about the version of the operating system</title>
237
238 <variablelist class='environment-variables'>
239 <varlistentry>
240 <term><varname>VERSION=</varname></term>
241
242 <listitem><para>A string identifying the operating system version, excluding any OS name
243 information, possibly including a release code name, and suitable for presentation to the
244 user. This field is optional.</para>
245
246 <para>Examples: <literal>VERSION=17</literal>, <literal>VERSION="17 (Beefy Miracle)"</literal>.
247 </para></listitem>
248 </varlistentry>
249
250 <varlistentry>
251 <term><varname>VERSION_ID=</varname></term>
252
253 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 09,
254 a–z, ".", "_" and "-") identifying the operating system version, excluding any OS name information
255 or release code name, and suitable for processing by scripts or usage in generated filenames. This
256 field is optional.</para>
257
258 <para>Examples: <literal>VERSION_ID=17</literal>, <literal>VERSION_ID=11.04</literal>.
259 </para></listitem>
260 </varlistentry>
261
262 <varlistentry>
263 <term><varname>VERSION_CODENAME=</varname></term>
264
265 <listitem><para>A lower-case string (no spaces or other characters outside of 09, a–z, ".", "_"
266 and "-") identifying the operating system release code name, excluding any OS name information or
267 release version, and suitable for processing by scripts or usage in generated filenames. This field
268 is optional and may not be implemented on all systems.</para>
269
270 <para>Examples: <literal>VERSION_CODENAME=buster</literal>,
271 <literal>VERSION_CODENAME=xenial</literal>.</para></listitem>
272 </varlistentry>
273
274 <varlistentry>
275 <term><varname>BUILD_ID=</varname></term>
276
277 <listitem><para>A string uniquely identifying the system image originally used as the installation
278 base. In most cases, <varname>VERSION_ID</varname> or
279 <varname>IMAGE_ID</varname>+<varname>IMAGE_VERSION</varname> are updated when the entire system
280 image is replaced during an update. <varname>BUILD_ID</varname> may be used in distributions where
281 the original installation image version is important: <varname>VERSION_ID</varname> would change
282 during incremental system updates, but <varname>BUILD_ID</varname> would not. This field is
283 optional.</para>
284
285 <para>Examples: <literal>BUILD_ID="2013-03-20.3"</literal>, <literal>BUILD_ID=201303203</literal>.
286 </para></listitem>
287 </varlistentry>
288
289 <varlistentry>
290 <term><varname>IMAGE_ID=</varname></term>
291
292 <listitem><para> A lower-case string (no spaces or other characters outside of 09, a–z, ".", "_"
293 and "-"), identifying a specific image of the operating system. This is supposed to be used for
294 environments where OS images are prepared, built, shipped and updated as comprehensive, consistent
295 OS images. This field is optional and may not be implemented on all systems, in particularly not on
296 those that are not managed via images but put together and updated from individual packages and on
297 the local system.</para>
298
299 <para>Examples: <literal>IMAGE_ID=vendorx-cashier-system</literal>,
300 <literal>IMAGE_ID=netbook-image</literal>.</para>
301
302 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
303 </varlistentry>
304
305 <varlistentry>
306 <term><varname>IMAGE_VERSION=</varname></term>
307
308 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 09,
309 a–z, ".", "_" and "-") identifying the OS image version. This is supposed to be used together with
310 <varname>IMAGE_ID</varname> described above, to discern different versions of the same image.
311 </para>
312
313 <para>Examples: <literal>IMAGE_VERSION=33</literal>, <literal>IMAGE_VERSION=47.1rc1</literal>.
314 </para>
315
316 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
317 </varlistentry>
318 </variablelist>
319
320 <para>To summarize: if the image updates are built and shipped as comprehensive units,
321 <varname>IMAGE_ID</varname>+<varname>IMAGE_VERSION</varname> is the best fit. Otherwise, if updates
322 eventually completely replace previously installed contents, as in a typical binary distribution,
323 <varname>VERSION_ID</varname> should be used to identify major releases of the operating system.
324 <varname>BUILD_ID</varname> may be used instead or in addition to <varname>VERSION_ID</varname> when
325 the original system image version is important.</para>
326 </refsect2>
327
328 <refsect2>
329 <title>Presentation information and links</title>
330
331 <variablelist class='environment-variables'>
332 <varlistentry>
333 <term><varname>HOME_URL=</varname></term>
334 <term><varname>DOCUMENTATION_URL=</varname></term>
335 <term><varname>SUPPORT_URL=</varname></term>
336 <term><varname>BUG_REPORT_URL=</varname></term>
337 <term><varname>PRIVACY_POLICY_URL=</varname></term>
338
339 <listitem><para>Links to resources on the Internet related to the operating system.
340 <varname>HOME_URL=</varname> should refer to the homepage of the operating system, or alternatively
341 some homepage of the specific version of the operating system.
342 <varname>DOCUMENTATION_URL=</varname> should refer to the main documentation page for this
343 operating system. <varname>SUPPORT_URL=</varname> should refer to the main support page for the
344 operating system, if there is any. This is primarily intended for operating systems which vendors
345 provide support for. <varname>BUG_REPORT_URL=</varname> should refer to the main bug reporting page
346 for the operating system, if there is any. This is primarily intended for operating systems that
347 rely on community QA. <varname>PRIVACY_POLICY_URL=</varname> should refer to the main privacy
348 policy page for the operating system, if there is any. These settings are optional, and providing
349 only some of these settings is common. These URLs are intended to be exposed in "About this system"
350 UIs behind links with captions such as "About this Operating System", "Obtain Support", "Report a
351 Bug", or "Privacy Policy". The values should be in <ulink
352 url="https://tools.ietf.org/html/rfc3986">RFC3986 format</ulink>, and should be
353 <literal>http:</literal> or <literal>https:</literal> URLs, and possibly <literal>mailto:</literal>
354 or <literal>tel:</literal>. Only one URL shall be listed in each setting. If multiple resources
355 need to be referenced, it is recommended to provide an online landing page linking all available
356 resources.</para>
357
358 <para>Examples: <literal>HOME_URL="https://fedoraproject.org/"</literal>,
359 <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal>.</para></listitem>
360 </varlistentry>
361
362 <varlistentry>
363 <term><varname>SUPPORT_END=</varname></term>
364
365 <listitem><para>The date at which support for this version of the OS ends. (What exactly "lack of
366 support" means varies between vendors, but generally users should assume that updates, including
367 security fixes, will not be provided.) The value is a date in the ISO 8601 format
368 <literal>YYYY-MM-DD</literal>, and specifies the first day on which support <emphasis>is
369 not</emphasis> provided.</para>
370
371 <para>For example, <literal>SUPPORT_END=2001-01-01</literal> means that the system was supported
372 until the end of the last day of the previous millennium.</para>
373
374 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
375 </varlistentry>
376
377 <varlistentry>
378 <term><varname>LOGO=</varname></term>
379
380 <listitem><para>A string, specifying the name of an icon as defined by <ulink
381 url="https://standards.freedesktop.org/icon-theme-spec/latest">freedesktop.org Icon Theme
382 Specification</ulink>. This can be used by graphical applications to display an operating system's
383 or distributor's logo. This field is optional and may not necessarily be implemented on all
384 systems.</para>
385
386 <para>Examples: <literal>LOGO=fedora-logo</literal>, <literal>LOGO=distributor-logo-opensuse</literal>
387 </para></listitem>
388 </varlistentry>
389
390 <varlistentry>
391 <term><varname>ANSI_COLOR=</varname></term>
392
393 <listitem><para>A suggested presentation color when showing the OS name on the console. This should
394 be specified as string suitable for inclusion in the ESC [ m ANSI/ECMA-48 escape code for setting
395 graphical rendition. This field is optional.</para>
396
397 <para>Examples: <literal>ANSI_COLOR="0;31"</literal> for red, <literal>ANSI_COLOR="1;34"</literal>
398 for light blue, or <literal>ANSI_COLOR="0;38;2;60;110;180"</literal> for Fedora blue.
399 </para></listitem>
400 </varlistentry>
401
402 <varlistentry>
403 <term><varname>VENDOR_NAME=</varname></term>
404
405 <listitem><para>The name of the OS vendor. This is the name of the organization or company which
406 produces the OS. This field is optional.</para>
407
408 <para>This name is intended to be exposed in "About this system" UIs or software update UIs when
409 needed to distinguish the OS vendor from the OS itself. It is intended to be human readable.</para>
410
411 <para>Examples: <literal>VENDOR_NAME="Fedora Project"</literal> for Fedora Linux,
412 <literal>VENDOR_NAME="Canonical"</literal> for Ubuntu.</para>
413
414 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
415 </varlistentry>
416
417 <varlistentry>
418 <term><varname>VENDOR_URL=</varname></term>
419
420 <listitem><para>The homepage of the OS vendor. This field is optional. The
421 <varname>VENDOR_NAME=</varname> field should be set if this one is, although clients must be
422 robust against either field not being set.</para>
423
424 <para>The value should be in <ulink
425 url="https://tools.ietf.org/html/rfc3986">RFC3986 format</ulink>, and should be
426 <literal>http:</literal> or <literal>https:</literal> URLs. Only one URL shall be listed in the
427 setting.</para>
428
429 <para>Examples: <literal>VENDOR_URL="https://fedoraproject.org/"</literal>,
430 <literal>VENDOR_URL="https://canonical.com/"</literal>.</para>
431
432 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
433 </varlistentry>
434 </variablelist>
435 </refsect2>
436
437 <refsect2>
438 <title>Distribution-level defaults and metadata</title>
439
440 <variablelist class='environment-variables'>
441 <varlistentry>
442 <term><varname>DEFAULT_HOSTNAME=</varname></term>
443
444 <listitem><para>A string specifying the hostname if
445 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry> is not
446 present and no other configuration source specifies the hostname. Must be either a single DNS label
447 (a string composed of 7-bit ASCII lower-case characters and no spaces or dots, limited to the
448 format allowed for DNS domain name labels), or a sequence of such labels separated by single dots
449 that forms a valid DNS FQDN. The hostname must be at most 64 characters, which is a Linux
450 limitation (DNS allows longer names).</para>
451
452 <para>See <citerefentry><refentrytitle>org.freedesktop.hostname1</refentrytitle><manvolnum>5</manvolnum></citerefentry>
453 for a description of how
454 <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
455 determines the fallback hostname.</para></listitem>
456 </varlistentry>
457
458 <varlistentry>
459 <term><varname>ARCHITECTURE=</varname></term>
460 <listitem><para>A string that specifies which CPU architecture the userspace binaries require.
461 The architecture identifiers are the same as for <varname>ConditionArchitecture=</varname>
462 described in <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
463 The field is optional and should only be used when just single architecture is supported.
464 It may provide redundant information when used in a GPT partition with a GUID type that already
465 encodes the architecture. If this is not the case, the architecture should be specified in
466 e.g., an extension image, to prevent an incompatible host from loading it.
467 </para>
468
469 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
470 </varlistentry>
471
472 <varlistentry>
473 <term><varname>SYSEXT_LEVEL=</varname></term>
474
475 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 09,
476 a–z, ".", "_" and "-") identifying the operating system extensions support level, to indicate which
477 extension images are supported. See <filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename>,
478 <ulink url="https://docs.kernel.org/admin-guide/initrd.html">initrd</ulink> and
479 <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
480 for more information.</para>
481
482 <para>Examples: <literal>SYSEXT_LEVEL=2</literal>, <literal>SYSEXT_LEVEL=15.14</literal>.
483 </para></listitem>
484 </varlistentry>
485
486 <varlistentry>
487 <term><varname>CONFEXT_LEVEL=</varname></term>
488
489 <listitem><para>Semantically the same as <varname>SYSEXT_LEVEL=</varname> but for confext images.
490 See <filename>/etc/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename>
491 for more information.</para>
492
493 <para>Examples: <literal>CONFEXT_LEVEL=2</literal>, <literal>CONFEXT_LEVEL=15.14</literal>.
494 </para>
495
496 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
497 </varlistentry>
498
499 <varlistentry>
500 <term><varname>SYSEXT_SCOPE=</varname></term>
501 <listitem><para>Takes a space-separated list of one or more of the strings
502 <literal>system</literal>, <literal>initrd</literal> and <literal>portable</literal>. This field is
503 only supported in <filename>extension-release.d/</filename> files and indicates what environments
504 the system extension is applicable to: i.e. to regular systems, to initrds, or to portable service
505 images. If unspecified, <literal>SYSEXT_SCOPE=system portable</literal> is implied, i.e. any system
506 extension without this field is applicable to regular systems and to portable service environments,
507 but not to initrd environments.</para>
508
509 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
510 </varlistentry>
511
512 <varlistentry>
513 <term><varname>CONFEXT_SCOPE=</varname></term>
514
515 <listitem><para>Semantically the same as <varname>SYSEXT_SCOPE=</varname> but for confext images.</para>
516
517 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
518 </varlistentry>
519
520 <varlistentry>
521 <term><varname>PORTABLE_PREFIXES=</varname></term>
522 <listitem><para>Takes a space-separated list of one or more valid prefix match strings for the
523 <ulink url="https://systemd.io/PORTABLE_SERVICES">Portable Services Documentation</ulink> logic.
524 This field serves two purposes: it is informational, identifying portable service images as such
525 (and thus allowing them to be distinguished from other OS images, such as bootable system images).
526 It is also used when a portable service image is attached: the specified or implied portable
527 service prefix is checked against the list specified here, to enforce restrictions how images may
528 be attached to a system.</para>
529
530 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
531 </varlistentry>
532 </variablelist>
533 </refsect2>
534
535 <refsect2>
536 <title>Notes</title>
537
538 <para>If you are using this file to determine the OS or a specific version of it, use the
539 <varname>ID</varname> and <varname>VERSION_ID</varname> fields, possibly with
540 <varname>ID_LIKE</varname> as fallback for <varname>ID</varname>. When looking for an OS identification
541 string for presentation to the user use the <varname>PRETTY_NAME</varname> field.</para>
542
543 <para>Note that operating system vendors may choose not to provide version information, for example to
544 accommodate for rolling releases. In this case, <varname>VERSION</varname> and
545 <varname>VERSION_ID</varname> may be unset. Applications should not rely on these fields to be
546 set.</para>
547
548 <para>Operating system vendors may extend the file format and introduce new fields. It is highly
549 recommended to prefix new fields with an OS specific name in order to avoid name clashes. Applications
550 reading this file must ignore unknown fields.</para>
551
552 <para>Example: <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal>.</para>
553
554 <para>Container and sandbox runtime managers may make the host's identification data available to
555 applications by providing the host's <filename>/etc/os-release</filename> (if available, otherwise
556 <filename>/usr/lib/os-release</filename> as a fallback) as
557 <filename>/run/host/os-release</filename>.</para>
558 </refsect2>
559 </refsect1>
560
561 <refsect1>
562 <title>Examples</title>
563
564 <example>
565 <title><filename>os-release</filename> file for Fedora Workstation</title>
566
567 <programlisting>NAME=Fedora
568 VERSION="32 (Workstation Edition)"
569 ID=fedora
570 VERSION_ID=32
571 PRETTY_NAME="Fedora 32 (Workstation Edition)"
572 ANSI_COLOR="0;38;2;60;110;180"
573 LOGO=fedora-logo-icon
574 CPE_NAME="cpe:/o:fedoraproject:fedora:32"
575 HOME_URL="https://fedoraproject.org/"
576 DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/"
577 SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
578 BUG_REPORT_URL="https://bugzilla.redhat.com/"
579 REDHAT_BUGZILLA_PRODUCT="Fedora"
580 REDHAT_BUGZILLA_PRODUCT_VERSION=32
581 REDHAT_SUPPORT_PRODUCT="Fedora"
582 REDHAT_SUPPORT_PRODUCT_VERSION=32
583 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
584 VARIANT="Workstation Edition"
585 VARIANT_ID=workstation</programlisting>
586 </example>
587
588 <example>
589 <title><filename>extension-release</filename> file for an extension for Fedora Workstation 32</title>
590
591 <programlisting>ID=fedora
592 VERSION_ID=32</programlisting>
593 </example>
594
595 <example>
596 <title>Reading <filename>os-release</filename> in
597 <citerefentry project='man-pages'><refentrytitle>sh</refentrytitle><manvolnum>1</manvolnum></citerefentry></title>
598
599 <programlisting><xi:include href="check-os-release.sh" parse="text" /></programlisting>
600 </example>
601
602 <example>
603 <title>Reading <filename>os-release</filename> in
604 <citerefentry project='die-net'><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry> (versions &gt;= 3.10)</title>
605
606 <programlisting><xi:include href="check-os-release-simple.py" parse="text" /></programlisting>
607
608 <para>See docs for <ulink url="https://docs.python.org/3/library/platform.html#platform.freedesktop_os_release">
609 <function>platform.freedesktop_os_release</function></ulink> for more details.
610 </para>
611 </example>
612
613 <example>
614 <title>Reading <filename>os-release</filename> in
615 <citerefentry project='die-net'><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry> (any version)</title>
616
617 <programlisting><xi:include href="check-os-release.py" parse="text" /></programlisting>
618
619 <para>Note that the above version that uses the built-in implementation is preferred
620 in most cases, and the open-coded version here is provided for reference.</para>
621 </example>
622
623 </refsect1>
624
625 <refsect1>
626 <title>See Also</title>
627 <para>
628 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
629 <citerefentry project='die-net'><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
630 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
631 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
632 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>
633 </para>
634 </refsect1>
635
636 </refentry>