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