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