]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/os-release.xml
travis: add more ASan options
[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
196 the OS name on the console. This should be specified as string
197 suitable for inclusion in the ESC [ m ANSI/ECMA-48 escape code
198 for setting graphical rendition. This field is optional.
199 Example: <literal>ANSI_COLOR="0;31"</literal> for red, or
200 <literal>ANSI_COLOR="1;34"</literal> for light
201 blue.</para></listitem>
202 </varlistentry>
203
204 <varlistentry>
205 <term><varname>CPE_NAME=</varname></term>
206
207 <listitem><para>A CPE name for the operating system, in URI
208 binding syntax, following the
209 <ulink url="http://scap.nist.gov/specifications/cpe/">Common
210 Platform Enumeration Specification</ulink> as proposed by the
211 NIST. This field is optional. Example:
212 <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal>
213 </para></listitem>
214 </varlistentry>
215
216 <varlistentry>
217 <term><varname>HOME_URL=</varname></term>
218 <term><varname>DOCUMENTATION_URL=</varname></term>
219 <term><varname>SUPPORT_URL=</varname></term>
220 <term><varname>BUG_REPORT_URL=</varname></term>
221 <term><varname>PRIVACY_POLICY_URL=</varname></term>
222
223 <listitem><para>Links to resources on the Internet related to
224 the operating system.
225 <varname>HOME_URL=</varname> should refer to the homepage of
226 the operating system, or alternatively some homepage of the
227 specific version of the operating system.
228 <varname>DOCUMENTATION_URL=</varname> should refer to the main
229 documentation page for this operating system.
230 <varname>SUPPORT_URL=</varname> should refer to the main
231 support page for the operating system, if there is any. This
232 is primarily intended for operating systems which vendors
233 provide support for. <varname>BUG_REPORT_URL=</varname> should
234 refer to the main bug reporting page for the operating system,
235 if there is any. This is primarily intended for operating
236 systems that rely on community QA.
237 <varname>PRIVACY_POLICY_URL=</varname> should refer to the
238 main privacy policy page for the operating system, if there is
239 any. These settings are optional, and providing only some of
240 these settings is common. These URLs are intended to be
241 exposed in "About this system" UIs behind links with captions
242 such as "About this Operating System", "Obtain Support",
243 "Report a Bug", or "Privacy Policy". The values should be in
244 <ulink url="https://tools.ietf.org/html/rfc3986">RFC3986
245 format</ulink>, and should be <literal>http:</literal> or
246 <literal>https:</literal> URLs, and possibly
247 <literal>mailto:</literal> or <literal>tel:</literal>. Only
248 one URL shall be listed in each setting. If multiple resources
249 need to be referenced, it is recommended to provide an online
250 landing page linking all available resources. Examples:
251 <literal>HOME_URL="https://fedoraproject.org/"</literal> and
252 <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal></para></listitem>
253 </varlistentry>
254
255 <varlistentry>
256 <term><varname>BUILD_ID=</varname></term>
257
258 <listitem><para>A string uniquely identifying the system image
259 used as the origin for a distribution (it is not updated with
260 system updates). The field can be identical between different
261 VERSION_IDs as BUILD_ID is an only a unique identifier to a
262 specific version. Distributions that release each update as a
263 new version would only need to use VERSION_ID as each build is
264 already distinct based on the VERSION_ID. This field is
265 optional. Example: <literal>BUILD_ID="2013-03-20.3"</literal>
266 or <literal>BUILD_ID=201303203</literal>.
267
268 </para></listitem>
269 </varlistentry>
270
271 <varlistentry>
272 <term><varname>VARIANT=</varname></term>
273
274 <listitem><para>
275 A string identifying a specific variant or edition of the
276 operating system suitable for presentation to the user. This
277 field may be used to inform the user that the configuration of
278 this system is subject to a specific divergent set of rules or
279 default configuration settings. This field is optional and may
280 not be implemented on all systems.
281 Examples:
282 <literal>VARIANT="Server Edition"</literal>,
283 <literal>VARIANT="Smart Refrigerator Edition"</literal>
284 Note: this field is for display purposes only. The
285 <varname>VARIANT_ID</varname> field should be used for making
286 programmatic decisions.
287 </para></listitem>
288 </varlistentry>
289
290 <varlistentry>
291 <term><varname>VARIANT_ID=</varname></term>
292
293 <listitem><para>
294 A lower-case string (no spaces or other characters outside of
295 09, a–z, ".", "_" and "-"), identifying a specific variant or
296 edition of the operating system. This may be interpreted by
297 other packages in order to determine a divergent default
298 configuration. This field is optional and may not be
299 implemented on all systems.
300 Examples:
301 <literal>VARIANT_ID=server</literal>,
302 <literal>VARIANT_ID=embedded</literal>
303 </para></listitem>
304 </varlistentry>
305
306 <varlistentry>
307 <term><varname>LOGO=</varname></term>
308
309 <listitem><para>
310 A string, specifying the name of an icon as defined by <ulink
311 url="http://standards.freedesktop.org/icon-theme-spec/latest">
312 freedesktop.org Icon Theme Specification</ulink>. This can be
313 used by graphical applications to display an operating
314 system's or distributor's logo. This field is optional and
315 may not necessarily be implemented on all systems.
316 Examples:
317 <literal>LOGO=fedora-logo</literal>,
318 <literal>LOGO=distributor-logo-opensuse</literal>
319 </para></listitem>
320 </varlistentry>
321
322 </variablelist>
323
324 <para>If you are reading this file from C code or a shell script
325 to determine the OS or a specific version of it, use the
326 <varname>ID</varname> and <varname>VERSION_ID</varname> fields,
327 possibly with <varname>ID_LIKE</varname> as fallback for
328 <varname>ID</varname>. When looking for an OS identification
329 string for presentation to the user use the
330 <varname>PRETTY_NAME</varname> field.</para>
331
332 <para>Note that operating system vendors may choose not to provide
333 version information, for example to accommodate for rolling
334 releases. In this case, <varname>VERSION</varname> and
335 <varname>VERSION_ID</varname> may be unset. Applications should
336 not rely on these fields to be set.</para>
337
338 <para>Operating system vendors may extend the file
339 format and introduce new fields. It is highly
340 recommended to prefix new fields with an OS specific
341 name in order to avoid name clashes. Applications
342 reading this file must ignore unknown fields. Example:
343 <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal></para>
344 </refsect1>
345
346 <refsect1>
347 <title>Example</title>
348
349 <programlisting>NAME=Fedora
350 VERSION="17 (Beefy Miracle)"
351 ID=fedora
352 VERSION_ID=17
353 PRETTY_NAME="Fedora 17 (Beefy Miracle)"
354 ANSI_COLOR="0;34"
355 CPE_NAME="cpe:/o:fedoraproject:fedora:17"
356 HOME_URL="https://fedoraproject.org/"
357 BUG_REPORT_URL="https://bugzilla.redhat.com/"</programlisting>
358 </refsect1>
359
360 <refsect1>
361 <title>See Also</title>
362 <para>
363 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
364 <citerefentry project='die-net'><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
365 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
366 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
367 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>
368 </para>
369 </refsect1>
370
371 </refentry>