summaryrefslogtreecommitdiffstats
path: root/man/os-release.xml
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-20 19:47:55 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-21 16:32:54 +0200
commite839ebe5511028f6032ae53ebb43601c1f4624be (patch)
treef5885697af2295477c99427077af87435431af36 /man/os-release.xml
parentman: reorder fields in os-release (diff)
downloadsystemd-e839ebe5511028f6032ae53ebb43601c1f4624be.tar.xz
systemd-e839ebe5511028f6032ae53ebb43601c1f4624be.zip
man: add an example how to correctly read os-release in shell
This is not entirely obvious. The logic of how to interpret the fields applies in any language, so drop the pointless mention of C or shell.
Diffstat (limited to 'man/os-release.xml')
-rw-r--r--man/os-release.xml21
1 files changed, 16 insertions, 5 deletions
diff --git a/man/os-release.xml b/man/os-release.xml
index a5b2437632..36e5bed62e 100644
--- a/man/os-release.xml
+++ b/man/os-release.xml
@@ -3,7 +3,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
-<refentry id="os-release">
+<refentry id="os-release" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>os-release</title>
<productname>systemd</productname>
@@ -363,8 +363,8 @@
<refsect2>
<title>Notes</title>
- <para>If you are reading this file from C code or a shell script to determine the OS or a specific
- version of it, use the <varname>ID</varname> and <varname>VERSION_ID</varname> fields, possibly with
+ <para>If you are using this file to determine the OS or a specific version of it, use the
+ <varname>ID</varname> and <varname>VERSION_ID</varname> fields, possibly with
<varname>ID_LIKE</varname> as fallback for <varname>ID</varname>. When looking for an OS identification
string for presentation to the user use the <varname>PRETTY_NAME</varname> field.</para>
@@ -387,9 +387,12 @@
</refsect1>
<refsect1>
- <title>Example</title>
+ <title>Examples</title>
- <programlisting>NAME=Fedora
+ <example>
+ <title><filename>os-release</filename> file for Fedora Workstation</title>
+
+ <programlisting>NAME=Fedora
VERSION="32 (Workstation Edition)"
ID=fedora
VERSION_ID=32
@@ -408,6 +411,14 @@ REDHAT_SUPPORT_PRODUCT_VERSION=32
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation</programlisting>
+ </example>
+
+ <example>
+ <title>Reading <filename>os-release</filename> in
+ <citerefentry><refentrytitle>sh</refentrytitle><manvolnum>1</manvolnum></citerefentry></title>
+
+ <programlisting><xi:include href="check-os-release.sh" parse="text" /></programlisting>
+ </example>
</refsect1>
<refsect1>