1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
7 This file is part of systemd.
9 Copyright 2010 Lennart Poettering
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 <refentry id="os-release">
27 <title>os-release</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>os-release</refentrytitle>
42 <manvolnum>5</manvolnum>
46 <refname>os-release</refname>
47 <refpurpose>Operating system identification</refpurpose>
51 <para><filename>/etc/os-release</filename></para>
52 <para><filename>/usr/lib/os-release</filename></para>
56 <title>Description</title>
58 <para>The <filename>/etc/os-release</filename> and
59 <filename>/usr/lib/os-release</filename> files contain
60 operating system identification data.</para>
62 <para>The basic file format of
63 <filename>os-release</filename> is a newline-separated
64 list of environment-like shell-compatible variable
65 assignments. It is possible to source the
66 configuration from shell scripts, however, beyond mere
67 variable assignments, no shell features are supported
68 (this means variable expansion is explicitly not
69 supported), allowing applications to read the file
70 without implementing a shell compatible execution
71 engine. Variable assignment values should be enclosed
72 in double or single quotes if they include spaces,
73 semicolons or other special characters outside of A-Z,
74 a-z, 0-9. All strings should be in UTF-8 format, and
75 non-printable characters should not be used. If double
76 or single quotes or backslashes are to be used within
77 variable assignments, they should be escaped with
78 backslashes, following shell style. It is not
79 supported to concatenate multiple individually quoted
80 strings. Lines beginning with "#" shall be ignored as
83 <para>The file <filename>/etc/os-release</filename>
85 <filename>/usr/lib/os-release</filename>. Applications
86 should check for the former, and exclusively use its
87 data if it exists, and only fall back to
88 <filename>/usr/lib/os-release</filename> if it is
89 missing. Applications should not read data from both
91 time. <filename>/usr/lib/os-release</filename> is the
92 recommended place to store OS release information as
93 part of vendor trees. Frequently,
94 <filename>/etc/os-release</filename> is simply a
95 symlink to <filename>/usr/lib/os-release</filename>,
96 to provide compatibility with applications only
97 looking at <filename>/etc</filename>.</para>
99 <para><filename>os-release</filename> contains data
100 that is defined by the operating system vendor and
101 should generally not be changed by the
102 administrator.</para>
104 <para>As this file only encodes names and identifiers
105 it should not be localized.</para>
107 <para>The <filename>/etc/os-release</filename> and
108 <filename>/usr/lib/os-release</filename> files might
109 be symlinks to other files, but it is important that
110 the file is available from earliest boot on, and hence
111 must be located on the root file system.</para>
113 <para>For a longer rationale for
114 <filename>os-release</filename> please refer to
116 url="http://0pointer.de/blog/projects/os-release">Announcement of <filename>/etc/os-release</filename></ulink>.</para>
120 <title>Options</title>
122 <para>The following OS identifications parameters may be set using
123 <filename>os-release</filename>:</para>
128 <term><varname>NAME=</varname></term>
130 <listitem><para>A string identifying
131 the operating system, without a
132 version component, and suitable for
133 presentation to the user. If not set,
135 <literal>NAME=Linux</literal>. Example:
136 <literal>NAME=Fedora</literal> or
137 <literal>NAME="Debian
138 GNU/Linux"</literal>.</para></listitem>
142 <term><varname>VERSION=</varname></term>
144 <listitem><para>A string identifying
145 the operating system version,
146 excluding any OS name information,
147 possibly including a release code
148 name, and suitable for presentation to
149 the user. This field is
151 <literal>VERSION=17</literal> or
152 <literal>VERSION="17 (Beefy
153 Miracle)"</literal>.</para></listitem>
157 <term><varname>ID=</varname></term>
159 <listitem><para>A lower-case string
160 (no spaces or other characters outside
161 of 0-9, a-z, ".", "_" and "-")
162 identifying the operating system,
163 excluding any version information and
164 suitable for processing by scripts or
165 usage in generated filenames. If not
167 <literal>ID=linux</literal>. Example:
168 <literal>ID=fedora</literal> or
169 <literal>ID=debian</literal>.</para></listitem>
173 <term><varname>ID_LIKE=</varname></term>
175 <listitem><para>A space-separated list
176 of operating system identifiers in the
178 <varname>ID=</varname> setting. It should
179 list identifiers of operating systems
180 that are closely related to the local
181 operating system in regards to
182 packaging and programming interfaces,
183 for example listing one or more
184 OS identifiers the local
185 OS is a derivative from. An
186 OS should generally only list other OS
187 identifiers it itself is a derivative
188 of, and not any OSes that
189 are derived from it, though symmetric
190 relationships are possible. Build
191 scripts and similar should check this
192 variable if they need to identify the
193 local operating system and the value
194 of <varname>ID=</varname> is not
195 recognized. Operating systems should
196 be listed in order of how closely the
197 local operating system relates to the
198 listed ones, starting with the
199 closest. This field is
200 optional. Example: for an operating
202 <literal>ID=centos</literal>, an
203 assignment of <literal>ID_LIKE="rhel
204 fedora"</literal> would be
205 appropriate. For an operating system
206 with <literal>ID=ubuntu</literal>, an
208 <literal>ID_LIKE=debian</literal> is
209 appropriate.</para></listitem>
213 <term><varname>VERSION_ID=</varname></term>
215 <listitem><para>A lower-case string
216 (mostly numeric, no spaces or other
217 characters outside of 0-9, a-z, ".",
218 "_" and "-") identifying the operating
219 system version, excluding any OS name
220 information or release code name, and
221 suitable for processing by scripts or
222 usage in generated filenames. This
223 field is optional. Example:
224 <literal>VERSION_ID=17</literal> or
225 <literal>VERSION_ID=11.04</literal>.</para></listitem>
229 <term><varname>PRETTY_NAME=</varname></term>
231 <listitem><para>A pretty operating
232 system name in a format suitable for
233 presentation to the user. May or may
234 not contain a release code name or OS
235 version of some kind, as suitable. If
237 <literal>PRETTY_NAME="Linux"</literal>. Example:
238 <literal>PRETTY_NAME="Fedora 17 (Beefy
239 Miracle)"</literal>.</para></listitem>
243 <term><varname>ANSI_COLOR=</varname></term>
245 <listitem><para>A suggested
246 presentation color when showing the
247 OS name on the console. This
248 should be specified as string suitable
249 for inclusion in the ESC [ m
250 ANSI/ECMA-48 escape code for setting
251 graphical rendition. This field is
253 <literal>ANSI_COLOR="0;31"</literal>
255 <literal>ANSI_COLOR="1;34"</literal>
256 for light blue.</para></listitem>
260 <term><varname>CPE_NAME=</varname></term>
262 <listitem><para>A CPE name for the
263 operating system, following the <ulink
264 url="https://cpe.mitre.org/specification/">Common
266 Specification</ulink> as proposed by
267 the MITRE Corporation. This field
268 is optional. Example:
269 <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal>
274 <term><varname>HOME_URL=</varname></term>
275 <term><varname>SUPPORT_URL=</varname></term>
276 <term><varname>BUG_REPORT_URL=</varname></term>
278 <listitem><para>Links to resources on
279 the Internet related the operating
280 system. <varname>HOME_URL=</varname>
281 should refer to the homepage of the
282 operating system, or alternatively
283 some homepage of the specific version
285 system. <varname>SUPPORT_URL=</varname>
286 should refer to the main support page
287 for the operating system, if there is
288 any. This is primarily intended for
289 operating systems which vendors
291 for. <varname>BUG_REPORT_URL=</varname>
292 should refer to the main bug reporting
293 page for the operating system, if
294 there is any. This is primarily
295 intended for operating systems that
296 rely on community QA. These settings
297 are optional, and providing only some
298 of these settings is common. These
299 URLs are intended to be exposed in
300 "About this system" UIs behind links
301 with captions such as "About this
302 Operating System", "Obtain Support",
303 and "Report a Bug". The values should
305 url="https://tools.ietf.org/html/rfc3986">RFC3986
306 format</ulink>, and should be
307 <literal>http:</literal> or
308 <literal>https:</literal> URLs, and
309 possibly <literal>mailto:</literal> or
310 <literal>tel:</literal>. Only one URL
311 shall be listed in each setting. If
312 multiple resources need to be
313 referenced, it is recommended to
314 provide an online landing page linking
315 all available resources. Examples:
316 <literal>HOME_URL="https://fedoraproject.org/"</literal>
318 <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal></para></listitem>
322 <term><varname>BUILD_ID=</varname></term>
324 <listitem><para>A string uniquely
325 identifying the system image used as
326 the origin for a distribution (it is
327 not updated with system updates). The
328 field can be identical between
329 different VERSION_IDs as BUILD_ID is
330 an only a unique identifier to a
331 specific version. Distributions that
332 release each update as a new version
333 would only need to use VERSION_ID as
334 each build is already distinct based
335 on the VERSION_ID. This field is
337 <literal>BUILD_ID="2013-03-20.3"</literal>
339 <literal>BUILD_ID=201303203</literal>.
346 <para>If you are reading this file from C code or a
347 shell script to determine the OS or a specific version
348 of it, use the ID and VERSION_ID fields, possibly with
349 ID_LIKE as fallback for ID. When looking for an OS
350 identification string for presentation to the user use
351 the PRETTY_NAME field.</para>
353 <para>Note that operating system vendors may choose
354 not to provide version information, for example to
355 accommodate for rolling releases. In this case, VERSION
356 and VERSION_ID may be unset. Applications should not
357 rely on these fields to be set.</para>
359 <para>Operating system vendors may extend the file
360 format and introduce new fields. It is highly
361 recommended to prefix new fields with an OS specific
362 name in order to avoid name clashes. Applications
363 reading this file must ignore unknown fields. Example:
364 <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal></para>
368 <title>Example</title>
370 <programlisting>NAME=Fedora
371 VERSION="17 (Beefy Miracle)"
374 PRETTY_NAME="Fedora 17 (Beefy Miracle)"
376 CPE_NAME="cpe:/o:fedoraproject:fedora:17"
377 HOME_URL="https://fedoraproject.org/"
378 BUG_REPORT_URL="https://bugzilla.redhat.com/"</programlisting>
382 <title>See Also</title>
384 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
385 <citerefentry><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
386 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
387 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
388 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>