blob: 1606a5c6630e00d8cba115e7c70d4ff960754c65 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001#!/bin/sh
2
3PATH=/sbin:/bin:/usr/sbin:/usr/bin
4DESC=bluetooth
5
6DAEMON=/usr/lib/bluez5/bluetooth/bluetoothd
7
8# If you want to be ignore error of "org.freedesktop.hostname1",
9# please enable NOPLUGIN_OPTION.
10# NOPLUGIN_OPTION="--noplugin=hostname"
11NOPLUGIN_OPTION=""
12SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION"
13
14test -f $DAEMON || exit 0
15
16# FIXME: any of the sourced files may fail if/with syntax errors
17test -f /etc/default/bluetooth && . /etc/default/bluetooth
18test -f /etc/default/rcS && . /etc/default/rcS
19
20set -e
21
22case $1 in
23 start)
24 echo "Starting $DESC"
25
26 if test "$BLUETOOTH_ENABLED" = 0; then
27 echo "disabled. see /etc/default/bluetooth"
28 exit 0
29 fi
30
31 start-stop-daemon --start --background $SSD_OPTIONS
32 echo "${DAEMON##*/}"
33
34 ;;
35 stop)
36 echo "Stopping $DESC"
37 if test "$BLUETOOTH_ENABLED" = 0; then
38 echo "disabled."
39 exit 0
40 fi
41 start-stop-daemon --stop $SSD_OPTIONS
42 echo "${DAEMON}"
43 ;;
44 restart|force-reload)
45 $0 stop
46 sleep 1
47 $0 start
48 ;;
49 status)
50 pidof ${DAEMON} >/dev/null
51 status=$?
52 if [ $status -eq 0 ]; then
53 echo "bluetooth is running."
54 else
55 echo "bluetooth is not running"
56 fi
57 exit $status
58 ;;
59 *)
60 N=/etc/init.d/bluetooth
61 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
62 exit 1
63 ;;
64esac
65
66exit 0
67
68# vim:noet