summaryrefslogtreecommitdiff
path: root/recipes-connectivity/bluez5/bluez5/init
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/bluez5/bluez5/init')
-rw-r--r--recipes-connectivity/bluez5/bluez5/init61
1 files changed, 61 insertions, 0 deletions
diff --git a/recipes-connectivity/bluez5/bluez5/init b/recipes-connectivity/bluez5/bluez5/init
new file mode 100644
index 0000000..ca9fa18
--- /dev/null
+++ b/recipes-connectivity/bluez5/bluez5/init
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Source function library
+. /etc/init.d/functions
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DESC=bluetooth
+
+DAEMON=@LIBEXECDIR@/bluetooth/bluetoothd
+
+# If you want to be ignore error of "org.freedesktop.hostname1",
+# please enable NOPLUGIN_OPTION.
+# NOPLUGIN_OPTION="--noplugin=hostname"
+NOPLUGIN_OPTION=""
+SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION"
+
+test -f $DAEMON || exit 0
+
+# FIXME: any of the sourced files may fail if/with syntax errors
+test -f /etc/default/bluetooth && . /etc/default/bluetooth
+test -f /etc/default/rcS && . /etc/default/rcS
+
+set -e
+
+case $1 in
+ start)
+ echo -n "Starting $DESC: "
+ if test "$BLUETOOTH_ENABLED" = 0; then
+ echo "disabled (see /etc/default/bluetooth)."
+ exit 0
+ fi
+ start-stop-daemon --start --background $SSD_OPTIONS
+ echo "${DAEMON##*/}."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: "
+ if test "$BLUETOOTH_ENABLED" = 0; then
+ echo "disabled (see /etc/default/bluetooth)."
+ exit 0
+ fi
+ start-stop-daemon --stop $SSD_OPTIONS
+ echo "${DAEMON##*/}."
+ ;;
+ restart|force-reload)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ status)
+ status ${DAEMON} || exit $?
+ ;;
+ *)
+ N=/etc/init.d/bluetooth
+ echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# vim:noet