Use templates for the systemd services so that sbindir
and sysconfdir can be written into them, improving
portability.

Pass sbindir with EXTRA_OEMAKE and remove 'prefix' which
is redundant since we pass sbindir and mandir already.

Signed-off-by: Luca Fancellu <[email protected]>
---
 .../{[email protected] => [email protected]}     |  2 +-
 .../systemd/{[email protected] => [email protected]} |  2 +-
 .../recipes-connectivity/linuxptp/linuxptp_4.1.bb | 15 ++++++++++-----
 3 files changed, 12 insertions(+), 7 deletions(-)
 rename 
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/{[email protected] => 
[email protected]} (85%)
 rename meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/{[email protected] 
=> [email protected]} (73%)

diff --git 
a/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] 
b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
similarity index 85%
rename from 
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
rename to 
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
index dd2512bdca11..f66dd2d01031 100644
--- a/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
+++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
@@ -7,7 +7,7 @@ Before=time-sync.target
 
 [Service]
 Type=simple
-ExecStart=/usr/sbin/phc2sys -w -s %I
+ExecStart=@SBINDIR@/phc2sys -w -s %I
 
 [Install]
 WantedBy=multi-user.target
diff --git 
a/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected] 
b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
similarity index 73%
rename from 
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
rename to 
meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
index 1bad2d72df6b..250218141272 100644
--- a/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
+++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp/systemd/[email protected]
@@ -5,7 +5,7 @@ After=sys-subsystem-net-devices-%i.device
 
 [Service]
 Type=simple
-ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i %I
+ExecStart=@SBINDIR@/ptp4l -f @SYSCONFDIR@/linuxptp/ptp4l.conf -i %I
 
 [Install]
 WantedBy=multi-user.target
diff --git a/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb 
b/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb
index a92434385d52..9a5c9b52043c 100644
--- a/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb
+++ b/meta-oe/recipes-connectivity/linuxptp/linuxptp_4.1.bb
@@ -10,8 +10,8 @@ LINUXPTP_SRC_URI = "http://sourceforge.net/projects/linuxptp";
 SRC_URI = "${LINUXPTP_SRC_URI}/files/v4.1/linuxptp-${PV}.tgz \
            file://0001-include-string.h-for-strncpy.patch \
            file://0002-linuxptp-Use-CC-in-incdefs.sh.patch \
-           file://systemd/[email protected] \
-           file://systemd/[email protected] \
+           file://systemd/[email protected] \
+           file://systemd/[email protected] \
            "
 
 SRC_URI[md5sum] = "1db8699fc155965341759be5e5aad938"
@@ -22,14 +22,15 @@ inherit systemd
 UPSTREAM_CHECK_URI = "${LINUXPTP_SRC_URI}/files/"
 UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/"
 
-EXTRA_OEMAKE = "CC='${CC}' EXTRA_CFLAGS='${CFLAGS}' mandir='${mandir}'"
+EXTRA_OEMAKE = "CC='${CC}' EXTRA_CFLAGS='${CFLAGS}' mandir='${mandir}' \
+    sbindir='${sbindir}'"
 
 export KBUILD_OUTPUT="${RECIPE_SYSROOT}"
 
 LINUXPTP_SYSTEMD_SERVICES = "[email protected] [email protected]"
 
 do_install() {
-    oe_runmake install DESTDIR=${D} prefix=${prefix}
+    oe_runmake install DESTDIR=${D}
 
     # Install example configs from source tree
     install -d ${D}${docdir}/${PN}
@@ -44,7 +45,11 @@ do_install() {
     # Install systemd services
     install -d ${D}/${systemd_unitdir}/system/
     for service in ${LINUXPTP_SYSTEMD_SERVICES}; do
-        install -m 644 ${WORKDIR}/systemd/$service \
+        sed -i -e 's,@SBINDIR@,${sbindir},g' \
+            ${WORKDIR}/systemd/$service.in
+        sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
+            ${WORKDIR}/systemd/$service.in
+        install -m 644 ${WORKDIR}/systemd/$service.in \
             ${D}/${systemd_unitdir}/system/$service
     done
 }
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#105573): 
https://lists.openembedded.org/g/openembedded-devel/message/105573
Mute This Topic: https://lists.openembedded.org/mt/102036797/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to