Skip to contentSkip to conversation

connman: replace hardcoded path in init script

PATCH Superseded Stefan Stanacar 3 participants 3 messages Apr 25, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 connman: replace hardcoded path in init script

Because the connman init script sources a config file from /usr/lib we end up with no network in multilib enabled sato images, so replace with the real libdir.

---
 meta/recipes-connectivity/connman/connman.inc     | 3 ++-
 meta/recipes-connectivity/connman/connman/connman | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
meta/recipes-connectivity/connman/connman.inc +2 -1
index 589ece8..93c9da0 100644
@@ -47,7 +47,7 @@ INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
 
 SYSTEMD_SERVICE_${PN} = "connman.service"
-SYSTEMD_WIRED_SETUP = "ExecStartPre=-/usr/lib/connman/wired-setup"
+SYSTEMD_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"
 
 # IMPORTANT: because xuser is shared with rootless X, please make sure the
 # USERADD_PARAM is in sync with the one in xserver-nodm-init.bb
@@ -73,6 +73,7 @@ do_install_append() {
 	if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
 		install -d ${D}${sysconfdir}/init.d
 		install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
+                sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
 	fi
 
 	install -d ${D}${bindir}
meta/recipes-connectivity/connman/connman/connman +2 -2
index a111f60..67ba7c8 100644
@@ -32,8 +32,8 @@ do_start() {
 		ethn=`ifconfig | grep eth | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
 		EXTRA_PARAM="-I $ethn"
 	fi
-	if [ -f /usr/lib/connman/wired-setup ] ; then
-		. /usr/lib/connman/wired-setup
+	if [ -f @LIBDIR@/connman/wired-setup ] ; then
+		. @LIBDIR@/connman/wired-setup
 	fi
 	$DAEMON $EXTRA_PARAM
 }
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 15 lines · Stefan Stanacar

Because the connman init script sources a config file from /usr/lib we end up with no network in multilib enabled sato images, so replace with the real libdir.

---
  meta/recipes-connectivity/connman/connman.inc     | 3 ++-
  meta/recipes-connectivity/connman/connman/connman | 4 ++--
  2 files changed, 4 insertions(+), 3 deletions(-)
meta/recipes-connectivity/connman/connman.inc +0 -0
index 589ece8..93c9da0 100644

meta/recipes-connectivity/connman/connman.inc INITSCRIPT_NAME = "connman" · line 50

Quoted 5 lines
meta/recipes-connectivity/connman/connman.inc +1 -1
@@ -47,7 +47,7 @@ INITSCRIPT_NAME = "connman"
  INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
 
  SYSTEMD_SERVICE_${PN} = "connman.service"
-SYSTEMD_WIRED_SETUP = "ExecStartPre=-/usr/lib/connman/wired-setup"
+SYSTEMD_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"

I don't think this is right. The initscript and setup command should be in the 'libexec' location, which is /usr/lib/connman. This way the initscript from any duplicate multilibs installed won't cause a conflict. And the binaries end up in a known location. (The libraries on the other hand should definitely be in the libdir.)

So far we've tried to follow RPM/Fedora style rules for multilib work. And those rules are:

* Multilib packages can all be installed at once
* Executables should be installed in the same location, so the package manager rules take priority as to what version is installed and runable
* Scripts and other non-executables much either be the same in all multilibs, or installed in a unique location.

--Mark

Quoted 27 lines
meta/recipes-connectivity/connman/connman.inc +1 -0
  # IMPORTANT: because xuser is shared with rootless X, please make sure the
  # USERADD_PARAM is in sync with the one in xserver-nodm-init.bb
@@ -73,6 +73,7 @@ do_install_append() {
  	if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
  		install -d ${D}${sysconfdir}/init.d
  		install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
+                sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
  	fi
 
  	install -d ${D}${bindir}
meta/recipes-connectivity/connman/connman/connman +2 -2
index a111f60..67ba7c8 100644
@@ -32,8 +32,8 @@ do_start() {
  		ethn=`ifconfig | grep eth | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
  		EXTRA_PARAM="-I $ethn"
  	fi
-	if [ -f /usr/lib/connman/wired-setup ] ; then
-		. /usr/lib/connman/wired-setup
+	if [ -f @LIBDIR@/connman/wired-setup ] ; then
+		. @LIBDIR@/connman/wired-setup
  	fi
  	$DAEMON $EXTRA_PARAM
  }
#2 lore raw
Quoted 6 lines · Mark Hatle
Quoted 4 lines · Stefan Stanacar

Because the connman init script sources a config file from /usr/lib we end up with no network in multilib enabled sato images, so replace with the real libdir.

Quoted 7 lines

Review

Quoted 7 lines
---
  meta/recipes-connectivity/connman/connman.inc     | 3 ++-
  meta/recipes-connectivity/connman/connman/connman | 4 ++--
  2 files changed, 4 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-connectivity/connman/connman.inc

Quoted 11 lines

meta/recipes-connectivity/connman/connman.inc INITSCRIPT_NAME = "connman" · line 50

Quoted 9 lines

index 589ece8..93c9da0 100644

meta/recipes-connectivity/connman/connman.inc +1 -1
 <at>  <at>  -47,7 +47,7  <at>  <at>  INITSCRIPT_NAME = "connman"
  INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
 
  SYSTEMD_SERVICE_${PN} = "connman.service"
-SYSTEMD_WIRED_SETUP = "ExecStartPre=-/usr/lib/connman/wired-setup"
+SYSTEMD_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"

I don't think this is right. The initscript and setup command should be

in the

Quoted 1 line

'libexec' location, which is /usr/lib/connman. This way the initscript

from any

Quoted 1 line

duplicate multilibs installed won't cause a conflict. And the binaries

end up

Quoted 1 line

in a known location. (The libraries on the other hand should definitely

be in

Quoted 2 lines

the libdir.)

Okay, that makes sense. The only problem is that wired-setup is installed by connman-conf so libexec won't work. (connman rrecomends connman-conf which installs wired.config and wired-setup for qemu machines only). And I'm not sure how to get around that.

Poky commit e93b6376a0cff5321dd7fc13a88c8b06ae8b83c7 moved wired-setup from /etc/connman to /usr/lib/connman.
I do think that /etc/connman/wired-setup was the better location (or perhaps connman-conf), given that's only a script sourced in /etc/init.d/connman if it exists. But I don't know the reasons why it was moved to /usr/lib/connman.

Any thoughts?