Patchwork ofono: Enabling with systemd

login
register
mail settings
Submitter Shakeel, Muhammad
Date July 11, 2013, 10:06 a.m.
Message ID <1373537199-4863-1-git-send-email-muhammad_shakeel@mentor.com>
Download mbox | patch
Permalink /patch/53493/
State New
Headers show

Comments

Shakeel, Muhammad - July 11, 2013, 10:06 a.m.
From: Muhammad Shakeel <muhammad_shakeel@mentor.com>

- Remove dependency on systemd layer
- Install 'sysv' related files only if distro has this feature

Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
---
 meta/recipes-connectivity/ofono/ofono.inc     |   15 ++++++++++++---
 meta/recipes-connectivity/ofono/ofono_1.12.bb |    1 +
 meta/recipes-connectivity/ofono/ofono_git.bb  |    1 +
 3 files changed, 14 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/recipes-connectivity/ofono/ofono.inc b/meta/recipes-connectivity/ofono/ofono.inc
index 21e564c..0804105 100644
--- a/meta/recipes-connectivity/ofono/ofono.inc
+++ b/meta/recipes-connectivity/ofono/ofono.inc
@@ -5,16 +5,25 @@  LICENSE  = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \
                     file://src/ofono.h;beginline=1;endline=20;md5=3ce17d5978ef3445def265b98899c2ee"
 
-inherit autotools pkgconfig update-rc.d
+inherit autotools pkgconfig update-rc.d systemd
 
 DEPENDS  = "dbus glib-2.0 udev mobile-broadband-provider-info ${@base_contains('DISTRO_FEATURES', 'bluetooth','bluez4', '', d)}"
 
 INITSCRIPT_NAME = "ofono"
 INITSCRIPT_PARAMS = "defaults 22"
 
+SYSTEMD_SERVICE_${PN} = "ofono.service"
+SYSTEMD_AUTO_ENABLE = "enable"
+
 do_install_append() {
-  install -d ${D}${sysconfdir}/init.d/
-  install -m 0755 ${WORKDIR}/ofono ${D}${sysconfdir}/init.d/ofono
+    if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+        install -d ${D}${sysconfdir}/init.d/
+        install -m 0755 ${WORKDIR}/ofono ${D}${sysconfdir}/init.d/ofono
+    fi
+
+    if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${systemd_unitdir}/system/ofono.service
+    fi
 }
 
 PACKAGES =+ "${PN}-tests"
diff --git a/meta/recipes-connectivity/ofono/ofono_1.12.bb b/meta/recipes-connectivity/ofono/ofono_1.12.bb
index 44ab0a6..85ef792 100644
--- a/meta/recipes-connectivity/ofono/ofono_1.12.bb
+++ b/meta/recipes-connectivity/ofono/ofono_1.12.bb
@@ -15,5 +15,6 @@  SRC_URI[sha256sum] = "733b75bfd1b2a1925b6de532989c496b8ae17a746691120ef64cceb00b
 EXTRA_OECONF += "\
     --enable-test \
     ${@base_contains('DISTRO_FEATURES', 'bluetooth','--enable-bluetooth', '--disable-bluetooth', d)} \
+    ${@base_contains('DISTRO_FEATURES', 'systemd', '--with-systemdunitdir=${systemd_unitdir}/system/', '--with-systemdunitdir=', d)} \
 "
 CFLAGS_append_libc-uclibc = " -D_GNU_SOURCE"
diff --git a/meta/recipes-connectivity/ofono/ofono_git.bb b/meta/recipes-connectivity/ofono/ofono_git.bb
index f79f34f..dc063e8 100644
--- a/meta/recipes-connectivity/ofono/ofono_git.bb
+++ b/meta/recipes-connectivity/ofono/ofono_git.bb
@@ -10,6 +10,7 @@  SRC_URI  = "git://git.kernel.org/pub/scm/network/ofono/ofono.git;protocol=git \
 
 EXTRA_OECONF += "\
     ${@base_contains('DISTRO_FEATURES', 'bluetooth','--enable-bluetooth', '--disable-bluetooth', d)} \
+    ${@base_contains('DISTRO_FEATURES', 'systemd', '--with-systemdunitdir=${systemd_unitdir}/system/', '--with-systemdunitdir=', d)} \
 "
 
 do_configure_prepend () {