]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/os-release.xml
man: revert dynamic paths for split-usr setups
[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, 0-9. 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 0-9, 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_ID=</varname></term>
180
181 <listitem><para>A lower-case string (mostly numeric, no spaces
182 or other characters outside of 0-9, a-z, ".", "_" and "-")
183 identifying the operating system version, excluding any OS
184 name information or release code name, and suitable for
185 processing by scripts or usage in generated filenames. This
186 field is optional. Example: <literal>VERSION_ID=17</literal>
187 or <literal>VERSION_ID=11.04</literal>.</para></listitem>
188 </varlistentry>
189
190 <varlistentry>
191 <term><varname>PRETTY_NAME=</varname></term>
192
193 <listitem><para>A pretty operating system name in a format
194 suitable for presentation to the user. May or may not contain
195 a release code name or OS version of some kind, as suitable.
196 If not set, defaults to
197 <literal>PRETTY_NAME="Linux"</literal>. Example:
198 <literal>PRETTY_NAME="Fedora 17 (Beefy
199 Miracle)"</literal>.</para></listitem>
200 </varlistentry>
201
202 <varlistentry>
203 <term><varname>ANSI_COLOR=</varname></term>
204
205 <listitem><para>A suggested presentation color when showing
206 the OS name on the console. This should be specified as string
207 suitable for inclusion in the ESC [ m ANSI/ECMA-48 escape code
208 for setting graphical rendition. This field is optional.
209 Example: <literal>ANSI_COLOR="0;31"</literal> for red, or
210 <literal>ANSI_COLOR="1;34"</literal> for light
211 blue.</para></listitem>
212 </varlistentry>
213
214 <varlistentry>
215 <term><varname>CPE_NAME=</varname></term>
216
217 <listitem><para>A CPE name for the operating system, following
218 the <ulink url="https://cpe.mitre.org/specification/">Common
219 Platform Enumeration Specification</ulink> as proposed by the
220 MITRE Corporation. This field is optional. Example:
221 <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal>
222 </para></listitem>
223 </varlistentry>
224
225 <varlistentry>
226 <term><varname>HOME_URL=</varname></term>
227 <term><varname>SUPPORT_URL=</varname></term>
228 <term><varname>BUG_REPORT_URL=</varname></term>
229 <term><varname>PRIVACY_POLICY_URL=</varname></term>
230
231 <listitem><para>Links to resources on the Internet related the
232 operating system. <varname>HOME_URL=</varname> should refer to
233 the homepage of the operating system, or alternatively some
234 homepage of the specific version of the operating system.
235 <varname>SUPPORT_URL=</varname> should refer to the main
236 support page for the operating system, if there is any. This
237 is primarily intended for operating systems which vendors
238 provide support for. <varname>BUG_REPORT_URL=</varname> should
239 refer to the main bug reporting page for the operating system,
240 if there is any. This is primarily intended for operating
241 systems that rely on community QA.
242 <varname>PRIVACY_POLICY_URL=</varname> should refer to the
243 main privacy policy page for the operation system, if there is
244 any. These settings are optional, and providing only some of
245 these settings is common. These URLs are intended to be
246 exposed in "About this system" UIs behind links with captions
247 such as "About this Operating System", "Obtain Support",
248 "Report a Bug", or "Privacy Policy". The values should be in
249 <ulink url="https://tools.ietf.org/html/rfc3986">RFC3986
250 format</ulink>, and should be <literal>http:</literal> or
251 <literal>https:</literal> URLs, and possibly
252 <literal>mailto:</literal> or <literal>tel:</literal>. Only
253 one URL shall be listed in each setting. If multiple resources
254 need to be referenced, it is recommended to provide an online
255 landing page linking all available resources. Examples:
256 <literal>HOME_URL="https://fedoraproject.org/"</literal> and
257 <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal></para></listitem>
258 </varlistentry>
259
260 <varlistentry>
261 <term><varname>BUILD_ID=</varname></term>
262
263 <listitem><para>A string uniquely identifying the system image
264 used as the origin for a distribution (it is not updated with
265 system updates). The field can be identical between different
266 VERSION_IDs as BUILD_ID is an only a unique identifier to a
267 specific version. Distributions that release each update as a
268 new version would only need to use VERSION_ID as each build is
269 already distinct based on the VERSION_ID. This field is
270 optional. Example: <literal>BUILD_ID="2013-03-20.3"</literal>
271 or <literal>BUILD_ID=201303203</literal>.
272
273 </para></listitem>
274 </varlistentry>
275
276 <varlistentry>
277 <term><varname>VARIANT=</varname></term>
278
279 <listitem><para>
280 A string identifying a specific variant or edition of the
281 operating system suitable for presentation to the user. This
282 field may be used to inform the user that the configuration of
283 this system is subject to a specific divergent set of rules or
284 default configuration settings. This field is optional and may
285 not be implemented on all systems.
286 Examples:
287 <literal>VARIANT="Server Edition"</literal>,
288 <literal>VARIANT="Smart Refrigerator Edition"</literal>
289 Note: this field is for display purposes only. The
290 <varname>VARIANT_ID</varname> field should be used for making
291 programmatic decisions.
292 </para></listitem>
293 </varlistentry>
294
295 <varlistentry>
296 <term><varname>VARIANT_ID=</varname></term>
297
298 <listitem><para>
299 A lower-case string (no spaces or other characters outside of
300 0-9, a-z, ".", "_" and "-"), identifying a specific variant or
301 edition of the operating system. This may be interpreted by
302 other packages in order to determine a divergent default
303 configuration. This field is optional and may not be
304 implemented on all systems.
305 Examples:
306 <literal>VARIANT_ID=server</literal>,
307 <literal>VARIANT_ID=embedded</literal>
308 </para></listitem>
309 </varlistentry>
310
311 </variablelist>
312
313 <para>If you are reading this file from C code or a shell script
314 to determine the OS or a specific version of it, use the
315 <varname>ID</varname> and <varname>VERSION_ID</varname> fields,
316 possibly with <varname>ID_LIKE</varname> as fallback for
317 <varname>ID</varname>. When looking for an OS identification
318 string for presentation to the user use the
319 <varname>PRETTY_NAME</varname> field.</para>
320
321 <para>Note that operating system vendors may choose not to provide
322 version information, for example to accommodate for rolling
323 releases. In this case, <varname>VERSION</varname> and
324 <varname>VERSION_ID</varname> may be unset. Applications should
325 not rely on these fields to be set.</para>
326
327 <para>Operating system vendors may extend the file
328 format and introduce new fields. It is highly
329 recommended to prefix new fields with an OS specific
330 name in order to avoid name clashes. Applications
331 reading this file must ignore unknown fields. Example:
332 <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal></para>
333 </refsect1>
334
335 <refsect1>
336 <title>Example</title>
337
338 <programlisting>NAME=Fedora
339 VERSION="17 (Beefy Miracle)"
340 ID=fedora
341 VERSION_ID=17
342 PRETTY_NAME="Fedora 17 (Beefy Miracle)"
343 ANSI_COLOR="0;34"
344 CPE_NAME="cpe:/o:fedoraproject:fedora:17"
345 HOME_URL="https://fedoraproject.org/"
346 BUG_REPORT_URL="https://bugzilla.redhat.com/"</programlisting>
347 </refsect1>
348
349 <refsect1>
350 <title>See Also</title>
351 <para>
352 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
353 <citerefentry project='die-net'><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
354 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
355 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
356 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>
357 </para>
358 </refsect1>
359
360 </refentry>