~thopiekar/+junk/bluez-packaging

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# bluez - bluetooth daemon

description     "bluetooth daemon"

start on started dbus
stop on stopping dbus

env UART_CONF=/etc/bluetooth/uart
env RFCOMM_CONF=/etc/bluetooth/rfcomm.conf

expect fork
respawn

exec /usr/sbin/bluetoothd

post-start script
	[ "$VERBOSE" = no ] && redirect='>/dev/null 2>&1' || redirect=

	# start_uarts()
	if [ -x /usr/sbin/hciattach ] && [ -f $UART_CONF ];
	then
		grep -v '^#' $UART_CONF | while read i; do
		  eval "/usr/sbin/hciattach $i $redirect" || :
		done
	fi

	# start_rfcomm()
	if [ -x /usr/bin/rfcomm ] && [ -f $RFCOMM_CONF ] ;
	then
		# rfcomm must always succeed for now: users
		# may not yet have an rfcomm-enabled kernel
		eval "/usr/bin/rfcomm -f $RFCOMM_CONF bind all $redirect" || :
	fi
end script

post-stop script
	# stop_uarts()
	logger -t bluez "Stopping uarts"
	killall hciattach >/dev/null 2>&1 || :

	# stop_rfcomm()
	logger -t bluez "Stopping rfcomm"
	if [ -x /usr/bin/rfcomm ];
	then
		eval "/usr/bin/rfcomm unbind all $redirect" || :
	fi
end script