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