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