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