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