Zbigniew Jędrzejewski-Szmek 696e2f
From c9b3950580db43c576d3ec8f7bf14e49905a09cb Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 696e2f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Zbigniew Jędrzejewski-Szmek 696e2f
Date: Sat, 13 Aug 2016 09:38:12 -0400
Zbigniew Jędrzejewski-Szmek 696e2f
Subject: [PATCH] man: describe what symlinks to unit do, and specify that
Zbigniew Jędrzejewski-Szmek 696e2f
 presets must use real names
Zbigniew Jędrzejewski-Szmek 696e2f
Zbigniew Jędrzejewski-Szmek 696e2f
The man pages didn't ever mention that symlinks to units can be created, and what
Zbigniew Jędrzejewski-Szmek 696e2f
exactly this means. Fix that omission, and disallow presets on alias names.
Zbigniew Jędrzejewski-Szmek 696e2f
Zbigniew Jędrzejewski-Szmek 696e2f
(cherry picked from commit d923e42eed9a29137821760dafecb13798264c07)
Zbigniew Jędrzejewski-Szmek 696e2f
---
Zbigniew Jędrzejewski-Szmek 696e2f
 man/systemctl.xml      |  3 ++-
Zbigniew Jędrzejewski-Szmek 696e2f
 man/systemd.preset.xml |  4 ++++
Zbigniew Jędrzejewski-Szmek 696e2f
 man/systemd.unit.xml   | 36 +++++++++++++++++++++++-------------
Zbigniew Jędrzejewski-Szmek 696e2f
 3 files changed, 29 insertions(+), 14 deletions(-)
Zbigniew Jędrzejewski-Szmek 696e2f
Zbigniew Jędrzejewski-Szmek 696e2f
diff --git a/man/systemctl.xml b/man/systemctl.xml
Zbigniew Jędrzejewski-Szmek 696e2f
index e7880d24f7..8b73e91bdb 100644
Zbigniew Jędrzejewski-Szmek 696e2f
--- a/man/systemctl.xml
Zbigniew Jędrzejewski-Szmek 696e2f
+++ b/man/systemctl.xml
Zbigniew Jędrzejewski-Szmek 696e2f
@@ -1088,7 +1088,8 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
Zbigniew Jędrzejewski-Szmek 696e2f
             enabled and disabled, or only enabled, or only disabled.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
 
Zbigniew Jędrzejewski-Szmek 696e2f
             <para>If the unit carries no install information, it will be silently ignored
Zbigniew Jędrzejewski-Szmek 696e2f
-            by this command.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
+            by this command. <replaceable>NAME</replaceable> must be the real unit name,
Zbigniew Jędrzejewski-Szmek 696e2f
+            any alias names are ignored silently.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
 
Zbigniew Jędrzejewski-Szmek 696e2f
             <para>For more information on the preset policy format, see
Zbigniew Jędrzejewski-Szmek 696e2f
             <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
Zbigniew Jędrzejewski-Szmek 696e2f
diff --git a/man/systemd.preset.xml b/man/systemd.preset.xml
Zbigniew Jędrzejewski-Szmek 696e2f
index b7164014f0..d09167baaf 100644
Zbigniew Jędrzejewski-Szmek 696e2f
--- a/man/systemd.preset.xml
Zbigniew Jędrzejewski-Szmek 696e2f
+++ b/man/systemd.preset.xml
Zbigniew Jędrzejewski-Szmek 696e2f
@@ -98,6 +98,10 @@
Zbigniew Jędrzejewski-Szmek 696e2f
     Empty lines and lines whose first non-whitespace character is # or
Zbigniew Jędrzejewski-Szmek 696e2f
     ; are ignored.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
 
Zbigniew Jędrzejewski-Szmek 696e2f
+    <para>Presets must refer to the "real" unit file, and not to any aliases. See
Zbigniew Jędrzejewski-Szmek 696e2f
+    <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
Zbigniew Jędrzejewski-Szmek 696e2f
+    for a description of unit aliasing.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
+
Zbigniew Jędrzejewski-Szmek 696e2f
     <para>Two different directives are understood:
Zbigniew Jędrzejewski-Szmek 696e2f
     <literal>enable</literal> may be used to enable units by default,
Zbigniew Jędrzejewski-Szmek 696e2f
     <literal>disable</literal> to disable units by default.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
Zbigniew Jędrzejewski-Szmek 696e2f
index 85a7b12d76..f818e772a9 100644
Zbigniew Jędrzejewski-Szmek 696e2f
--- a/man/systemd.unit.xml
Zbigniew Jędrzejewski-Szmek 696e2f
+++ b/man/systemd.unit.xml
Zbigniew Jędrzejewski-Szmek 696e2f
@@ -144,21 +144,31 @@
Zbigniew Jędrzejewski-Szmek 696e2f
     <option>false</option> and <option>off</option> are
Zbigniew Jędrzejewski-Szmek 696e2f
     equivalent.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
 
