]> git.proxmox.com Git - systemd.git/blob - man/os-release.xml
New upstream version 250.4
[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 basic file 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. It is not supported to concatenate multiple individually quoted strings. Lines beginning with
48 "#" shall be ignored 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>For a longer rationale for <filename>os-release</filename>
79 please refer to the <ulink
80 url="http://0pointer.de/blog/projects/os-release">Announcement of <filename>/etc/os-release</filename></ulink>.</para>
81
82 <refsect2>
83 <title><filename>/etc/initrd-release</filename></title>
84
85 <para>In the <ulink
86 url="https://www.kernel.org/doc/html/latest/admin-guide/initrd.html">initrd</ulink>,
87 <filename>/etc/initrd-release</filename> plays the same role as <filename>os-release</filename> in the
88 main system. Additionally, the presence of that file means that the system is in the initrd phase.
89 <filename>/etc/os-release</filename> should be symlinked to <filename>/etc/initrd-release</filename>
90 (or vice versa), so programs that only look for <filename>/etc/os-release</filename> (as described
91 above) work correctly.</para>
92
93 <para>The rest of this document that talks about <filename>os-release</filename> should be understood
94 to apply to <filename>initrd-release</filename> too.</para>
95 </refsect2>
96
97 <refsect2>
98 <title><filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename></title>
99
100 <para><filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename>
101 plays the same role for extension images as <filename>os-release</filename> for the main system, and
102 follows the syntax and rules as described in the <ulink
103 url="https://systemd.io/PORTABLE_SERVICES">Portable Services Documentation</ulink>. The purpose of this
104 file is to identify the extension and to allow the operating system to verify that the extension image
105 matches the base OS. This is typically implemented by checking that the <varname>ID=</varname> options
106 match, and either <varname>SYSEXT_LEVEL=</varname> exists and matches too, or if it is not present,
107 <varname>VERSION_ID=</varname> exists and matches. This ensures ABI/API compatibility between the
108 layers and prevents merging of an incompatible image in an overlay.</para>
109
110 <para>In the <filename>extension-release.<replaceable>IMAGE</replaceable></filename> filename, the
111 <replaceable>IMAGE</replaceable> part must exactly match the file name of the containing image with the
112 suffix removed. In case it is not possible to guarantee that an image file name is stable and doesn't
113 change between the build and the deployment phases, it is possible to relax this check: if exactly one
114 file whose name matches <literal><filename>extension-release.*</filename></literal> is present in this
115 directory, and the file is tagged with a <varname>user.extension-release.strict</varname>
116 <citerefentry><refentrytitle>xattr</refentrytitle><manvolnum>7</manvolnum></citerefentry> set to the
117 string <literal>0</literal>, it will be used instead.</para>
118
119 <para>The rest of this document that talks about <filename>os-release</filename> should be understood
120 to apply to <filename>extension-release</filename> too.</para>
121 </refsect2>
122 </refsect1>
123
124 <refsect1>
125 <title>Options</title>
126
127 <para>The following OS identifications parameters may be set using
128 <filename>os-release</filename>:</para>
129
130 <refsect2>
131 <title>General information identifying the operating system</title>
132
133 <variablelist class='environment-variables'>
134 <varlistentry>
135 <term><varname>NAME=</varname></term>
136
137 <listitem><para>A string identifying the operating system, without a version component, and
138 suitable for presentation to the user. If not set, a default of <literal>NAME=Linux</literal> may
139 be used.</para>
140
141 <para>Examples: <literal>NAME=Fedora</literal>, <literal>NAME="Debian GNU/Linux"</literal>.
142 </para></listitem>
143 </varlistentry>
144
145 <varlistentry>
146 <term><varname>ID=</varname></term>
147
148 <listitem><para>A lower-case string (no spaces or other characters outside of 09, a–z, ".", "_"
149 and "-") identifying the operating system, excluding any version information and suitable for
150 processing by scripts or usage in generated filenames. If not set, a default of
151 <literal>ID=linux</literal> may be used. Note that even though this string may not include
152 characters that require shell quoting, quoting may nevertheless be used.</para>
153
154 <para>Examples: <literal>ID=fedora</literal>, <literal>ID=debian</literal>.</para></listitem>
155 </varlistentry>
156
157 <varlistentry>
158 <term><varname>ID_LIKE=</varname></term>
159
160 <listitem><para>A space-separated list of operating system identifiers in the same syntax as the
161 <varname>ID=</varname> setting. It should list identifiers of operating systems that are closely
162 related to the local operating system in regards to packaging and programming interfaces, for
163 example listing one or more OS identifiers the local OS is a derivative from. An OS should
164 generally only list other OS identifiers it itself is a derivative of, and not any OSes that are
165 derived from it, though symmetric relationships are possible. Build scripts and similar should
166 check this variable if they need to identify the local operating system and the value of
167 <varname>ID=</varname> is not recognized. Operating systems should be listed in order of how
168 closely the local operating system relates to the listed ones, starting with the closest. This
169 field is optional.</para>
170
171 <para>Examples: for an operating system with <literal>ID=centos</literal>, an assignment of
172 <literal>ID_LIKE="rhel fedora"</literal> would be appropriate. For an operating system with
173 <literal>ID=ubuntu</literal>, an assignment of <literal>ID_LIKE=debian</literal> is appropriate.
174 </para></listitem>
175 </varlistentry>
176
177 <varlistentry>
178 <term><varname>PRETTY_NAME=</varname></term>
179
180 <listitem><para>A pretty operating system name in a format suitable for presentation to the
181 user. May or may not contain a release code name or OS version of some kind, as suitable. If not
182 set, a default of <literal>PRETTY_NAME="Linux"</literal> may be used</para>
183
184 <para>Example: <literal>PRETTY_NAME="Fedora 17 (Beefy Miracle)"</literal>.</para></listitem>
185 </varlistentry>
186
187 <varlistentry>
188 <term><varname>CPE_NAME=</varname></term>
189
190 <listitem><para>A CPE name for the operating system, in URI binding syntax, following the <ulink
191 url="http://scap.nist.gov/specifications/cpe/">Common Platform Enumeration Specification</ulink> as
192 proposed by the NIST. This field is optional.</para>
193
194 <para>Example: <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal></para></listitem>
195 </varlistentry>
196
197 <varlistentry>
198 <term><varname>VARIANT=</varname></term>
199
200 <listitem><para>A string identifying a specific variant or edition of the operating system suitable
201 for presentation to the user. This field may be used to inform the user that the configuration of
202 this system is subject to a specific divergent set of rules or default configuration settings. This
203 field is optional and may not be implemented on all systems.</para>
204
205 <para>Examples: <literal>VARIANT="Server Edition"</literal>, <literal>VARIANT="Smart Refrigerator
206 Edition"</literal>.</para>
207
208 <para>Note: this field is for display purposes only. The <varname>VARIANT_ID</varname> field should
209 be used for making programmatic decisions.</para></listitem>
210 </varlistentry>
211
212 <varlistentry>
213 <term><varname>VARIANT_ID=</varname></term>
214
215 <listitem><para>A lower-case string (no spaces or other characters outside of 09, a–z, ".", "_" and
216 "-"), identifying a specific variant or edition of the operating system. This may be interpreted by
217 other packages in order to determine a divergent default configuration. This field is optional and
218 may not be implemented on all systems.</para>
219
220 <para>Examples: <literal>VARIANT_ID=server</literal>, <literal>VARIANT_ID=embedded</literal>.
221 </para></listitem>
222 </varlistentry>
223 </variablelist>
224 </refsect2>
225
226 <refsect2>
227 <title>Information about the version of the operating system</title>
228
229 <variablelist class='environment-variables'>
230 <varlistentry>
231 <term><varname>VERSION=</varname></term>
232
233 <listitem><para>A string identifying the operating system version, excluding any OS name
234 information, possibly including a release code name, and suitable for presentation to the
235 user. This field is optional.</para>
236
237 <para>Examples: <literal>VERSION=17</literal>, <literal>VERSION="17 (Beefy Miracle)"</literal>.
238 </para></listitem>
239 </varlistentry>
240
241 <varlistentry>
242 <term><varname>VERSION_ID=</varname></term>
243
244 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 09,
245 a–z, ".", "_" and "-") identifying the operating system version, excluding any OS name information
246 or release code name, and suitable for processing by scripts or usage in generated filenames. This
247 field is optional.</para>
248
249 <para>Examples: <literal>VERSION_ID=17</literal>, <literal>VERSION_ID=11.04</literal>.
250 </para></listitem>
251 </varlistentry>
252
253 <varlistentry>
254 <term><varname>VERSION_CODENAME=</varname></term>
255
256 <listitem><para>A lower-case string (no spaces or other characters outside of 09, a–z, ".", "_"
257 and "-") identifying the operating system release code name, excluding any OS name information or
258 release version, and suitable for processing by scripts or usage in generated filenames. This field
259 is optional and may not be implemented on all systems.</para>
260
261 <para>Examples: <literal>VERSION_CODENAME=buster</literal>,
262 <literal>VERSION_CODENAME=xenial</literal>.</para></listitem>
263 </varlistentry>
264
265 <varlistentry>
266 <term><varname>BUILD_ID=</varname></term>
267
268 <listitem><para>A string uniquely identifying the system image originally used as the installation
269 base. In most cases, <varname>VERSION_ID</varname> or
270 <varname>IMAGE_ID</varname>+<varname>IMAGE_VERSION</varname> are updated when the entire system
271 image is replaced during an update. <varname>BUILD_ID</varname> may be used in distributions where
272 the original installation image version is important: <varname>VERSION_ID</varname> would change
273 during incremental system updates, but <varname>BUILD_ID</varname> would not. This field is
274 optional.</para>
275
276 <para>Examples: <literal>BUILD_ID="2013-03-20.3"</literal>, <literal>BUILD_ID=201303203</literal>.
277 </para></listitem>
278 </varlistentry>
279
280 <varlistentry>
281 <term><varname>IMAGE_ID=</varname></term>
282
283 <listitem><para> A lower-case string (no spaces or other characters outside of 09, a–z, ".", "_"
284 and "-"), identifying a specific image of the operating system. This is supposed to be used for
285 environments where OS images are prepared, built, shipped and updated as comprehensive, consistent
286 OS images. This field is optional and may not be implemented on all systems, in particularly not on
287 those that are not managed via images but put together and updated from individual packages and on
288 the local system.</para>
289
290 <para>Examples: <literal>IMAGE_ID=vendorx-cashier-system</literal>,
291 <literal>IMAGE_ID=netbook-image</literal>.</para></listitem>
292 </varlistentry>
293
294 <varlistentry>
295 <term><varname>IMAGE_VERSION=</varname></term>
296
297 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 09,
298 a–z, ".", "_" and "-") identifying the OS image version. This is supposed to be used together with
299 <varname>IMAGE_ID</varname> described above, to discern different versions of the same image.
300 </para>
301
302 <para>Examples: <literal>IMAGE_VERSION=33</literal>, <literal>IMAGE_VERSION=47.1rc1</literal>.
303 </para></listitem>
304 </varlistentry>
305 </variablelist>
306
307 <para>To summarize: if the image updates are built and shipped as comprehensive units,
308 <varname>IMAGE_ID</varname>+<varname>IMAGE_VERSION</varname> is the best fit. Otherwise, if updates
309 eventually completely replace previously installed contents, as in a typical binary distribution,
310 <varname>VERSION_ID</varname> should be used to identify major releases of the operating system.
311 <varname>BUILD_ID</varname> may be used instead or in addition to <varname>VERSION_ID</varname> when
312 the original system image version is important.</para>
313 </refsect2>
314
315 <refsect2>
316 <title>Presentation information and links</title>
317
318 <variablelist class='environment-variables'>
319 <varlistentry>
320 <term><varname>HOME_URL=</varname></term>
321 <term><varname>DOCUMENTATION_URL=</varname></term>
322 <term><varname>SUPPORT_URL=</varname></term>
323 <term><varname>BUG_REPORT_URL=</varname></term>
324 <term><varname>PRIVACY_POLICY_URL=</varname></term>
325
326 <listitem><para>Links to resources on the Internet related to the operating system.
327 <varname>HOME_URL=</varname> should refer to the homepage of the operating system, or alternatively
328 some homepage of the specific version of the operating system.
329 <varname>DOCUMENTATION_URL=</varname> should refer to the main documentation page for this
330 operating system. <varname>SUPPORT_URL=</varname> should refer to the main support page for the
331 operating system, if there is any. This is primarily intended for operating systems which vendors
332 provide support for. <varname>BUG_REPORT_URL=</varname> should refer to the main bug reporting page
333 for the operating system, if there is any. This is primarily intended for operating systems that
334 rely on community QA. <varname>PRIVACY_POLICY_URL=</varname> should refer to the main privacy
335 policy page for the operating system, if there is any. These settings are optional, and providing
336 only some of these settings is common. These URLs are intended to be exposed in "About this system"
337 UIs behind links with captions such as "About this Operating System", "Obtain Support", "Report a
338 Bug", or "Privacy Policy". The values should be in <ulink
339 url="https://tools.ietf.org/html/rfc3986">RFC3986 format</ulink>, and should be
340 <literal>http:</literal> or <literal>https:</literal> URLs, and possibly <literal>mailto:</literal>
341 or <literal>tel:</literal>. Only one URL shall be listed in each setting. If multiple resources
342 need to be referenced, it is recommended to provide an online landing page linking all available
343 resources.</para>
344
345 <para>Examples: <literal>HOME_URL="https://fedoraproject.org/"</literal>,
346 <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal>.</para></listitem>
347 </varlistentry>
348
349 <varlistentry>
350 <term><varname>LOGO=</varname></term>
351
352 <listitem><para>A string, specifying the name of an icon as defined by <ulink
353 url="http://standards.freedesktop.org/icon-theme-spec/latest">freedesktop.org Icon Theme
354 Specification</ulink>. This can be used by graphical applications to display an operating system's
355 or distributor's logo. This field is optional and may not necessarily be implemented on all
356 systems.</para>
357
358 <para>Examples: <literal>LOGO=fedora-logo</literal>, <literal>LOGO=distributor-logo-opensuse</literal>
359 </para></listitem>
360 </varlistentry>
361
362 <varlistentry>
363 <term><varname>ANSI_COLOR=</varname></term>
364
365 <listitem><para>A suggested presentation color when showing the OS name on the console. This should
366 be specified as string suitable for inclusion in the ESC [ m ANSI/ECMA-48 escape code for setting
367 graphical rendition. This field is optional.</para>
368
369 <para>Examples: <literal>ANSI_COLOR="0;31"</literal> for red, <literal>ANSI_COLOR="1;34"</literal>
370 for light blue, or <literal>ANSI_COLOR="0;38;2;60;110;180"</literal> for Fedora blue.
371 </para></listitem>
372 </varlistentry>
373 </variablelist>
374 </refsect2>
375
376 <refsect2>
377 <title>Distribution-level defaults and metadata</title>
378
379 <variablelist class='environment-variables'>
380 <varlistentry>
381 <term><varname>DEFAULT_HOSTNAME=</varname></term>
382
383 <listitem><para>A string specifying the hostname if
384 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry> is not
385 present and no other configuration source specifies the hostname. Must be either a single DNS label
386 (a string composed of 7-bit ASCII lower-case characters and no spaces or dots, limited to the
387 format allowed for DNS domain name labels), or a sequence of such labels separated by single dots
388 that forms a valid DNS FQDN. The hostname must be at most 64 characters, which is a Linux
389 limitation (DNS allows longer names).</para>
390
391 <para>See <citerefentry><refentrytitle>org.freedesktop.hostname1</refentrytitle><manvolnum>5</manvolnum></citerefentry>
392 for a description of how
393 <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
394 determines the fallback hostname.</para></listitem>
395 </varlistentry>
396
397 <varlistentry>
398 <term><varname>SYSEXT_LEVEL=</varname></term>
399
400 <listitem><para>A lower-case string (mostly numeric, no spaces or other characters outside of 09,
401 a–z, ".", "_" and "-") identifying the operating system extensions support level, to indicate which
402 extension images are supported. See <filename>/usr/lib/extension-release.d/extension-release.<replaceable>IMAGE</replaceable></filename>,
403 <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/initrd.html">initrd</ulink> and
404 <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
405 for more information.</para>
406
407 <para>Examples: <literal>SYSEXT_LEVEL=2</literal>, <literal>SYSEXT_LEVEL=15.14</literal>.
408 </para></listitem>
409 </varlistentry>
410
411 <varlistentry>
412 <term><varname>SYSEXT_SCOPE=</varname></term>
413 <listitem><para>Takes a space-separated list of one or more of the strings
414 <literal>system</literal>, <literal>initrd</literal> and <literal>portable</literal>. This field is
415 only supported in <filename>extension-release.d/</filename> files and indicates what environments
416 the system extension is applicable to: i.e. to regular systems, to initial RAM filesystems
417 ("initrd") or to portable service images. If unspecified, <literal>SYSEXT_SCOPE=system
418 portable</literal> is implied, i.e. any system extension without this field is applicable to
419 regular systems and to portable service environments, but not to initrd
420 environments.</para></listitem>
421 </varlistentry>
422
423 <varlistentry>
424 <term><varname>PORTABLE_PREFIXES=</varname></term>
425 <listitem><para>Takes a space-separated list of one or more valid prefix match strings for the
426 <ulink url="https://systemd.io/PORTABLE_SERVICES">Portable Services</ulink> logic. This field
427 serves two purposes: it is informational, identifying portable service images as such (and thus
428 allowing them to be distinguished from other OS images, such as bootable system images). In is also
429 used when a portable service image is attached: the specified or implied portable service prefix is
430 checked against the list specified here, to enforce restrictions how images may be attached to a
431 system.</para></listitem>
432 </varlistentry>
433 </variablelist>
434 </refsect2>
435
436 <refsect2>
437 <title>Notes</title>
438
439 <para>If you are using this file to determine the OS or a specific version of it, use the
440 <varname>ID</varname> and <varname>VERSION_ID</varname> fields, possibly with
441 <varname>ID_LIKE</varname> as fallback for <varname>ID</varname>. When looking for an OS identification
442 string for presentation to the user use the <varname>PRETTY_NAME</varname> field.</para>
443
444 <para>Note that operating system vendors may choose not to provide version information, for example to
445 accommodate for rolling releases. In this case, <varname>VERSION</varname> and
446 <varname>VERSION_ID</varname> may be unset. Applications should not rely on these fields to be
447 set.</para>
448
449 <para>Operating system vendors may extend the file format and introduce new fields. It is highly
450 recommended to prefix new fields with an OS specific name in order to avoid name clashes. Applications
451 reading this file must ignore unknown fields.</para>
452
453 <para>Example: <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal>.</para>
454
455 <para>Container and sandbox runtime managers may make the host's identification data available to
456 applications by providing the host's <filename>/etc/os-release</filename> (if available, otherwise
457 <filename>/usr/lib/os-release</filename> as a fallback) as
458 <filename>/run/host/os-release</filename>.</para>
459 </refsect2>
460 </refsect1>
461
462 <refsect1>
463 <title>Examples</title>
464
465 <example>
466 <title><filename>os-release</filename> file for Fedora Workstation</title>
467
468 <programlisting>NAME=Fedora
469 VERSION="32 (Workstation Edition)"
470 ID=fedora
471 VERSION_ID=32
472 PRETTY_NAME="Fedora 32 (Workstation Edition)"
473 ANSI_COLOR="0;38;2;60;110;180"
474 LOGO=fedora-logo-icon
475 CPE_NAME="cpe:/o:fedoraproject:fedora:32"
476 HOME_URL="https://fedoraproject.org/"
477 DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/"
478 SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
479 BUG_REPORT_URL="https://bugzilla.redhat.com/"
480 REDHAT_BUGZILLA_PRODUCT="Fedora"
481 REDHAT_BUGZILLA_PRODUCT_VERSION=32
482 REDHAT_SUPPORT_PRODUCT="Fedora"
483 REDHAT_SUPPORT_PRODUCT_VERSION=32
484 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
485 VARIANT="Workstation Edition"
486 VARIANT_ID=workstation</programlisting>
487 </example>
488
489 <example>
490 <title><filename>extension-release</filename> file for an extension for Fedora Workstation 32</title>
491
492 <programlisting>ID=fedora
493 VERSION_ID=32</programlisting>
494 </example>
495
496 <example>
497 <title>Reading <filename>os-release</filename> in
498 <citerefentry><refentrytitle>sh</refentrytitle><manvolnum>1</manvolnum></citerefentry></title>
499
500 <programlisting><xi:include href="check-os-release.sh" parse="text" /></programlisting>
501 </example>
502
503 <example>
504 <title>Reading <filename>os-release</filename> in
505 <citerefentry><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry> (versions &gt;= 3.10)</title>
506
507 <programlisting><xi:include href="check-os-release-simple.py" parse="text" /></programlisting>
508
509 <para>See docs for <ulink url="https://docs.python.org/3/library/platform.html#platform.freedesktop_os_release">
510 <function>platform.freedesktop_os_release</function></ulink> for more details.
511 </para>
512 </example>
513
514 <example>
515 <title>Reading <filename>os-release</filename> in
516 <citerefentry><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry> (any version)</title>
517
518 <programlisting><xi:include href="check-os-release.py" parse="text" /></programlisting>
519
520 <para>Note that the above version that uses the built-in implementation is preferred
521 in most cases, and the open-coded version here is provided for reference.</para>
522 </example>
523
524 </refsect1>
525
526 <refsect1>
527 <title>See Also</title>
528 <para>
529 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
530 <citerefentry project='die-net'><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
531 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
532 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
533 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>
534 </para>
535 </refsect1>
536
537 </refentry>