From: Yu Watanabe Date: Fri, 28 Jan 2022 06:30:01 +0000 (+0900) Subject: unit: introduce wait-online@.service for specific interface X-Git-Tag: v251-rc1~430 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=674df18a32e6bb865ae84d39eaf8a5e5f10c7adc;p=thirdparty%2Fsystemd.git unit: introduce wait-online@.service for specific interface This should be useful when a host has multiple interfaces. Inspired by #22246. --- diff --git a/man/rules/meson.build b/man/rules/meson.build index b689b1c1af6..7200ecf6810 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -932,7 +932,7 @@ manpages = [ ['systemd-network-generator.service', '8', ['systemd-network-generator'], ''], ['systemd-networkd-wait-online.service', '8', - ['systemd-networkd-wait-online'], + ['systemd-networkd-wait-online', 'systemd-networkd-wait-online@.service'], 'ENABLE_NETWORKD'], ['systemd-networkd.service', '8', ['systemd-networkd'], 'ENABLE_NETWORKD'], ['systemd-notify', '1', [], ''], diff --git a/man/systemd-networkd-wait-online.service.xml b/man/systemd-networkd-wait-online.service.xml index 9c6b02ac1c8..a3a70db2091 100644 --- a/man/systemd-networkd-wait-online.service.xml +++ b/man/systemd-networkd-wait-online.service.xml @@ -18,12 +18,14 @@ systemd-networkd-wait-online.service + systemd-networkd-wait-online@.service systemd-networkd-wait-online Wait for network to come online systemd-networkd-wait-online.service + systemd-networkd-wait-online@.service /usr/lib/systemd/systemd-networkd-wait-online @@ -38,6 +40,17 @@ to be fully configured or failed, and for at least one link to be online. Here, online means that the link's operational state is equal or higher than degraded. The threshold can be configured by option. + + The service systemd-networkd-wait-online.service invokes + systemd-networkd-wait-online without any options. Thus, it waits for all managed + interfaces to be configured or failed, and for at least one to be online. + + The service systemd-networkd-wait-online@.service takes an interface + name, and invokes systemd-networkd-wait-online with and the + specified interface name. Thus, wait for the specified interface to be configured and online. For + example, systemd-networkd-wait-online@eth0.service waits for + eth0 to be configured by systemd-networkd and online. + diff --git a/units/meson.build b/units/meson.build index 3184433b8f5..2bb0a8e845d 100644 --- a/units/meson.build +++ b/units/meson.build @@ -220,6 +220,7 @@ in_units = [ ['systemd-network-generator.service', ''], ['systemd-networkd.service', 'ENABLE_NETWORKD'], ['systemd-networkd-wait-online.service', 'ENABLE_NETWORKD'], + ['systemd-networkd-wait-online@.service','ENABLE_NETWORKD'], ['systemd-nspawn@.service', ''], ['systemd-oomd.service', 'ENABLE_OOMD'], ['systemd-portabled.service', 'ENABLE_PORTABLED', diff --git a/units/systemd-networkd-wait-online@.service.in b/units/systemd-networkd-wait-online@.service.in new file mode 100644 index 00000000000..949695f53e2 --- /dev/null +++ b/units/systemd-networkd-wait-online@.service.in @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Wait for Network Interface %i to be Configured +Documentation=man:systemd-networkd-wait-online.service(8) +DefaultDependencies=no +Conflicts=shutdown.target +Requires=systemd-networkd.service +After=systemd-networkd.service +Before=network-online.target shutdown.target + +[Service] +Type=oneshot +ExecStart={{ROOTLIBEXECDIR}}/systemd-networkd-wait-online -i %i +RemainAfterExit=yes + +[Install] +WantedBy=network-online.target