]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/os-release.xml
Merge pull request #74 from systemd-mailing-devs/1432753344-31461-1-git-send-email...
[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 <!ENTITY % entities SYSTEM "custom-entities.ent" >
5 %entities;
6 ]>
7
8 <!--
9 This file is part of systemd.
10
11 Copyright 2010 Lennart Poettering
12
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
17
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 -->
26
27 <refentry id="os-release">
28 <refentryinfo>
29 <title>os-release</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
38 </author>
39 </authorgroup>
40 </refentryinfo>
41
42 <refmeta>
43 <refentrytitle>os-release</refentrytitle>
44 <manvolnum>5</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>os-release</refname>
49 <refpurpose>Operating system identification</refpurpose>
50 </refnamediv>
51
52 <refsynopsisdiv>
53 <para><filename>/etc/os-release</filename></para>
54 <para><filename>/usr/lib/os-release</filename></para>
55 </refsynopsisdiv>
56
57 <refsect1>
58 <title>Description</title>
59
60 <para>The <filename>/etc/os-release</filename> and
61 <filename>/usr/lib/os-release</filename> files contain operating
62 system identification data.</para>
63
64 <para>The basic file format of <filename>os-release</filename> is
65 a newline-separated list of environment-like shell-compatible
66 variable assignments. It is possible to source the configuration
67 from shell scripts, however, beyond mere variable assignments, no
68 shell features are supported (this means variable expansion is
69 explicitly not supported), allowing applications to read the file
70 without implementing a shell compatible execution engine. Variable
71 assignment values must be enclosed in double or single quotes if
72 they include spaces, semicolons or other special characters
73 outside of A-Z, a-z, 0-9. Shell special characters ("$", quotes,
74 backslash, backtick) must be escaped with backslashes, following
75 shell style. All strings should be in UTF-8 format, and
76 non-printable characters should not be used. It is not supported
77 to concatenate multiple individually quoted strings. Lines
78 beginning with "#" shall be ignored as comments.</para>
79
80 <para>The file <filename>/etc/os-release</filename> takes
81 precedence over <filename>/usr/lib/os-release</filename>.
82 Applications should check for the former, and exclusively use its
83 data if it exists, and only fall back to
84 <filename>/usr/lib/os-release</filename> if it is missing.
85 Applications should not read data from both files at the same
86 time. <filename>/usr/lib/os-release</filename> is the recommended
87 place to store OS release information as part of vendor trees.
88 <filename>/etc/os-release</filename> should be a relative symlink
89 to <filename>/usr/lib/os-release</filename>, to provide
90 compatibility with applications only looking at
91 <filename>/etc</filename>. A relative symlink instead of an
92 absolute symlink is necessary to avoid breaking the link in a
93 chroot or initrd environment such as dracut.</para>
94
95 <para><filename>os-release</filename> contains data that is
96 defined by the operating system vendor and should generally not be
97 changed by the administrator.</para>
98
99 <para>As this file only encodes names and identifiers it should
100 not be localized.</para>
101
102 <para>The <filename>/etc/os-release</filename> and
103 <filename>/usr/lib/os-release</filename> files might be symlinks
104 to other files, but it is important that the file is available
105 from earliest boot on, and hence must be located on the root file
106 system.</para>
107
108 <para>For a longer rationale for <filename>os-release</filename>
109 please refer to the <ulink
110 url="http://0pointer.de/blog/projects/os-release">Announcement of <filename>/etc/os-release</filename></ulink>.</para>
111 </refsect1>
112
113 <refsect1>
114 <title>Options</title>
115
116 <para>The following OS identifications parameters may be set using
117 <filename>os-release</filename>:</para>
118
119 <variablelist>
120
121 <varlistentry>
122 <term><varname>NAME=</varname></term>
123
124 <listitem><para>A string identifying the operating system,
125 without a version component, and suitable for presentation to
126 the user. If not set, defaults to
127 <literal>NAME=Linux</literal>. Example:
128 <literal>NAME=Fedora</literal> or <literal>NAME="Debian
129 GNU/Linux"</literal>.</para></listitem>
130 </varlistentry>
131
132 <varlistentry>
133 <term><varname>VERSION=</varname></term>
134
135 <listitem><para>A string identifying the operating system
136 version, excluding any OS name information, possibly including
137 a release code name, and suitable for presentation to the
138 user. This field is optional. Example:
139 <literal>VERSION=17</literal> or <literal>VERSION="17 (Beefy
140 Miracle)"</literal>.</para></listitem>
141 </varlistentry>
142
143 <varlistentry>
144 <term><varname>ID=</varname></term>
145
146 <listitem><para>A lower-case string (no spaces or other
147 characters outside of 0-9, a-z, ".", "_" and "-") identifying
148 the operating system, excluding any version information and
149 suitable for processing by scripts or usage in generated
150 filenames. If not set, defaults to
151 <literal>ID=linux</literal>. Example:
152 <literal>ID=fedora</literal> or
153 <literal>ID=debian</literal>.</para></listitem>
154 </varlistentry>
155
156 <varlistentry>
157 <term><varname>ID_LIKE=</varname></term>
158
159 <listitem><para>A space-separated list of operating system
160 identifiers in the same syntax as the <varname>ID=</varname>
161 setting. It should list identifiers of operating systems that
162 are closely related to the local operating system in regards
163 to packaging and programming interfaces, for example listing
164 one or more OS identifiers the local OS is a derivative from.
165 An OS should generally only list other OS identifiers it
166 itself is a derivative of, and not any OSes that are derived
167 from it, though symmetric relationships are possible. Build
168 scripts and similar should check this variable if they need to
169 identify the local operating system and the value of
170 <varname>ID=</varname> is not recognized. Operating systems
171 should be listed in order of how closely the local operating
172 system relates to the listed ones, starting with the closest.
173 This field is optional. Example: for an operating system with
174 <literal>ID=centos</literal>, an assignment of
175 <literal>ID_LIKE="rhel fedora"</literal> would be appropriate.
176 For an operating system with <literal>ID=ubuntu</literal>, an
177 assignment of <literal>ID_LIKE=debian</literal> is
178 appropriate.</para></listitem>
179 </varlistentry>
180
181 <varlistentry>
182 <term><varname>VERSION_ID=</varname></term>
183
184 <listitem><para>A lower-case string (mostly numeric, no spaces
185 or other characters outside of 0-9, a-z, ".", "_" and "-")
186 identifying the operating system version, excluding any OS
187 name information or release code name, and suitable for
188 processing by scripts or usage in generated filenames. This
189 field is optional. Example: <literal>VERSION_ID=17</literal>
190 or <literal>VERSION_ID=11.04</literal>.</para></listitem>
191 </varlistentry>
192
193 <varlistentry>
194 <term><varname>PRETTY_NAME=</varname></term>
195
196 <listitem><para>A pretty operating system name in a format
197 suitable for presentation to the user. May or may not contain
198 a release code name or OS version of some kind, as suitable.
199 If not set, defaults to
200 <literal>PRETTY_NAME="Linux"</literal>. Example:
201 <literal>PRETTY_NAME="Fedora 17 (Beefy
202 Miracle)"</literal>.</para></listitem>
203 </varlistentry>
204
205 <varlistentry>
206 <term><varname>ANSI_COLOR=</varname></term>
207
208 <listitem><para>A suggested presentation color when showing
209 the OS name on the console. This should be specified as string
210 suitable for inclusion in the ESC [ m ANSI/ECMA-48 escape code
211 for setting graphical rendition. This field is optional.
212 Example: <literal>ANSI_COLOR="0;31"</literal> for red, or
213 <literal>ANSI_COLOR="1;34"</literal> for light
214 blue.</para></listitem>
215 </varlistentry>
216
217 <varlistentry>
218 <term><varname>CPE_NAME=</varname></term>
219
220 <listitem><para>A CPE name for the operating system, following
221 the <ulink url="https://cpe.mitre.org/specification/">Common
222 Platform Enumeration Specification</ulink> as proposed by the
223 MITRE Corporation. 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 0-9, 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>