[OE-core] [PATCH] bluez5: Add init script to start service with sysvinit
fabien.proriol at jdsu.com
fabien.proriol at jdsu.com
Tue May 5 09:20:15 UTC 2015
From: Fabien Proriol <fabien.proriol at jdsu.com>
Signed-off-by: Fabien Proriol <fabien.proriol at jdsu.com>
---
meta/recipes-connectivity/bluez5/bluez5.inc | 9 +++++-
.../recipes-connectivity/bluez5/bluez5/bluez5.init | 36 ++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-connectivity/bluez5/bluez5/bluez5.init
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc
index 67aafbb..d216002 100644
--- a/meta/recipes-connectivity/bluez5/bluez5.inc
+++ b/meta/recipes-connectivity/bluez5/bluez5.inc
@@ -19,10 +19,11 @@ PACKAGECONFIG[experimental] = "--enable-experimental,--disable-experimental,"
SRC_URI = "\
${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
file://bluetooth.conf \
+ file://bluez.init \
"
S = "${WORKDIR}/bluez-${PV}"
-inherit autotools-brokensep pkgconfig systemd
+inherit autotools-brokensep pkgconfig systemd update-rc.d
EXTRA_OECONF = "\
--enable-tools \
@@ -33,6 +34,10 @@ EXTRA_OECONF = "\
--enable-library \
"
+INITSCRIPT_PACKAGES = "${PN}
+INITSCRIPT_NAME_${PN} = "${PN}"
+INITSCRIPT_PARAMS_${PN} = "start 16 5 . stop 01 0 1 6 ."
+
# bluez5 builds a large number of useful utilities but does not
# install them. Specify which ones we want put into ${PN}-noinst-tools.
NOINST_TOOLS_READLINE ??= ""
@@ -60,6 +65,8 @@ do_install_append() {
for f in ${NOINST_TOOLS} ; do
install -m 755 ${B}/$f ${D}/${bindir}
done
+ install -d ${D}/etc/init.d
+ install -m 0755 ${WORKDIR}/bluez5.init ${D}${sysconfdir}/init.d/bluez5
}
ALLOW_EMPTY_libasound-module-bluez = "1"
diff --git a/meta/recipes-connectivity/bluez5/bluez5/bluez5.init b/meta/recipes-connectivity/bluez5/bluez5/bluez5.init
new file mode 100644
index 0000000..4d6b365
--- /dev/null
+++ b/meta/recipes-connectivity/bluez5/bluez5/bluez5.init
@@ -0,0 +1,36 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: bluez5
+# Default-Start: 5
+# Default-Stop: 016
+# Short-Description: run bluez5 daemon
+# Description: Linux Bluetooth stack V5 userland components..
+### END INIT INFO
+
+export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
+export DBUS_SESSION_BUS_ADDRESS=unix:path=/var/run/dbus/system_bus_socket
+
+test -x /usr/lib/bluez5/bluetooth/bluetoothd || exit 0
+
+case "$1" in
+ start)
+ echo -n "Starting Bluez"
+ start-stop-daemon --start --quiet --background --exec dbus-launch -- /usr/lib/bluez5/bluetooth/bluetoothd
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping Bluez"
+ start-stop-daemon --stop --retry TERM/20/KILL/5 --quiet --exec /usr/lib/bluez5/bluetooth/bluetoothd
+ echo "."
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: /etc/init.d/bluez5 {start|stop|restart}"
+ exit 1
+ ;;
+esac
+
+exit 0
--
2.0.5
More information about the Openembedded-core
mailing list