]> git.pld-linux.org Git - packages/bluez-utils.git/blame - bluez-utils.init
- updated to 3.7
[packages/bluez-utils.git] / bluez-utils.init
CommitLineData
967b575d
JB
1#!/bin/sh
2#
3# bluetooth Bluetooth subsystem starting and stopping
4#
79f13a51 5# chkconfig: 345 25 90
967b575d
JB
6#
7# description: Bluetooth subsystem
8#
9# $Id$
10
11
12# Source function library
13. /etc/rc.d/init.d/functions
14
15UART_CONF="/etc/bluetooth/uart"
16[ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
17
18if [ "$UART_CONF" != "no" -a ! -f "$UART_CONF" ]; then
221d00b8 19 UART_CONF="no"
967b575d
JB
20fi
21
18c1a831 22RETVAL=0
967b575d
JB
23# See how we were called.
24case "$1" in
25 start)
26 # Check if the service is already running?
27 if [ ! -f /var/lock/subsys/bluetooth ]; then
5a541047
AM
28 msg_starting bluetooth; started
29 if is_yes "${HID2HCI_ENABLE}" && [ -x /usr/sbin/hid2hci ]; then
30 msg_starting hid2hci
31 daemon /usr/sbin/hid2hci -0 -q #be quiet
32 RETVAL=$?
33 /bin/sleep 1 # delay for hid's to be detected by hotplug
34 fi
35
36 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
37 msg_starting hcid
38 daemon /usr/sbin/hcid -f /etc/bluetooth/hcid.conf
39 RETVAL=$?
40 fi
41
42 if is_yes "${SDPD_ENABLE}" && [ -x /usr/sbin/sdpd ]; then
43 msg_starting sdpd
44 daemon /usr/sbin/sdpd
45 RETVAL=$?
46 fi
47
48 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
49 msg_starting hidd
50 daemon /usr/bin/hidd ${HIDD_OPTIONS} --server
51 RETVAL=$?
52 fi
53
54 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
55 msg_starting rfcomm
56 daemon /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
57 RETVAL=$?
58 fi
59
60 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
61 msg_starting dund
62 daemon /usr/bin/dund ${DUND_OPTIONS}
63 RETVAL=$?
64 fi
65
66 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
67 msg_starting pand
68 daemon /usr/bin/pand ${PAND_OPTIONS}
69 RETVAL=$?
70 fi
71
967b575d 72 if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
221d00b8 73 grep -v '^#' $UART_CONF | while read i; do
74 /usr/sbin/hciattach $i
75 done
967b575d 76 fi
967b575d
JB
77 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bluetooth
78 else
5a541047 79 msg_already_running bluetooth
967b575d 80 fi
221d00b8 81 ;;
967b575d
JB
82 stop)
83 if [ -f /var/lock/subsys/bluetooth ]; then
5a541047
AM
84 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
85 msg_stopping pand
86 killproc /usr/bin/pand
87 fi
88
89 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
90 msg_stopping dund
91 killproc /usr/bin/dund
967b575d 92 fi
5a541047
AM
93
94 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
95 msg_stopping rfcomm
96 daemon /usr/bin/rfcomm release all
97 fi
98
99 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
100 msg_stopping hidd
101 killproc /usr/bin/hidd
102 fi
103
104 if is_yes "${SDPD_ENABLE}" && [ -x /usr/sbin/sdpd ]; then
105 msg_stopping sdpd
106 killproc /usr/sbin/sdpd
107 fi
108
109 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
110 msg_stopping hcid
111 daemon /usr/sbin/hcid
112 fi
113
967b575d 114 if [ "$UART_CONF" != "no" ]; then
221d00b8 115 killproc hciattach >/dev/null 2>&1
967b575d
JB
116 fi
117 rm -f /var/lock/subsys/bluetooth
118 else
5a541047 119 msg_not_running bluetooth
c948d0b5 120 fi
967b575d
JB
121 ;;
122 restart)
123 $0 stop
124 $0 start
18c1a831 125 exit $?
967b575d 126 ;;
18c1a831 127 reload|force-reload)
967b575d 128 if [ -f /var/lock/subsys/bluetooth ]; then
5a541047 129 msg_reloading hcid
967b575d
JB
130 killproc hcid -HUP
131 RETVAL=$?
132 else
5a541047 133 msg_not_running bluetooth >&2
63e20b4e 134 exit 7
967b575d
JB
135 fi
136 ;;
967b575d 137 status)
5a541047
AM
138 is_yes "${HID2HCI_ENABLE}" && status hid2hci
139 is_yes "${HCID_ENABLE}" && status hcid
140 is_yes "${SDPD_ENABLE}" && status sdpd
141 is_yes "${HIDD_ENABLE}" && status hidd
142 is_yes "${DUND_ENABLE}" && status dund
63e20b4e 143 exit $?
79f13a51 144 ;;
967b575d 145 *)
79f13a51 146 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
18c1a831 147 exit 3
967b575d
JB
148esac
149
150exit $RETVAL
151
152# This must be last line !
153# vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.045209 seconds and 4 git commands to generate.