]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>os-release</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style> |
2 | a.headerlink { | |
3 | color: #c60f0f; | |
4 | font-size: 0.8em; | |
5 | padding: 0 4px 0 4px; | |
6 | text-decoration: none; | |
7 | visibility: hidden; | |
8 | } | |
9 | ||
10 | a.headerlink:hover { | |
11 | background-color: #c60f0f; | |
12 | color: white; | |
13 | } | |
14 | ||
15 | h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink { | |
16 | visibility: visible; | |
17 | } | |
18 | </style><a href="index.html">Index </a>· | |
19 | <a href="systemd.directives.html">Directives </a>· | |
20 | <a href="../python-systemd/index.html">Python </a>· | |
21 | <a href="../libudev/index.html">libudev </a>· | |
f47781d8 | 22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 218</span><hr><div class="refentry"><a name="os-release"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>os-release — Operating system identification</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><p><code class="filename">/etc/os-release</code></p><p><code class="filename">/usr/lib/os-release</code></p></div><div class="refsect1"><a name="idm140582577825216"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p>The <code class="filename">/etc/os-release</code> and |
e842803a MB |
23 | <code class="filename">/usr/lib/os-release</code> files contain |
24 | operating system identification data.</p><p>The basic file format of | |
663996b3 MS |
25 | <code class="filename">os-release</code> is a newline-separated |
26 | list of environment-like shell-compatible variable | |
27 | assignments. It is possible to source the | |
28 | configuration from shell scripts, however, beyond mere | |
14228c0d | 29 | variable assignments, no shell features are supported |
663996b3 MS |
30 | (this means variable expansion is explicitly not |
31 | supported), allowing applications to read the file | |
32 | without implementing a shell compatible execution | |
33 | engine. Variable assignment values should be enclosed | |
34 | in double or single quotes if they include spaces, | |
35 | semicolons or other special characters outside of A-Z, | |
36 | a-z, 0-9. All strings should be in UTF-8 format, and | |
37 | non-printable characters should not be used. If double | |
38 | or single quotes or backslashes are to be used within | |
14228c0d | 39 | variable assignments, they should be escaped with |
663996b3 MS |
40 | backslashes, following shell style. It is not |
41 | supported to concatenate multiple individually quoted | |
42 | strings. Lines beginning with "#" shall be ignored as | |
e842803a MB |
43 | comments.</p><p>The file <code class="filename">/etc/os-release</code> |
44 | takes precedence over | |
45 | <code class="filename">/usr/lib/os-release</code>. Applications | |
46 | should check for the former, and exclusively use its | |
47 | data if it exists, and only fall back to | |
48 | <code class="filename">/usr/lib/os-release</code> if it is | |
49 | missing. Applications should not read data from both | |
50 | files at the same | |
51 | time. <code class="filename">/usr/lib/os-release</code> is the | |
52 | recommended place to store OS release information as | |
5eef597e MP |
53 | part of vendor trees. |
54 | <code class="filename">/etc/os-release</code> should be a | |
55 | relative symlink to | |
56 | <code class="filename">/usr/lib/os-release</code>, | |
e842803a | 57 | to provide compatibility with applications only |
5eef597e MP |
58 | looking at <code class="filename">/etc</code>. A relative |
59 | symlink instead of an absolute symlink is | |
60 | necessary to avoid breaking the link in a chroot or | |
61 | initrd environment such as dracut.</p><p><code class="filename">os-release</code> contains data | |
e842803a MB |
62 | that is defined by the operating system vendor and |
63 | should generally not be changed by the | |
64 | administrator.</p><p>As this file only encodes names and identifiers | |
65 | it should not be localized.</p><p>The <code class="filename">/etc/os-release</code> and | |
66 | <code class="filename">/usr/lib/os-release</code> files might | |
67 | be symlinks to other files, but it is important that | |
663996b3 MS |
68 | the file is available from earliest boot on, and hence |
69 | must be located on the root file system.</p><p>For a longer rationale for | |
e842803a | 70 | <code class="filename">os-release</code> please refer to |
f47781d8 | 71 | the <a class="ulink" href="http://0pointer.de/blog/projects/os-release" target="_top">Announcement of <code class="filename">/etc/os-release</code></a>.</p></div><div class="refsect1"><a name="idm140582578843136"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options">¶</a></h2><p>The following OS identifications parameters may be set using |
e842803a | 72 | <code class="filename">os-release</code>:</p><div class="variablelist"><dl class="variablelist"><dt id="NAME="><span class="term"><code class="varname">NAME=</code></span><a class="headerlink" title="Permalink to this term" href="#NAME=">¶</a></dt><dd><p>A string identifying |
663996b3 MS |
73 | the operating system, without a |
74 | version component, and suitable for | |
14228c0d | 75 | presentation to the user. If not set, |
663996b3 | 76 | defaults to |
14228c0d MB |
77 | "<code class="literal">NAME=Linux</code>". Example: |
78 | "<code class="literal">NAME=Fedora</code>" or | |
79 | "<code class="literal">NAME="Debian | |
80 | GNU/Linux"</code>".</p></dd><dt id="VERSION="><span class="term"><code class="varname">VERSION=</code></span><a class="headerlink" title="Permalink to this term" href="#VERSION=">¶</a></dt><dd><p>A string identifying | |
663996b3 MS |
81 | the operating system version, |
82 | excluding any OS name information, | |
83 | possibly including a release code | |
84 | name, and suitable for presentation to | |
85 | the user. This field is | |
86 | optional. Example: | |
14228c0d MB |
87 | "<code class="literal">VERSION=17</code>" or |
88 | "<code class="literal">VERSION="17 (Beefy | |
89 | Miracle)"</code>".</p></dd><dt id="ID="><span class="term"><code class="varname">ID=</code></span><a class="headerlink" title="Permalink to this term" href="#ID=">¶</a></dt><dd><p>A lower-case string | |
663996b3 MS |
90 | (no spaces or other characters outside |
91 | of 0-9, a-z, ".", "_" and "-") | |
92 | identifying the operating system, | |
93 | excluding any version information and | |
94 | suitable for processing by scripts or | |
14228c0d MB |
95 | usage in generated filenames. If not |
96 | set, defaults to | |
97 | "<code class="literal">ID=linux</code>". Example: | |
98 | "<code class="literal">ID=fedora</code>" or | |
99 | "<code class="literal">ID=debian</code>".</p></dd><dt id="ID_LIKE="><span class="term"><code class="varname">ID_LIKE=</code></span><a class="headerlink" title="Permalink to this term" href="#ID_LIKE=">¶</a></dt><dd><p>A space-separated list | |
663996b3 MS |
100 | of operating system identifiers in the |
101 | same syntax as the | |
14228c0d | 102 | <code class="varname">ID=</code> setting. It should |
663996b3 MS |
103 | list identifiers of operating systems |
104 | that are closely related to the local | |
105 | operating system in regards to | |
106 | packaging and programming interfaces, | |
107 | for example listing one or more | |
108 | OS identifiers the local | |
109 | OS is a derivative from. An | |
110 | OS should generally only list other OS | |
111 | identifiers it itself is a derivative | |
14228c0d MB |
112 | of, and not any OSes that |
113 | are derived from it, though symmetric | |
663996b3 MS |
114 | relationships are possible. Build |
115 | scripts and similar should check this | |
116 | variable if they need to identify the | |
117 | local operating system and the value | |
118 | of <code class="varname">ID=</code> is not | |
119 | recognized. Operating systems should | |
120 | be listed in order of how closely the | |
121 | local operating system relates to the | |
122 | listed ones, starting with the | |
123 | closest. This field is | |
124 | optional. Example: for an operating | |
125 | system with | |
14228c0d MB |
126 | "<code class="literal">ID=centos</code>", an |
127 | assignment of "<code class="literal">ID_LIKE="rhel | |
128 | fedora"</code>" would be | |
663996b3 | 129 | appropriate. For an operating system |
14228c0d | 130 | with "<code class="literal">ID=ubuntu</code>", an |
663996b3 | 131 | assignment of |
14228c0d | 132 | "<code class="literal">ID_LIKE=debian</code>" is |
663996b3 MS |
133 | appropriate.</p></dd><dt id="VERSION_ID="><span class="term"><code class="varname">VERSION_ID=</code></span><a class="headerlink" title="Permalink to this term" href="#VERSION_ID=">¶</a></dt><dd><p>A lower-case string |
134 | (mostly numeric, no spaces or other | |
135 | characters outside of 0-9, a-z, ".", | |
136 | "_" and "-") identifying the operating | |
137 | system version, excluding any OS name | |
138 | information or release code name, and | |
139 | suitable for processing by scripts or | |
14228c0d | 140 | usage in generated filenames. This |
663996b3 | 141 | field is optional. Example: |
14228c0d MB |
142 | "<code class="literal">VERSION_ID=17</code>" or |
143 | "<code class="literal">VERSION_ID=11.04</code>".</p></dd><dt id="PRETTY_NAME="><span class="term"><code class="varname">PRETTY_NAME=</code></span><a class="headerlink" title="Permalink to this term" href="#PRETTY_NAME=">¶</a></dt><dd><p>A pretty operating | |
663996b3 MS |
144 | system name in a format suitable for |
145 | presentation to the user. May or may | |
146 | not contain a release code name or OS | |
147 | version of some kind, as suitable. If | |
14228c0d MB |
148 | not set, defaults to |
149 | "<code class="literal">PRETTY_NAME="Linux"</code>". Example: | |
150 | "<code class="literal">PRETTY_NAME="Fedora 17 (Beefy | |
151 | Miracle)"</code>".</p></dd><dt id="ANSI_COLOR="><span class="term"><code class="varname">ANSI_COLOR=</code></span><a class="headerlink" title="Permalink to this term" href="#ANSI_COLOR=">¶</a></dt><dd><p>A suggested | |
663996b3 MS |
152 | presentation color when showing the |
153 | OS name on the console. This | |
154 | should be specified as string suitable | |
155 | for inclusion in the ESC [ m | |
156 | ANSI/ECMA-48 escape code for setting | |
157 | graphical rendition. This field is | |
158 | optional. Example: | |
14228c0d | 159 | "<code class="literal">ANSI_COLOR="0;31"</code>" |
663996b3 | 160 | for red, or |
14228c0d | 161 | "<code class="literal">ANSI_COLOR="1;34"</code>" |
663996b3 | 162 | for light blue.</p></dd><dt id="CPE_NAME="><span class="term"><code class="varname">CPE_NAME=</code></span><a class="headerlink" title="Permalink to this term" href="#CPE_NAME=">¶</a></dt><dd><p>A CPE name for the |
14228c0d | 163 | operating system, following the <a class="ulink" href="https://cpe.mitre.org/specification/" target="_top">Common |
663996b3 MS |
164 | Platform Enumeration |
165 | Specification</a> as proposed by | |
166 | the MITRE Corporation. This field | |
167 | is optional. Example: | |
14228c0d | 168 | "<code class="literal">CPE_NAME="cpe:/o:fedoraproject:fedora:17"</code>" |
663996b3 MS |
169 | </p></dd><dt id="HOME_URL="><span class="term"><code class="varname">HOME_URL=</code>, </span><span class="term"><code class="varname">SUPPORT_URL=</code>, </span><span class="term"><code class="varname">BUG_REPORT_URL=</code></span><a class="headerlink" title="Permalink to this term" href="#HOME_URL=">¶</a></dt><dd><p>Links to resources on |
170 | the Internet related the operating | |
171 | system. <code class="varname">HOME_URL=</code> | |
172 | should refer to the homepage of the | |
173 | operating system, or alternatively | |
174 | some homepage of the specific version | |
175 | of the operating | |
176 | system. <code class="varname">SUPPORT_URL=</code> | |
177 | should refer to the main support page | |
178 | for the operating system, if there is | |
179 | any. This is primarily intended for | |
180 | operating systems which vendors | |
181 | provide support | |
182 | for. <code class="varname">BUG_REPORT_URL=</code> | |
183 | should refer to the main bug reporting | |
184 | page for the operating system, if | |
185 | there is any. This is primarily | |
186 | intended for operating systems that | |
187 | rely on community QA. These settings | |
188 | are optional, and providing only some | |
189 | of these settings is common. These | |
190 | URLs are intended to be exposed in | |
191 | "About this system" UIs behind links | |
192 | with captions such as "About this | |
193 | Operating System", "Obtain Support", | |
194 | and "Report a Bug". The values should | |
195 | be in <a class="ulink" href="https://tools.ietf.org/html/rfc3986" target="_top">RFC3986 | |
196 | format</a>, and should be | |
14228c0d MB |
197 | "<code class="literal">http:</code>" or |
198 | "<code class="literal">https:</code>" URLs, and | |
199 | possibly "<code class="literal">mailto:</code>" or | |
200 | "<code class="literal">tel:</code>". Only one URL | |
663996b3 MS |
201 | shall be listed in each setting. If |
202 | multiple resources need to be | |
14228c0d | 203 | referenced, it is recommended to |
663996b3 MS |
204 | provide an online landing page linking |
205 | all available resources. Examples: | |
14228c0d | 206 | "<code class="literal">HOME_URL="https://fedoraproject.org/"</code>" |
663996b3 | 207 | and |
14228c0d | 208 | "<code class="literal">BUG_REPORT_URL="https://bugzilla.redhat.com/"</code>"</p></dd><dt id="BUILD_ID="><span class="term"><code class="varname">BUILD_ID=</code></span><a class="headerlink" title="Permalink to this term" href="#BUILD_ID=">¶</a></dt><dd><p>A string uniquely |
663996b3 MS |
209 | identifying the system image used as |
210 | the origin for a distribution (it is | |
211 | not updated with system updates). The | |
212 | field can be identical between | |
213 | different VERSION_IDs as BUILD_ID is | |
214 | an only a unique identifier to a | |
215 | specific version. Distributions that | |
216 | release each update as a new version | |
217 | would only need to use VERSION_ID as | |
218 | each build is already distinct based | |
219 | on the VERSION_ID. This field is | |
220 | optional. Example: | |
14228c0d | 221 | "<code class="literal">BUILD_ID="2013-03-20.3"</code>" |
663996b3 | 222 | or |
14228c0d | 223 | "<code class="literal">BUILD_ID=201303203</code>". |
663996b3 MS |
224 | |
225 | </p></dd></dl></div><p>If you are reading this file from C code or a | |
226 | shell script to determine the OS or a specific version | |
227 | of it, use the ID and VERSION_ID fields, possibly with | |
228 | ID_LIKE as fallback for ID. When looking for an OS | |
229 | identification string for presentation to the user use | |
230 | the PRETTY_NAME field.</p><p>Note that operating system vendors may choose | |
231 | not to provide version information, for example to | |
14228c0d | 232 | accommodate for rolling releases. In this case, VERSION |
663996b3 MS |
233 | and VERSION_ID may be unset. Applications should not |
234 | rely on these fields to be set.</p><p>Operating system vendors may extend the file | |
235 | format and introduce new fields. It is highly | |
236 | recommended to prefix new fields with an OS specific | |
237 | name in order to avoid name clashes. Applications | |
238 | reading this file must ignore unknown fields. Example: | |
f47781d8 | 239 | "<code class="literal">DEBIAN_BTS="debbugs://bugs.debian.org/"</code>"</p></div><div class="refsect1"><a name="idm140582579430176"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example">¶</a></h2><pre class="programlisting">NAME=Fedora |
663996b3 MS |
240 | VERSION="17 (Beefy Miracle)" |
241 | ID=fedora | |
242 | VERSION_ID=17 | |
243 | PRETTY_NAME="Fedora 17 (Beefy Miracle)" | |
244 | ANSI_COLOR="0;34" | |
245 | CPE_NAME="cpe:/o:fedoraproject:fedora:17" | |
246 | HOME_URL="https://fedoraproject.org/" | |
f47781d8 | 247 | BUG_REPORT_URL="https://bugzilla.redhat.com/"</pre></div><div class="refsect1"><a name="idm140582578394176"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> |
663996b3 MS |
248 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, |
249 | <a href="lsb_release.html"><span class="citerefentry"><span class="refentrytitle">lsb_release</span>(1)</span></a>, | |
250 | <a href="hostname.html"><span class="citerefentry"><span class="refentrytitle">hostname</span>(5)</span></a>, | |
251 | <a href="machine-id.html"><span class="citerefentry"><span class="refentrytitle">machine-id</span>(5)</span></a>, | |
252 | <a href="machine-info.html"><span class="citerefentry"><span class="refentrytitle">machine-info</span>(5)</span></a> | |
253 | </p></div></div></body></html> |