Merge pull request #13635 from fbuihuu/no-aliases-with-enable

man: alias names can't be used with enable command
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-10-28 09:23:08 +01:00
committed by GitHub
3 changed files with 9 additions and 7 deletions
+4 -4
View File
@@ -137,10 +137,10 @@
a symlink, so when <command>systemd</command> is asked through D-Bus to load
<filename>dbus-org.freedesktop.network1.service</filename>, it'll load
<filename>systemd-networkd.service</filename>. Alias names may be used in commands like
<command>enable</command>, <command>disable</command>, <command>start</command>, <command>stop</command>,
<command>status</command>, and similar, and in all unit dependency directives, including
<varname>Wants=</varname>, <varname>Requires=</varname>, <varname>Before=</varname>,
<varname>After=</varname>. Aliases cannot be used with the <command>preset</command> command.</para>
<command>disable</command>, <command>start</command>, <command>stop</command>, <command>status</command>,
and similar, and in all unit dependency directives, including <varname>Wants=</varname>,
<varname>Requires=</varname>, <varname>Before=</varname>, <varname>After=</varname>. Aliases cannot be
used with the <command>preset</command> command.</para>
<para>Unit files may specify aliases through the <varname>Alias=</varname> directive in the [Install]
section. When the unit is enabled, symlinks will be created for those names, and removed when the unit is
+4 -2
View File
@@ -1903,11 +1903,13 @@ static int install_error(
case -ELOOP:
r = sd_bus_error_setf(error, BUS_ERROR_UNIT_LINKED,
"Refusing to operate on linked unit file %s", changes[i].path);
"Refusing to operate on alias name or linked unit file: %s",
changes[i].path);
goto found;
case -ENOENT:
r = sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unit file %s does not exist.", changes[i].path);
r = sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT,
"Unit file %s does not exist.", changes[i].path);
goto found;
default:
+1 -1
View File
@@ -1897,7 +1897,7 @@ static int install_context_apply(
q = install_info_traverse(scope, c, paths, i, flags, NULL);
if (q < 0) {
unit_file_changes_add(changes, n_changes, r, i->name, NULL);
unit_file_changes_add(changes, n_changes, q, i->name, NULL);
return q;
}