systemd: pull in network.service and introduce NetworkManager-wait-online.service
This pulls in network.target from NetworkManager.service (and not the other way round), as suggested and agreed on on the systemd ML: http://lists.freedesktop.org/archives/systemd-devel/2011-March/001692.html This also introduces an auxiliary service NetworkManager-wait-online.service that can be used to order a unit after the point where the network is available. When this is enabled with "systemd enable NetworkManager-wait-online.service" the unit network.target will be delayed until the network is up, which is suitable for synchronizing NFS mounts and similar to it. https://bugzilla.redhat.com/show_bug.cgi?id=692008
This commit is contained in:

committed by
Dan Williams

parent
1a61a0a2ca
commit
c4d387efb8
1
.gitignore
vendored
1
.gitignore
vendored
@@ -179,6 +179,7 @@ policy/org.freedesktop.network-manager-settings.system.policy
|
|||||||
policy/org.freedesktop.NetworkManager.policy
|
policy/org.freedesktop.NetworkManager.policy
|
||||||
|
|
||||||
data/NetworkManager.service
|
data/NetworkManager.service
|
||||||
|
data/NetworkManager-wait-online.service
|
||||||
data/org.freedesktop.NetworkManager.service
|
data/org.freedesktop.NetworkManager.service
|
||||||
|
|
||||||
cli/src/nmcli
|
cli/src/nmcli
|
||||||
|
@@ -1,10 +1,15 @@
|
|||||||
|
|
||||||
if HAVE_SYSTEMD
|
if HAVE_SYSTEMD
|
||||||
systemdsystemunit_DATA = NetworkManager.service
|
systemdsystemunit_DATA = \
|
||||||
|
NetworkManager.service \
|
||||||
|
NetworkManager-wait-online.service
|
||||||
|
|
||||||
NetworkManager.service: NetworkManager.service.in
|
NetworkManager.service: NetworkManager.service.in
|
||||||
$(edit) $< >$@
|
$(edit) $< >$@
|
||||||
|
|
||||||
|
NetworkManager-wait-online.service: NetworkManager-wait-online.service.in
|
||||||
|
$(edit) $< >$@
|
||||||
|
|
||||||
servicedir = $(datadir)/dbus-1/system-services
|
servicedir = $(datadir)/dbus-1/system-services
|
||||||
service_in_files = org.freedesktop.NetworkManager.service.in
|
service_in_files = org.freedesktop.NetworkManager.service.in
|
||||||
service_DATA = $(service_in_files:.service.in=.service)
|
service_DATA = $(service_in_files:.service.in=.service)
|
||||||
@@ -14,13 +19,14 @@ $(service_DATA): $(service_in_files) Makefile
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
edit = sed \
|
edit = sed \
|
||||||
|
-e 's|@bindir[@]|$(bindir)|g' \
|
||||||
-e 's|@sbindir[@]|$(sbindir)|g' \
|
-e 's|@sbindir[@]|$(sbindir)|g' \
|
||||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
-e 's|@localstatedir[@]|$(localstatedir)|g'
|
-e 's|@localstatedir[@]|$(localstatedir)|g'
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
NetworkManager.service.in \
|
NetworkManager.service.in \
|
||||||
|
NetworkManager-wait-online.service.in \
|
||||||
org.freedesktop.NetworkManager.service.in
|
org.freedesktop.NetworkManager.service.in
|
||||||
|
|
||||||
CLEANFILES = NetworkManager.service org.freedesktop.NetworkManager.service
|
CLEANFILES = NetworkManager.service NetworkManager-wait-online.service org.freedesktop.NetworkManager.service
|
||||||
|
|
||||||
|
12
data/NetworkManager-wait-online.service.in
Normal file
12
data/NetworkManager-wait-online.service.in
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Network Manager Wait Online
|
||||||
|
Requires=NetworkManager.service
|
||||||
|
Wants=network.target
|
||||||
|
Before=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=@bindir@/nm-online -q --timeout=30
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@@ -1,6 +1,8 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Network Manager
|
Description=Network Manager
|
||||||
After=syslog.target
|
After=syslog.target
|
||||||
|
Wants=network.target
|
||||||
|
Before=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=dbus
|
Type=dbus
|
||||||
@@ -8,5 +10,5 @@ BusName=org.freedesktop.NetworkManager
|
|||||||
ExecStart=@sbindir@/NetworkManager --no-daemon
|
ExecStart=@sbindir@/NetworkManager --no-daemon
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=network.target multi-user.target
|
WantedBy=multi-user.target
|
||||||
Alias=dbus-org.freedesktop.NetworkManager.service
|
Alias=dbus-org.freedesktop.NetworkManager.service
|
||||||
|
Reference in New Issue
Block a user