Create a systemd service that uses test/wait-for-ready to wait for any
interface to be in the 'ready' or 'online' state. This service will be
pulled by network-online.target.

This is similar to NetworkManager-wait-online.service as provided by
network manager and systemd-networkd-wait-online.service as provided by
networkd.
---
 Makefile.am                        |  2 +-
 configure.ac                       |  3 ++-
 src/connman-wait-online.service.in | 12 ++++++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 src/connman-wait-online.service.in

diff --git a/Makefile.am b/Makefile.am
index af14dcc..3e216bf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,7 +64,7 @@ endif
 if SYSTEMD
 systemdunitdir = @SYSTEMD_UNITDIR@
 
-systemdunit_DATA = src/connman.service
+systemdunit_DATA = src/connman.service src/connman-wait-online.service
 
 if VPN
 systemdunit_DATA += vpn/connman-vpn.service
diff --git a/configure.ac b/configure.ac
index 6f35c78..b4c1601 100644
--- a/configure.ac
+++ b/configure.ac
@@ -386,4 +386,5 @@ AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o 
\
 
 AC_OUTPUT(Makefile include/version.h src/connman.service
                vpn/connman-vpn.service vpn/net.connman.vpn.service
-               scripts/connman connman.pc src/net.connman.service)
+               scripts/connman connman.pc src/net.connman.service
+               src/connman-wait-online.service)
diff --git a/src/connman-wait-online.service.in 
b/src/connman-wait-online.service.in
new file mode 100644
index 0000000..ff31496
--- /dev/null
+++ b/src/connman-wait-online.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Wait for connman to have an interface ready
+Requires=connman.service
+After=connman.service
+Before=network-online.target
+
+[Service]
+Type=oneshot
+ExecStart=@prefix@/lib/connman/test/wait-for-ready
+
+[Install]
+WantedBy=network-online.target
-- 
2.1.1

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to