Skip to contentSkip to conversation

Clean up connman-conf on systemd systems

PATCH New Joshua Lock 1 participant 3 messages Dec 16, 2015

lore
Share & tools
lore
#0 lore raw

v4 cover Clean up connman-conf on systemd systems

As reported in YP#8399[1] we currently hack the connman service to try and
execute a script which is only installed on qemu targets, its absence on
non-qemu machines results in an error in the journal:
connman.service: Failed at step EXEC spawning /usr/lib/connman/wired-setup: No such file or directory

This pair of patches changes the connman-conf recipe to install a oneshot systemd unit that is called before ConnMan and removes the ExecStartPre.

SysV init based images are unaffected by this change, the existing mechanisms to check for the presence of the wired-setup script from the init script remain in place.

Regards,

Joshua

The following changes since commit f1f3716776078d68bd9e3734bca881a486dc2ea3:

  meta: more removals of redunant FILES_${PN}-dbg (2015-12-16 12:12:18 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib joshuagl/connman
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=joshuagl/connman

Joshua Lock (2):
connman-conf: convert to systemd oneshot
connman: tidy up connman-conf usage

 meta/recipes-connectivity/connman/connman-conf.bb              |  9 ++++++++-
 .../connman/connman-conf/qemuall/wired-connection.service      | 10 ++++++++++
 meta/recipes-connectivity/connman/connman.inc                  |  5 -----
 3 files changed, 18 insertions(+), 6 deletions(-)
 create mode 100644 meta/recipes-connectivity/connman/connman-conf/qemuall/wired-connection.service

--
2.5.0

#1 lore raw

PATCH v4 1/2 connman-conf: convert to systemd oneshot

Install a oneshot unit file that is started before ConnMan to configure a wired network inteface with the wired-setup script, rather than requiring this script to be manually run some how.

---
 meta/recipes-connectivity/connman/connman-conf.bb              |  9 ++++++++-
 .../connman/connman-conf/qemuall/wired-connection.service      | 10 ++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-connectivity/connman/connman-conf/qemuall/wired-connection.service
meta/recipes-connectivity/connman/connman-conf.bb +8 -1
index 9254ed7..bef9237 100644
@@ -4,8 +4,11 @@ network interface for a qemu machine."
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
 
+inherit systemd
+
 SRC_URI_append_qemuall = " file://wired.config \
                            file://wired-setup \
+                           file://wired-connection.service \
 "
 PR = "r2"
 
@@ -17,10 +20,14 @@ FILES_${PN} = "${localstatedir}/* ${datadir}/*"
 
 do_install() {
     #Configure Wired network interface in case of qemu* machines
-    if test -e ${WORKDIR}/wired.config && test -e ${WORKDIR}/wired-setup; then
+    if test -e ${WORKDIR}/wired.config &&
+       test -e ${WORKDIR}/wired-setup &&
+       test -e ${WORKDIR}/wired-connection.service; then
         install -d ${D}${localstatedir}/lib/connman
         install -m 0644 ${WORKDIR}/wired.config ${D}${localstatedir}/lib/connman
         install -d ${D}${datadir}/connman
         install -m 0755 ${WORKDIR}/wired-setup ${D}${datadir}/connman
+        install -d ${D}${systemd_system_unitdir}
+        install -m 0644 ${WORKDIR}/wired-connection.service ${D}${systemd_system_unitdir}
     fi
 }
meta/recipes-connectivity/connman/connman-conf/qemuall/wired-connection.service new file +10 -0
new file mode 100644
index 0000000..ecb59cd
@@ -0,0 +1,10 @@
+[Unit]
+Description=Setup a wired interface
+Before=connman.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/lib/connman/wired-setup
+
+[Install]
+WantedBy=network.target

--
2.5.0

#2 lore raw

PATCH v4 2/2 connman: tidy up connman-conf usage

In reply to Joshua Lock

connman-conf is now a systemd oneshot and therefore doesn't need to be sed'ed in to the ConnMan service file.

Furthermore we add connman-conf as RRECCOMENDS only for qemu machines.

This cleans up connman-conf so that it is not automatically installed and unconditionally calling a script that doesn't exist for most machines.

Note: this doesn't affect sysvinit where we provide a ConnMan init script which checks for the presence of the wired-networking script and, if it exists, executes it as part of the connman init.

[YOCTO #8399]

---
 meta/recipes-connectivity/connman/connman.inc | 5 -----
 1 file changed, 5 deletions(-)
meta/recipes-connectivity/connman/connman.inc +0 -5
index ba2ca24..a446e66 100644
@@ -68,11 +68,6 @@ python __anonymous () {
 
 SYSTEMD_SERVICE_${PN} = "connman.service"
 SYSTEMD_SERVICE_${PN}-vpn = "connman-vpn.service"
-SYSTEMD_WIRED_SETUP = "ExecStartPre=-${datadir}/connman/wired-setup"
-
-do_compile_append() {
-	sed -i "s#ExecStart=#${SYSTEMD_WIRED_SETUP}\nExecStart=#" ${B}/src/connman.service
-}
 
 do_install_append() {
 	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then

--
2.5.0