Zbigniew Jędrzejewski-Szmek 696e2f
-    <para>Time span values encoded in unit files can be written in
Zbigniew Jędrzejewski-Szmek 696e2f
-    various formats. A stand-alone number specifies a time in seconds.
Zbigniew Jędrzejewski-Szmek 696e2f
-    If suffixed with a time unit, the unit is honored. A concatenation
Zbigniew Jędrzejewski-Szmek 696e2f
-    of multiple values with units is supported, in which case the
Zbigniew Jędrzejewski-Szmek 696e2f
-    values are added up. Example: "50" refers to 50 seconds; "2min
Zbigniew Jędrzejewski-Szmek 696e2f
-    200ms" refers to 2 minutes plus 200 milliseconds, i.e. 120200ms.
Zbigniew Jędrzejewski-Szmek 696e2f
-    The following time units are understood: s, min, h, d, w, ms, us.
Zbigniew Jędrzejewski-Szmek 696e2f
-    For details see
Zbigniew Jędrzejewski-Szmek 696e2f
+    <para>Time span values encoded in unit files can be written in various formats. A stand-alone number specifies a
Zbigniew Jędrzejewski-Szmek 696e2f
+    time in seconds.  If suffixed with a time unit, the unit is honored. A concatenation of multiple values with units
Zbigniew Jędrzejewski-Szmek 696e2f
+    is supported, in which case the values are added up. Example: <literal>50</literal> refers to 50 seconds;
Zbigniew Jędrzejewski-Szmek 696e2f
+    <literal>2min 200ms</literal> refers to 2 minutes and 200 milliseconds, i.e. 120200 ms.  The following time units
Zbigniew Jędrzejewski-Szmek 696e2f
+    are understood: <literal>s</literal>, <literal>min</literal>, <literal>h</literal>, <literal>d</literal>,
Zbigniew Jędrzejewski-Szmek 696e2f
+    <literal>w</literal>, <literal>ms</literal>, <literal>us</literal>.  For details see
Zbigniew Jędrzejewski-Szmek 696e2f
     <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
 
Zbigniew Jędrzejewski-Szmek 696e2f
-    <para>Empty lines and lines starting with # or ; are
Zbigniew Jędrzejewski-Szmek 696e2f
-    ignored. This may be used for commenting. Lines ending
Zbigniew Jędrzejewski-Szmek 696e2f
-    in a backslash are concatenated with the following
Zbigniew Jędrzejewski-Szmek 696e2f
-    line while reading and the backslash is replaced by a
Zbigniew Jędrzejewski-Szmek 696e2f
-    space character. This may be used to wrap long lines.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
+    <para>Empty lines and lines starting with <literal>#</literal> or <literal>;</literal> are ignored. This may be
Zbigniew Jędrzejewski-Szmek 696e2f
+    used for commenting. Lines ending in a backslash are concatenated with the following line while reading and the
Zbigniew Jędrzejewski-Szmek 696e2f
+    backslash is replaced by a space character. This may be used to wrap long lines.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
+
Zbigniew Jędrzejewski-Szmek 696e2f
+    <para>Units can be aliased (have an alternative name), by creating a symlink from the new name to the existing name
Zbigniew Jędrzejewski-Szmek 696e2f
+    in one of the unit search paths. For example, <filename>systemd-networkd.service</filename> has the alias
Zbigniew Jędrzejewski-Szmek 696e2f
+    <filename>dbus-org.freedesktop.network1.service</filename>, created during installation as the symlink
Zbigniew Jędrzejewski-Szmek 696e2f
+    <filename>/usr/lib/systemd/system/dbus-org.freedesktop.network1.service</filename>. In addition, unit files may
Zbigniew Jędrzejewski-Szmek 696e2f
+    specify aliases through the <varname>Alias=</varname> directive in the [Install] section; those aliases are only
Zbigniew Jędrzejewski-Szmek 696e2f
+    effective when the unit is enabled. When the unit is enabled, symlinks will be created for those names, and removed
Zbigniew Jędrzejewski-Szmek 696e2f
+    when the unit is disabled. For example, <filename>reboot.target</filename> specifies
Zbigniew Jędrzejewski-Szmek 696e2f
+    <varname>Alias=ctrl-alt-del.target</varname>, so when enabled it will be invoked whenever CTRL+ALT+DEL is
Zbigniew Jędrzejewski-Szmek 696e2f
+    pressed. Alias names may be used in commands like <command>enable</command>, <command>disable</command>,
Zbigniew Jędrzejewski-Szmek 696e2f
+    <command>start</command>, <command>stop</command>, <command>status</command>, …, and in unit dependency directives
Zbigniew Jędrzejewski-Szmek 696e2f
+    <varname>Wants=</varname>, <varname>Requires=</varname>, <varname>Before=</varname>, <varname>After=</varname>, …,
Zbigniew Jędrzejewski-Szmek 696e2f
+    with the limitation that aliases specified through <varname>Alias=</varname> are only effective when the unit is
Zbigniew Jędrzejewski-Szmek 696e2f
+    enabled. Aliases cannot be used with the <command>preset</command> command.</para>
Zbigniew Jędrzejewski-Szmek 696e2f
 
Zbigniew Jędrzejewski-Szmek 696e2f
     <para>Along with a unit file <filename>foo.service</filename>, the
Zbigniew Jędrzejewski-Szmek 696e2f
     directory <filename>foo.service.wants/</filename> may exist. All
Zbigniew Jędrzejewski-Szmek 696e2f
-- 
Zbigniew Jędrzejewski-Szmek 696e2f
2.9.0
Zbigniew Jędrzejewski-Szmek 696e2f