]>
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>· | |
e3bff60a | 22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 220</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="idm140304311432128"></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 |
e735f4d4 MP |
23 | <code class="filename">/usr/lib/os-release</code> files contain operating |
24 | system identification data.</p><p>The basic file format of <code class="filename">os-release</code> is | |
25 | a newline-separated list of environment-like shell-compatible | |
26 | variable assignments. It is possible to source the configuration | |
27 | from shell scripts, however, beyond mere variable assignments, no | |
28 | shell features are supported (this means variable expansion is | |
29 | explicitly not supported), allowing applications to read the file | |
30 | without implementing a shell compatible execution engine. Variable | |
31 | assignment values must be enclosed in double or single quotes if | |
32 | they include spaces, semicolons or other special characters | |
33 | outside of A-Z, a-z, 0-9. Shell special characters ("$", quotes, | |
34 | backslash, backtick) must be escaped with backslashes, following | |
35 | shell style. All strings should be in UTF-8 format, and | |
36 | non-printable characters should not be used. It is not supported | |
37 | to concatenate multiple individually quoted strings. Lines | |
38 | beginning with "#" shall be ignored as comments.</p><p>The file <code class="filename">/etc/os-release</code> takes | |
39 | precedence over <code class="filename">/usr/lib/os-release</code>. | |
40 | Applications should check for the former, and exclusively use its | |
41 | data if it exists, and only fall back to | |
42 | <code class="filename">/usr/lib/os-release</code> if it is missing. | |
43 | Applications should not read data from both files at the same | |
44 | time. <code class="filename">/usr/lib/os-release</code> is the recommended | |
45 | place to store OS release information as part of vendor trees. | |
46 | <code class="filename">/etc/os-release</code> should be a relative symlink | |
47 | to <code class="filename">/usr/lib/os-release</code>, to provide | |
48 | compatibility with applications only looking at | |
49 | <code class="filename">/etc</code>. A relative symlink instead of an | |
50 | absolute symlink is necessary to avoid breaking the link in a | |
51 | chroot or initrd environment such as dracut.</p><p><code class="filename">os-release</code> contains data that is | |
52 | defined by the operating system vendor and should generally not be | |
53 | changed by the administrator.</p><p>As this file only encodes names and identifiers it should | |
54 | not be localized.</p><p>The <code class="filename">/etc/os-release</code> and | |
55 | <code class="filename">/usr/lib/os-release</code> files might be symlinks | |
56 | to other files, but it is important that the file is available | |
57 | from earliest boot on, and hence must be located on the root file | |
58 | system.</p><p>For a longer rationale for <code class="filename">os-release</code> | |
e3bff60a | 59 | please refer to 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="idm140304310395952"></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 |
e735f4d4 MP |
60 | <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 the operating system, |
61 | without a version component, and suitable for presentation to | |
62 | the user. If not set, defaults to | |
63 | "<code class="literal">NAME=Linux</code>". Example: | |
64 | "<code class="literal">NAME=Fedora</code>" or "<code class="literal">NAME="Debian | |
65 | 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 the operating system | |
66 | version, excluding any OS name information, possibly including | |
67 | a release code name, and suitable for presentation to the | |
68 | user. This field is optional. Example: | |
69 | "<code class="literal">VERSION=17</code>" or "<code class="literal">VERSION="17 (Beefy | |
70 | 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 (no spaces or other | |
71 | characters outside of 0-9, a-z, ".", "_" and "-") identifying | |
72 | the operating system, excluding any version information and | |
73 | suitable for processing by scripts or usage in generated | |
74 | filenames. If not set, defaults to | |
75 | "<code class="literal">ID=linux</code>". Example: | |
76 | "<code class="literal">ID=fedora</code>" or | |
77 | "<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 of operating system | |
78 | identifiers in the same syntax as the <code class="varname">ID=</code> | |
79 | setting. It should list identifiers of operating systems that | |
80 | are closely related to the local operating system in regards | |
81 | to packaging and programming interfaces, for example listing | |
82 | one or more OS identifiers the local OS is a derivative from. | |
83 | An OS should generally only list other OS identifiers it | |
84 | itself is a derivative of, and not any OSes that are derived | |
85 | from it, though symmetric relationships are possible. Build | |
86 | scripts and similar should check this variable if they need to | |
87 | identify the local operating system and the value of | |
88 | <code class="varname">ID=</code> is not recognized. Operating systems | |
89 | should be listed in order of how closely the local operating | |
90 | system relates to the listed ones, starting with the closest. | |
91 | This field is optional. Example: for an operating system with | |
92 | "<code class="literal">ID=centos</code>", an assignment of | |
93 | "<code class="literal">ID_LIKE="rhel fedora"</code>" would be appropriate. | |
94 | For an operating system with "<code class="literal">ID=ubuntu</code>", an | |
95 | assignment of "<code class="literal">ID_LIKE=debian</code>" is | |
96 | 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 (mostly numeric, no spaces | |
97 | or other characters outside of 0-9, a-z, ".", "_" and "-") | |
98 | identifying the operating system version, excluding any OS | |
99 | name information or release code name, and suitable for | |
100 | processing by scripts or usage in generated filenames. This | |
101 | field is optional. Example: "<code class="literal">VERSION_ID=17</code>" | |
102 | or "<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 system name in a format | |
103 | suitable for presentation to the user. May or may not contain | |
104 | a release code name or OS version of some kind, as suitable. | |
105 | If not set, defaults to | |
106 | "<code class="literal">PRETTY_NAME="Linux"</code>". Example: | |
107 | "<code class="literal">PRETTY_NAME="Fedora 17 (Beefy | |
108 | 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 presentation color when showing | |
109 | the OS name on the console. This should be specified as string | |
110 | suitable for inclusion in the ESC [ m ANSI/ECMA-48 escape code | |
111 | for setting graphical rendition. This field is optional. | |
112 | Example: "<code class="literal">ANSI_COLOR="0;31"</code>" for red, or | |
113 | "<code class="literal">ANSI_COLOR="1;34"</code>" for light | |
114 | 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 operating system, following | |
115 | the <a class="ulink" href="https://cpe.mitre.org/specification/" target="_top">Common | |
116 | Platform Enumeration Specification</a> as proposed by the | |
117 | MITRE Corporation. This field is optional. Example: | |
118 | "<code class="literal">CPE_NAME="cpe:/o:fedoraproject:fedora:17"</code>" | |
119 | </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><span class="term"><code class="varname">PRIVACY_POLICY_URL=</code></span><a class="headerlink" title="Permalink to this term" href="#HOME_URL=">¶</a></dt><dd><p>Links to resources on the Internet related the | |
120 | operating system. <code class="varname">HOME_URL=</code> should refer to | |
121 | the homepage of the operating system, or alternatively some | |
122 | homepage of the specific version of the operating system. | |
123 | <code class="varname">SUPPORT_URL=</code> should refer to the main | |
124 | support page for the operating system, if there is any. This | |
125 | is primarily intended for operating systems which vendors | |
126 | provide support for. <code class="varname">BUG_REPORT_URL=</code> should | |
127 | refer to the main bug reporting page for the operating system, | |
128 | if there is any. This is primarily intended for operating | |
129 | systems that rely on community QA. | |
130 | <code class="varname">PRIVACY_POLICY_URL=</code> should refer to the | |
131 | main privacy policy page for the operation system, if there is | |
132 | any. These settings are optional, and providing only some of | |
133 | these settings is common. These URLs are intended to be | |
134 | exposed in "About this system" UIs behind links with captions | |
135 | such as "About this Operating System", "Obtain Support", | |
136 | "Report a Bug", or "Privacy Policy". The values should be in | |
137 | <a class="ulink" href="https://tools.ietf.org/html/rfc3986" target="_top">RFC3986 | |
138 | format</a>, and should be "<code class="literal">http:</code>" or | |
139 | "<code class="literal">https:</code>" URLs, and possibly | |
140 | "<code class="literal">mailto:</code>" or "<code class="literal">tel:</code>". Only | |
141 | one URL shall be listed in each setting. If multiple resources | |
142 | need to be referenced, it is recommended to provide an online | |
143 | landing page linking all available resources. Examples: | |
144 | "<code class="literal">HOME_URL="https://fedoraproject.org/"</code>" and | |
145 | "<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 identifying the system image | |
146 | used as the origin for a distribution (it is not updated with | |
147 | system updates). The field can be identical between different | |
148 | VERSION_IDs as BUILD_ID is an only a unique identifier to a | |
149 | specific version. Distributions that release each update as a | |
150 | new version would only need to use VERSION_ID as each build is | |
151 | already distinct based on the VERSION_ID. This field is | |
152 | optional. Example: "<code class="literal">BUILD_ID="2013-03-20.3"</code>" | |
153 | or "<code class="literal">BUILD_ID=201303203</code>". | |
663996b3 | 154 | |
e3bff60a MP |
155 | </p></dd><dt id="VARIANT="><span class="term"><code class="varname">VARIANT=</code></span><a class="headerlink" title="Permalink to this term" href="#VARIANT=">¶</a></dt><dd><p> |
156 | A string identifying a specific variant or edition of the | |
157 | operating system suitable for presentation to the user. This | |
158 | field may be used to inform the user that the configuration of | |
159 | this system is subject to a specific divergent set of rules or | |
160 | default configuration settings. This field is optional and may | |
161 | not be implemented on all systems. | |
162 | Examples: | |
163 | "<code class="literal">VARIANT="Server Edition"</code>", | |
164 | "<code class="literal">VARIANT="Smart Refrigerator Edition"</code>" | |
165 | Note: this field is for display purposes only. The | |
166 | <code class="varname">VARIANT_ID</code> field should be used for making | |
167 | programmatic decisions. | |
168 | </p></dd><dt id="VARIANT_ID="><span class="term"><code class="varname">VARIANT_ID=</code></span><a class="headerlink" title="Permalink to this term" href="#VARIANT_ID=">¶</a></dt><dd><p> | |
169 | A lower-case string (no spaces or other characters outside of | |
170 | 0-9, a-z, ".", "_" and "-"), identifying a specific variant or | |
171 | edition of the operating system. This may be interpreted by | |
172 | other packages in order to determine a divergent default | |
173 | configuration. This field is optional and may not be | |
174 | implemented on all systems. | |
175 | Examples: | |
176 | "<code class="literal">VARIANT_ID=server</code>", | |
177 | "<code class="literal">VARIANT_ID=embedded</code>" | |
e735f4d4 MP |
178 | </p></dd></dl></div><p>If you are reading this file from C code or a shell script |
179 | to determine the OS or a specific version of it, use the | |
180 | <code class="varname">ID</code> and <code class="varname">VERSION_ID</code> fields, | |
181 | possibly with <code class="varname">ID_LIKE</code> as fallback for | |
182 | <code class="varname">ID</code>. When looking for an OS identification | |
183 | string for presentation to the user use the | |
184 | <code class="varname">PRETTY_NAME</code> field.</p><p>Note that operating system vendors may choose not to provide | |
185 | version information, for example to accommodate for rolling | |
186 | releases. In this case, <code class="varname">VERSION</code> and | |
187 | <code class="varname">VERSION_ID</code> may be unset. Applications should | |
188 | not rely on these fields to be set.</p><p>Operating system vendors may extend the file | |
189 | format and introduce new fields. It is highly | |
190 | recommended to prefix new fields with an OS specific | |
191 | name in order to avoid name clashes. Applications | |
192 | reading this file must ignore unknown fields. Example: | |
e3bff60a | 193 | "<code class="literal">DEBIAN_BTS="debbugs://bugs.debian.org/"</code>"</p></div><div class="refsect1"><a name="idm140304310341264"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example">¶</a></h2><pre class="programlisting">NAME=Fedora |
663996b3 MS |
194 | VERSION="17 (Beefy Miracle)" |
195 | ID=fedora | |
196 | VERSION_ID=17 | |
197 | PRETTY_NAME="Fedora 17 (Beefy Miracle)" | |
198 | ANSI_COLOR="0;34" | |
199 | CPE_NAME="cpe:/o:fedoraproject:fedora:17" | |
200 | HOME_URL="https://fedoraproject.org/" | |
e3bff60a | 201 | BUG_REPORT_URL="https://bugzilla.redhat.com/"</pre></div><div class="refsect1"><a name="idm140304310339600"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> |
e735f4d4 | 202 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, |
e3bff60a | 203 | <a href="http://linux.die.net/man/1/lsb_release"><span class="citerefentry"><span class="refentrytitle">lsb_release</span>(1)</span></a>, |
e735f4d4 MP |
204 | <a href="hostname.html"><span class="citerefentry"><span class="refentrytitle">hostname</span>(5)</span></a>, |
205 | <a href="machine-id.html"><span class="citerefentry"><span class="refentrytitle">machine-id</span>(5)</span></a>, | |
206 | <a href="machine-info.html"><span class="citerefentry"><span class="refentrytitle">machine-info</span>(5)</span></a> | |
207 | </p></div></div></body></html> |