blob: ca9fa18549984fad605e9b2761e285c710020707 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001#!/bin/sh
2
Brad Bishop19323692019-04-05 15:28:33 -04003# Source function library
4. /etc/init.d/functions
5
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05006PATH=/sbin:/bin:/usr/sbin:/usr/bin
7DESC=bluetooth
8
Patrick Williamsc0f7c042017-02-23 20:41:17 -06009DAEMON=@LIBEXECDIR@/bluetooth/bluetoothd
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050010
11# If you want to be ignore error of "org.freedesktop.hostname1",
12# please enable NOPLUGIN_OPTION.
13# NOPLUGIN_OPTION="--noplugin=hostname"
14NOPLUGIN_OPTION=""
15SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION"
16
17test -f $DAEMON || exit 0
18
19# FIXME: any of the sourced files may fail if/with syntax errors
20test -f /etc/default/bluetooth && . /etc/default/bluetooth
21test -f /etc/default/rcS && . /etc/default/rcS
22
23set -e
24
25case $1 in
26 start)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 echo -n "Starting $DESC: "
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050028 if test "$BLUETOOTH_ENABLED" = 0; then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050029 echo "disabled (see /etc/default/bluetooth)."
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050030 exit 0
31 fi
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050032 start-stop-daemon --start --background $SSD_OPTIONS
Brad Bishopd7bf8c12018-02-25 22:55:05 -050033 echo "${DAEMON##*/}."
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050034 ;;
35 stop)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050036 echo -n "Stopping $DESC: "
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050037 if test "$BLUETOOTH_ENABLED" = 0; then
Brad Bishopd7bf8c12018-02-25 22:55:05 -050038 echo "disabled (see /etc/default/bluetooth)."
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050039 exit 0
40 fi
41 start-stop-daemon --stop $SSD_OPTIONS
Brad Bishopd7bf8c12018-02-25 22:55:05 -050042 echo "${DAEMON##*/}."
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050043 ;;
44 restart|force-reload)
45 $0 stop
46 sleep 1
47 $0 start
48 ;;
49 status)
Brad Bishop19323692019-04-05 15:28:33 -040050 status ${DAEMON} || exit $?
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050051 ;;
52 *)
53 N=/etc/init.d/bluetooth
54 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
55 exit 1
56 ;;
57esac
58
59exit 0
60
61# vim:noet