Compare commits

...

6 Commits

Author SHA1 Message Date
Yu Watanabe 412be51fe8
Merge pull request #15013 from systemd/systemctl-list-dependencies
systemctl list-dependencies: fix duplicate output and take multiple arguments
2020-03-05 20:54:58 +09:00
Yu Watanabe c1817e2528
Merge pull request #15023 from keszybz/network-generator-man
Man page for systemd-network-generator
2020-03-05 20:54:32 +09:00
Zbigniew Jędrzejewski-Szmek 94c3a838da systemctl: make list-dependencies take multiple arguments
Other similar commands do, no reason not to do this here too.
2020-03-05 08:27:58 +01:00
Zbigniew Jędrzejewski-Szmek 82c8bdff12 man: mention networkctl in the networkd man page 2020-03-05 08:20:31 +01:00
Zbigniew Jędrzejewski-Szmek 4a29c185b7 man: add systemd-network-generator.service(8)
It's a bit bare-bones, but it should be enough to point the reader in the right
direction.
2020-03-05 08:20:06 +01:00
Zbigniew Jędrzejewski-Szmek dbf2801f5a systemctl: do not print items twice in list-dependencies
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1807485.
2020-03-04 09:33:12 +01:00
6 changed files with 147 additions and 22 deletions

View File

