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