]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/os-release.xml
man: fix link markup
[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+ -->
5
6 <refentry id="os-release">
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 <refpurpose>Operating system identification</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <para><filename>/etc/os-release</filename></para>
24 <para><filename>/usr/lib/os-release</filename></para>
25 </refsynopsisdiv>
26
27 <refsect1>
28 <title>Description</title>
29
30 <para>The <filename>/etc/os-release</filename> and
31 <filename>/usr/lib/os-release</filename> files contain operating
32 system identification data.</para>
33
34 <para>The basic file format of <filename>os-release</filename> is
35 a newline-separated list of environment-like shell-compatible
36 variable assignments. It is possible to source the configuration
37 from shell scripts, however, beyond mere variable assignments, no
38 shell features are supported (this means variable expansion is
39 explicitly not supported), allowing applications to read the file
40 without implementing a shell compatible execution engine. Variable
41 assignment values must be enclosed in double or single quotes if
42 they include spaces, semicolons or other special characters
43 outside of A–Z, a–z, 09. Shell special characters ("$", quotes,
44 backslash, backtick) must be escaped with backslashes, following
45 shell style. All strings should be in UTF-8 format, and
46 non-printable characters should not be used. It is not supported
47 to concatenate multiple individually quoted strings. Lines
48 beginning with "#" shall be ignored as comments. Blank lines are
49 permitted and ignored.</para>
50
51 <para>The file <filename>/etc/os-release</filename> takes
52 precedence over <filename>/usr/lib/os-release</filename>.
53 Applications should check for the former, and exclusively use its
54 data if it exists, and only fall back to
55 <filename>/usr/lib/os-release</filename> if it is missing.
56 Applications should not read data from both files at the same
57 time. <filename>/usr/lib/os-release</filename> is the recommended
58 place to store OS release information as part of vendor trees.
59 <filename>/etc/os-release</filename> should be a relative symlink
60 to <filename>/usr/lib/os-release</filename>, to provide
61 compatibility with applications only looking at
62 <filename>/etc</filename>. A relative symlink instead of an
63 absolute symlink is necessary to avoid breaking the link in a
64 chroot or initrd environment such as dracut.</para>
65
66 <para><filename>os-release</filename> contains data that is
67 defined by the operating system vendor and should generally not be
68 changed by the administrator.</para>
69
70 <para>As this file only encodes names and identifiers it should
71 not be localized.</para>
72
73 <para>The <filename>/etc/os-release</filename> and
74 <filename>/usr/lib/os-release</filename> files might be symlinks
75 to other files, but it is important that the file is available
76 from earliest boot on, and hence must be located on the root file
77 system.</para>
78
79 <para>For a longer rationale for <filename>os-release</filename>
80 please refer to the <ulink
81 url="http://0pointer.de/blog/projects/os-release">Announcement of <filename>/etc/os-release</filename></ulink>.</para>
82 </refsect1>
83
84 <refsect1>
85 <title>Options</title>
86
87 <para>The following OS identifications parameters may be set using
88 <filename>os-release</filename>:</para>
89
90 <variablelist class='environment-variables'>
91
92 <varlistentry>
93 <term><varname>NAME=</varname></term>
94
95 <listitem><para>A string identifying the operating system,
96 without a version component, and suitable for presentation to
97 the user. If not set, defaults to
98 <literal>NAME=Linux</literal>. Example:
99 <literal>NAME=Fedora</literal> or <literal>NAME="Debian
100 GNU/Linux"</literal>.</para></listitem>
101 </varlistentry>
102
103 <varlistentry>
104 <term><varname>VERSION=</varname></term>
105
106 <listitem><para>A string identifying the operating system
107 version, excluding any OS name information, possibly including
108 a release code name, and suitable for presentation to the
109 user. This field is optional. Example:
110 <literal>VERSION=17</literal> or <literal>VERSION="17 (Beefy
111 Miracle)"</literal>.</para></listitem>
112 </varlistentry>
113
114 <varlistentry>
115 <term><varname>ID=</varname></term>
116
117 <listitem><para>A lower-case string (no spaces or other
118 characters outside of 09, a–z, ".", "_" and "-") identifying
119 the operating system, excluding any version information and
120 suitable for processing by scripts or usage in generated
121 filenames. If not set, defaults to
122 <literal>ID=linux</literal>. Example:
123 <literal>ID=fedora</literal> or
124 <literal>ID=debian</literal>.</para></listitem>
125 </varlistentry>
126
127 <varlistentry>
128 <term><varname>ID_LIKE=</varname></term>
129
130 <listitem><para>A space-separated list of operating system
131 identifiers in the same syntax as the <varname>ID=</varname>
132 setting. It should list identifiers of operating systems that
133 are closely related to the local operating system in regards
134 to packaging and programming interfaces, for example listing
135 one or more OS identifiers the local OS is a derivative from.
136 An OS should generally only list other OS identifiers it
137 itself is a derivative of, and not any OSes that are derived
138 from it, though symmetric relationships are possible. Build
139 scripts and similar should check this variable if they need to
140 identify the local operating system and the value of
141 <varname>ID=</varname> is not recognized. Operating systems
142 should be listed in order of how closely the local operating
143 system relates to the listed ones, starting with the closest.
144 This field is optional. Example: for an operating system with
145 <literal>ID=centos</literal>, an assignment of
146 <literal>ID_LIKE="rhel fedora"</literal> would be appropriate.
147 For an operating system with <literal>ID=ubuntu</literal>, an
148 assignment of <literal>ID_LIKE=debian</literal> is
149 appropriate.</para></listitem>
150 </varlistentry>
151
152 <varlistentry>
153 <term><varname>VERSION_CODENAME=</varname></term>
154
155 <listitem><para>
156 A lower-case string (no spaces or other characters outside of
157 09, a–z, ".", "_" and "-") identifying the operating system
158 release code name, excluding any OS name information or
159 release version, and suitable for processing by scripts or
160 usage in generated filenames. This field is optional and may
161 not be implemented on all systems.
162 Examples:
163 <literal>VERSION_CODENAME=buster</literal>,
164 <literal>VERSION_CODENAME=xenial</literal>
165 </para></listitem>
166 </varlistentry>
167
168 <varlistentry>
169 <term><varname>VERSION_ID=</varname></term>
170
171 <listitem><para>A lower-case string (mostly numeric, no spaces
172 or other characters outside of 09, a–z, ".", "_" and "-")
173 identifying the operating system version, excluding any OS
174 name information or release code name, and suitable for
175 processing by scripts or usage in generated filenames. This
176 field is optional. Example: <literal>VERSION_ID=17</literal>
177 or <literal>VERSION_ID=11.04</literal>.</para></listitem>
178 </varlistentry>
179
180 <varlistentry>
181 <term><varname>PRETTY_NAME=</varname></term>
182
183 <listitem><para>A pretty operating system name in a format
184 suitable for presentation to the user. May or may not contain
185 a release code name or OS version of some kind, as suitable.
186 If not set, defaults to
187 <literal>PRETTY_NAME="Linux"</literal>. Example:
188 <literal>PRETTY_NAME="Fedora 17 (Beefy
189 Miracle)"</literal>.</para></listitem>
190 </varlistentry>
191
192 <varlistentry>
193 <term><varname>ANSI_COLOR=</varname></term>
194
195 <listitem><para>A suggested presentation color when showing the OS name on the console. This should
196 be specified as string suitable for inclusion in the ESC [ m ANSI/ECMA-48 escape code for setting
197 graphical rendition. This field is optional. Example: <literal>ANSI_COLOR="0;31"</literal> for red,
198 <literal>ANSI_COLOR="1;34"</literal> for light blue, or
199 <literal>ANSI_COLOR="0;38;2;60;110;180"</literal> for Fedora blue.</para></listitem>
200 </varlistentry>
201
202 <varlistentry>
203 <term><varname>CPE_NAME=</varname></term>
204
205 <listitem><para>A CPE name for the operating system, in URI
206 binding syntax, following the
207 <ulink url="http://scap.nist.gov/specifications/cpe/">Common
208 Platform Enumeration Specification</ulink> as proposed by the
209 NIST. This field is optional. Example:
210 <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal>
211 </para></listitem>
212 </varlistentry>
213
214 <varlistentry>
215 <term><varname>HOME_URL=</varname></term>
216 <term><varname>DOCUMENTATION_URL=</varname></term>
217 <term><varname>SUPPORT_URL=</varname></term>
218 <term><varname>BUG_REPORT_URL=</varname></term>
219 <term><varname>PRIVACY_POLICY_URL=</varname></term>
220
221 <listitem><para>Links to resources on the Internet related to
222 the operating system.
223 <varname>HOME_URL=</varname> should refer to the homepage of
224 the operating system, or alternatively some homepage of the
225 specific version of the operating system.
226 <varname>DOCUMENTATION_URL=</varname> should refer to the main
227 documentation page for this operating system.
228 <varname>SUPPORT_URL=</varname> should refer to the main
229 support page for the operating system, if there is any. This
230 is primarily intended for operating systems which vendors
231 provide support for. <varname>BUG_REPORT_URL=</varname> should
232 refer to the main bug reporting page for the operating system,
233 if there is any. This is primarily intended for operating
234 systems that rely on community QA.
235 <varname>PRIVACY_POLICY_URL=</varname> should refer to the
236 main privacy policy page for the operating system, if there is
237 any. These settings are optional, and providing only some of
238 these settings is common. These URLs are intended to be
239 exposed in "About this system" UIs behind links with captions
240 such as "About this Operating System", "Obtain Support",
241 "Report a Bug", or "Privacy Policy". The values should be in
242 <ulink url="https://tools.ietf.org/html/rfc3986">RFC3986
243 format</ulink>, and should be <literal>http:</literal> or
244 <literal>https:</literal> URLs, and possibly
245 <literal>mailto:</literal> or <literal>tel:</literal>. Only
246 one URL shall be listed in each setting. If multiple resources
247 need to be referenced, it is recommended to provide an online
248 landing page linking all available resources. Examples:
249 <literal>HOME_URL="https://fedoraproject.org/"</literal> and
250 <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal></para></listitem>
251 </varlistentry>
252
253 <varlistentry>
254 <term><varname>BUILD_ID=</varname></term>
255
256 <listitem><para>A string uniquely identifying the system image
257 used as the origin for a distribution (it is not updated with
258 system updates). The field can be identical between different
259 VERSION_IDs as BUILD_ID is an only a unique identifier to a
260 specific version. Distributions that release each update as a
261 new version would only need to use VERSION_ID as each build is
262 already distinct based on the VERSION_ID. This field is
263 optional. Example: <literal>BUILD_ID="2013-03-20.3"</literal>
264 or <literal>BUILD_ID=201303203</literal>.
265
266 </para></listitem>
267 </varlistentry>
268
269 <varlistentry>
270 <term><varname>VARIANT=</varname></term>
271
272 <listitem><para>
273 A string identifying a specific variant or edition of the
274 operating system suitable for presentation to the user. This
275 field may be used to inform the user that the configuration of
276 this system is subject to a specific divergent set of rules or
277 default configuration settings. This field is optional and may
278 not be implemented on all systems.
279 Examples:
280 <literal>VARIANT="Server Edition"</literal>,
281 <literal>VARIANT="Smart Refrigerator Edition"</literal>
282 Note: this field is for display purposes only. The
283 <varname>VARIANT_ID</varname> field should be used for making
284 programmatic decisions.
285 </para></listitem>
286 </varlistentry>
287
288 <varlistentry>
289 <term><varname>VARIANT_ID=</varname></term>
290
291 <listitem><para>
292 A lower-case string (no spaces or other characters outside of
293 09, a–z, ".", "_" and "-"), identifying a specific variant or
294 edition of the operating system. This may be interpreted by
295 other packages in order to determine a divergent default
296 configuration. This field is optional and may not be
297 implemented on all systems.
298 Examples:
299 <literal>VARIANT_ID=server</literal>,
300 <literal>VARIANT_ID=embedded</literal>
301 </para></listitem>
302 </varlistentry>
303
304 <varlistentry>
305 <term><varname>LOGO=</varname></term>
306
307 <listitem><para>
308 A string, specifying the name of an icon as defined by <ulink
309 url="http://standards.freedesktop.org/icon-theme-spec/latest">
310 freedesktop.org Icon Theme Specification</ulink>. This can be
311 used by graphical applications to display an operating
312 system's or distributor's logo. This field is optional and
313 may not necessarily be implemented on all systems.
314 Examples:
315 <literal>LOGO=fedora-logo</literal>,
316 <literal>LOGO=distributor-logo-opensuse</literal>
317 </para></listitem>
318 </varlistentry>
319
320 </variablelist>
321
322 <para>If you are reading this file from C code or a shell script
323 to determine the OS or a specific version of it, use the
324 <varname>ID</varname> and <varname>VERSION_ID</varname> fields,
325 possibly with <varname>ID_LIKE</varname> as fallback for
326 <varname>ID</varname>. When looking for an OS identification
327 string for presentation to the user use the
328 <varname>PRETTY_NAME</varname> field.</para>
329
330 <para>Note that operating system vendors may choose not to provide
331 version information, for example to accommodate for rolling
332 releases. In this case, <varname>VERSION</varname> and
333 <varname>VERSION_ID</varname> may be unset. Applications should
334 not rely on these fields to be set.</para>
335
336 <para>Operating system vendors may extend the file
337 format and introduce new fields. It is highly
338 recommended to prefix new fields with an OS specific
339 name in order to avoid name clashes. Applications
340 reading this file must ignore unknown fields. Example:
341 <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal></para>
342
343 <para>Container and sandbox runtime managers may make the host's
344 identification data available to applications by providing the host's
345 <filename>/etc/os-release</filename> (if available, otherwise
346 <filename>/usr/lib/os-release</filename> as a fallback) as
347 <filename>/run/host/os-release</filename>.</para>
348 </refsect1>
349
350 <refsect1>
351 <title>Example</title>
352
353 <programlisting>NAME=Fedora
354 VERSION="32 (Workstation Edition)"
355 ID=fedora
356 VERSION_ID=32
357 PRETTY_NAME="Fedora 32 (Workstation Edition)"
358 ANSI_COLOR="0;38;2;60;110;180"
359 LOGO=fedora-logo-icon
360 CPE_NAME="cpe:/o:fedoraproject:fedora:32"
361 HOME_URL="https://fedoraproject.org/"
362 DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/"
363 SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
364 BUG_REPORT_URL="https://bugzilla.redhat.com/"
365 REDHAT_BUGZILLA_PRODUCT="Fedora"
366 REDHAT_BUGZILLA_PRODUCT_VERSION=32
367 REDHAT_SUPPORT_PRODUCT="Fedora"
368 REDHAT_SUPPORT_PRODUCT_VERSION=32
369 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
370 VARIANT="Workstation Edition"
371 VARIANT_ID=workstation</programlisting>
372 </refsect1>
373
374 <refsect1>
375 <title>See Also</title>
376 <para>
377 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
378 <citerefentry project='die-net'><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
379 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
380 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
381 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>
382 </para>
383 </refsect1>
384
385 </refentry>