@ -763,6 +763,10 @@ manpages = [
''], ''],
['systemd-modules-load.service', '8', ['systemd-modules-load'], 'HAVE_KMOD'], ['systemd-modules-load.service', '8', ['systemd-modules-load'], 'HAVE_KMOD'],
['systemd-mount', '1', ['systemd-umount'], ''], ['systemd-mount', '1', ['systemd-umount'], ''],
['systemd-network-generator.service',
'8',
['systemd-network-generator'],
'ENABLE_NETWORKD'],
['systemd-networkd-wait-online.service', ['systemd-networkd-wait-online.service',
'8', '8',
['systemd-networkd-wait-online'], ['systemd-networkd-wait-online'],

View File

@ -507,17 +507,17 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<varlistentry> <varlistentry>
<term> <term>
<command>list-dependencies</command> <command>list-dependencies</command>
<optional><replaceable>UNIT</replaceable></optional> <optional><replaceable>UNIT</replaceable>...</optional>
</term> </term>
<listitem> <listitem>
<para>Shows units required and wanted by the specified <para>Shows units required and wanted by the specified
unit. This recursively lists units following the units. This recursively lists units following the
<varname>Requires=</varname>, <varname>Requires=</varname>,
<varname>Requisite=</varname>, <varname>Requisite=</varname>,
<varname>ConsistsOf=</varname>, <varname>ConsistsOf=</varname>,
<varname>Wants=</varname>, <varname>BindsTo=</varname> <varname>Wants=</varname>, <varname>BindsTo=</varname>
dependencies. If no unit is specified, dependencies. If no units are specified,
<filename>default.target</filename> is implied.</para> <filename>default.target</filename> is implied.</para>
<para>By default, only target units are recursively <para>By default, only target units are recursively

View File

@ -0,0 +1,103 @@
<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
<refentry id="systemd-network-generator.service" conditional='ENABLE_NETWORKD'>
<refentryinfo>
<title>systemd-network-generator.service</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>systemd-network-generator.service</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>systemd-network-generator.service</refname>
<refname>systemd-network-generator</refname>
<refpurpose>Generate network configuration from the kernel command line</refpurpose>
</refnamediv>
<refsynopsisdiv>
<para><filename>systemd-network-generator.service</filename></para>
<para><filename>/usr/lib/systemd/systemd-network-generator</filename></para>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><filename>systemd-network-generator.service</filename> is a system service that translates
<varname>ip=</varname> and the related settings on the kernel command line (see below) into
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>, and
<citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
configuration files understood by
<citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
and
<citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
</para>
<para>Files are generated in <filename>/run/systemd/network/</filename>.</para>
</refsect1>
<refsect1><title>Kernel command line options</title>
<para>This tool understands the following options:</para>
<variablelist class='kernel-commandline-options'>
<varlistentry>
<term><varname>ip=</varname></term>
<term><varname>rd.route=</varname></term>
<term><varname>rd.peerdns=</varname></term>
<listitem>
<para>— translated into
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>ifname=</varname></term>
<listitem>
<para>— translated into
<citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry> files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>vlan=</varname></term>
<term><varname>bond=</varname></term>
<term><varname>bridge=</varname></term>
<term><varname>bootdev=</varname></term>
<listitem>
<para>— translated into
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry> files.</para>
</listitem>
</varlistentry>
<!-- unsupported:
team=<teammaster>:<teamslaves>
bootdev=
BOOTIF=
bootdev=
bootdev=
bootdev=
-->
</variablelist>
<para>See
<citerefentry project='man-pages'><refentrytitle>dracut.kernel</refentrytitle><manvolnum>7</manvolnum></citerefentry>
for option syntax and details.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>dracut</refentrytitle><manvolnum>8</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -61,6 +61,10 @@
<filename>systemd-networkd</filename> is restarted, netdev interfaces for <filename>systemd-networkd</filename> is restarted, netdev interfaces for
which configuration was removed will not be dropped, and may need to be which configuration was removed will not be dropped, and may need to be
cleaned up manually.</para> cleaned up manually.</para>
<para><command>systemd-networkd</command> may be introspected and controlled at runtime using
<citerefentry><refentrytitle>networkctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para>
</refsect1> </refsect1>
<refsect1><title>Configuration Files</title> <refsect1><title>Configuration Files</title>
@ -82,11 +86,13 @@
<refsect1> <refsect1>
<title>See Also</title> <title>See Also</title>
<para> <para>
<citerefentry><refentrytitle>networkctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-networkd-wait-online.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> <citerefentry><refentrytitle>systemd-networkd-wait-online.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-networkd-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
</para> </para>
</refsect1> </refsect1>

View File

@ -785,6 +785,8 @@ static int list_dependencies_get_dependencies(sd_bus *bus, const char *name, cha
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to get properties of %s: %s", name, bus_error_message(&error, r)); return log_error_errno(r, "Failed to get properties of %s: %s", name, bus_error_message(&error, r));
strv_uniq(deps); /* Sometimes a unit might have multiple deps on the other unit,
* but we still want to show it just once. */
*ret = TAKE_PTR(deps); *ret = TAKE_PTR(deps);
return 0; return 0;
@ -1786,30 +1788,39 @@ static int list_dependencies_one(
} }
static int list_dependencies(int argc, char *argv[], void *userdata) { static int list_dependencies(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **units = NULL; _cleanup_strv_free_ char **units = NULL, **done = NULL;
_cleanup_free_ char *unit = NULL; char **u, **patterns;
const char *u;
sd_bus *bus; sd_bus *bus;
int r; int r;
if (argv[1]) {
r = unit_name_mangle(argv[1], arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, &unit);
if (r < 0)
return log_error_errno(r, "Failed to mangle unit name: %m");
u = unit;
} else
u = SPECIAL_DEFAULT_TARGET;
r = acquire_bus(BUS_MANAGER, &bus); r = acquire_bus(BUS_MANAGER, &bus);
if (r < 0) if (r < 0)
return r; return r;
patterns = strv_skip(argv, 1);
if (strv_isempty(patterns)) {
units = strv_new(SPECIAL_DEFAULT_TARGET);
if (!units)
return log_oom();
} else {
r = expand_names(bus, patterns, NULL, &units, NULL);
if (r < 0)
return log_error_errno(r, "Failed to expand names: %m");
}
(void) pager_open(arg_pager_flags); (void) pager_open(arg_pager_flags);
puts(u); STRV_FOREACH(u, units) {
if (u != units)
puts("");
return list_dependencies_one(bus, u, 0, &units, 0); puts(*u);
r = list_dependencies_one(bus, *u, 0, &done, 0);
if (r < 0)
return r;
}
return 0;
} }
struct machine_info { struct machine_info {
@ -7815,9 +7826,9 @@ static int systemctl_help(void) {
" help PATTERN...|PID... Show manual for one or more units\n" " help PATTERN...|PID... Show manual for one or more units\n"
" reset-failed [PATTERN...] Reset failed state for all, one, or more\n" " reset-failed [PATTERN...] Reset failed state for all, one, or more\n"
" units\n" " units\n"
" list-dependencies [UNIT] Recursively show units which are required\n" " list-dependencies [UNIT...] Recursively show units which are required\n"
" or wanted by this unit or by which this\n" " or wanted by the units or by which those\n"
" unit is required or wanted" " units are required or wanted"
"\n%3$sUnit File Commands:%4$s\n" "\n%3$sUnit File Commands:%4$s\n"
" list-unit-files [PATTERN...] List installed unit files\n" " list-unit-files [PATTERN...] List installed unit files\n"
" enable [UNIT...|PATH...] Enable one or more unit files\n" " enable [UNIT...|PATH...] Enable one or more unit files\n"
@ -9116,7 +9127,7 @@ static int systemctl_main(int argc, char *argv[]) {
{ "link", 2, VERB_ANY, 0, enable_unit }, { "link", 2, VERB_ANY, 0, enable_unit },
{ "revert", 2, VERB_ANY, 0, enable_unit }, { "revert", 2, VERB_ANY, 0, enable_unit },
{ "switch-root", 2, VERB_ANY, VERB_ONLINE_ONLY, switch_root }, { "switch-root", 2, VERB_ANY, VERB_ONLINE_ONLY, switch_root },
{ "list-dependencies", VERB_ANY, 2, VERB_ONLINE_ONLY, list_dependencies }, { "list-dependencies", VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, list_dependencies },
{ "set-default", 2, 2, 0, set_default }, { "set-default", 2, 2, 0, set_default },
{ "get-default", VERB_ANY, 1, 0, get_default }, { "get-default", VERB_ANY, 1, 0, get_default },
{ "set-property", 3, VERB_ANY, VERB_ONLINE_ONLY, set_property }, { "set-property", 3, VERB_ANY, VERB_ONLINE_ONLY, set_property },

View File

@ -9,6 +9,7 @@
[Unit] [Unit]
Description=Generate network units from Kernel command line Description=Generate network units from Kernel command line
Documentation=man:systemd-network-generator.service(8)
DefaultDependencies=no DefaultDependencies=no
Before=network-pre.target Before=network-pre.target