]>
Commit | Line | Data |
---|---|---|
663996b3 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
663996b3 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
e735f4d4 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
663996b3 MS |
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"> | |
e735f4d4 MP |
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 | |
e3bff60a | 107 | url="http://0pointer.de/blog/projects/os-release">Announcement of <filename>/etc/os-release</filename></ulink>.</para> |
e735f4d4 MP |
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 | ||
d9dfd233 MP |
217 | <listitem><para>A CPE name for the operating system, in URI |
218 | binding syntax, following the | |
219 | <ulink url="http://scap.nist.gov/specifications/cpe/">Common | |
e735f4d4 | 220 | Platform Enumeration Specification</ulink> as proposed by the |
d9dfd233 | 221 | NIST. This field is optional. Example: |
e735f4d4 MP |
222 | <literal>CPE_NAME="cpe:/o:fedoraproject:fedora:17"</literal> |
223 | </para></listitem> | |
224 | </varlistentry> | |
225 | ||
226 | <varlistentry> | |
227 | <term><varname>HOME_URL=</varname></term> | |
228 | <term><varname>SUPPORT_URL=</varname></term> | |
229 | <term><varname>BUG_REPORT_URL=</varname></term> | |
230 | <term><varname>PRIVACY_POLICY_URL=</varname></term> | |
231 | ||
232 | <listitem><para>Links to resources on the Internet related the | |
233 | operating system. <varname>HOME_URL=</varname> should refer to | |
234 | the homepage of the operating system, or alternatively some | |
235 | homepage of the specific version of the operating system. | |
236 | <varname>SUPPORT_URL=</varname> should refer to the main | |
237 | support page for the operating system, if there is any. This | |
238 | is primarily intended for operating systems which vendors | |
239 | provide support for. <varname>BUG_REPORT_URL=</varname> should | |
240 | refer to the main bug reporting page for the operating system, | |
241 | if there is any. This is primarily intended for operating | |
242 | systems that rely on community QA. | |
243 | <varname>PRIVACY_POLICY_URL=</varname> should refer to the | |
244 | main privacy policy page for the operation system, if there is | |
245 | any. These settings are optional, and providing only some of | |
246 | these settings is common. These URLs are intended to be | |
247 | exposed in "About this system" UIs behind links with captions | |
248 | such as "About this Operating System", "Obtain Support", | |
249 | "Report a Bug", or "Privacy Policy". The values should be in | |
250 | <ulink url="https://tools.ietf.org/html/rfc3986">RFC3986 | |
251 | format</ulink>, and should be <literal>http:</literal> or | |
252 | <literal>https:</literal> URLs, and possibly | |
253 | <literal>mailto:</literal> or <literal>tel:</literal>. Only | |
254 | one URL shall be listed in each setting. If multiple resources | |
255 | need to be referenced, it is recommended to provide an online | |
256 | landing page linking all available resources. Examples: | |
257 | <literal>HOME_URL="https://fedoraproject.org/"</literal> and | |
258 | <literal>BUG_REPORT_URL="https://bugzilla.redhat.com/"</literal></para></listitem> | |
259 | </varlistentry> | |
260 | ||
261 | <varlistentry> | |
262 | <term><varname>BUILD_ID=</varname></term> | |
263 | ||
264 | <listitem><para>A string uniquely identifying the system image | |
265 | used as the origin for a distribution (it is not updated with | |
266 | system updates). The field can be identical between different | |
267 | VERSION_IDs as BUILD_ID is an only a unique identifier to a | |
268 | specific version. Distributions that release each update as a | |
269 | new version would only need to use VERSION_ID as each build is | |
270 | already distinct based on the VERSION_ID. This field is | |
271 | optional. Example: <literal>BUILD_ID="2013-03-20.3"</literal> | |
272 | or <literal>BUILD_ID=201303203</literal>. | |
273 | ||
274 | </para></listitem> | |
275 | </varlistentry> | |
276 | ||
e3bff60a MP |
277 | <varlistentry> |
278 | <term><varname>VARIANT=</varname></term> | |
279 | ||
280 | <listitem><para> | |
281 | A string identifying a specific variant or edition of the | |
282 | operating system suitable for presentation to the user. This | |
283 | field may be used to inform the user that the configuration of | |
284 | this system is subject to a specific divergent set of rules or | |
285 | default configuration settings. This field is optional and may | |
286 | not be implemented on all systems. | |
287 | Examples: | |
288 | <literal>VARIANT="Server Edition"</literal>, | |
289 | <literal>VARIANT="Smart Refrigerator Edition"</literal> | |
290 | Note: this field is for display purposes only. The | |
291 | <varname>VARIANT_ID</varname> field should be used for making | |
292 | programmatic decisions. | |
293 | </para></listitem> | |
294 | </varlistentry> | |
295 | ||
296 | <varlistentry> | |
297 | <term><varname>VARIANT_ID=</varname></term> | |
298 | ||
299 | <listitem><para> | |
300 | A lower-case string (no spaces or other characters outside of | |
301 | 0-9, a-z, ".", "_" and "-"), identifying a specific variant or | |
302 | edition of the operating system. This may be interpreted by | |
303 | other packages in order to determine a divergent default | |
304 | configuration. This field is optional and may not be | |
305 | implemented on all systems. | |
306 | Examples: | |
307 | <literal>VARIANT_ID=server</literal>, | |
308 | <literal>VARIANT_ID=embedded</literal> | |
309 | </para></listitem> | |
310 | </varlistentry> | |
311 | ||
e735f4d4 MP |
312 | </variablelist> |
313 | ||
314 | <para>If you are reading this file from C code or a shell script | |
315 | to determine the OS or a specific version of it, use the | |
316 | <varname>ID</varname> and <varname>VERSION_ID</varname> fields, | |
317 | possibly with <varname>ID_LIKE</varname> as fallback for | |
318 | <varname>ID</varname>. When looking for an OS identification | |
319 | string for presentation to the user use the | |
320 | <varname>PRETTY_NAME</varname> field.</para> | |
321 | ||
322 | <para>Note that operating system vendors may choose not to provide | |
323 | version information, for example to accommodate for rolling | |
324 | releases. In this case, <varname>VERSION</varname> and | |
325 | <varname>VERSION_ID</varname> may be unset. Applications should | |
326 | not rely on these fields to be set.</para> | |
327 | ||
328 | <para>Operating system vendors may extend the file | |
329 | format and introduce new fields. It is highly | |
330 | recommended to prefix new fields with an OS specific | |
331 | name in order to avoid name clashes. Applications | |
332 | reading this file must ignore unknown fields. Example: | |
333 | <literal>DEBIAN_BTS="debbugs://bugs.debian.org/"</literal></para> | |
334 | </refsect1> | |
335 | ||
336 | <refsect1> | |
337 | <title>Example</title> | |
338 | ||
339 | <programlisting>NAME=Fedora | |
663996b3 MS |
340 | VERSION="17 (Beefy Miracle)" |
341 | ID=fedora | |
342 | VERSION_ID=17 | |
343 | PRETTY_NAME="Fedora 17 (Beefy Miracle)" | |
344 | ANSI_COLOR="0;34" | |
345 | CPE_NAME="cpe:/o:fedoraproject:fedora:17" | |
346 | HOME_URL="https://fedoraproject.org/" | |
347 | BUG_REPORT_URL="https://bugzilla.redhat.com/"</programlisting> | |
e735f4d4 MP |
348 | </refsect1> |
349 | ||
350 | <refsect1> | |
351 | <title>See Also</title> | |
352 | <para> | |
353 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
e3bff60a | 354 | <citerefentry project='die-net'><refentrytitle>lsb_release</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
e735f4d4 MP |
355 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
356 | <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
357 | <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
358 | </para> | |
359 | </refsect1> | |
663996b3 MS |
360 | |
361 | </refentry> |