- support for dbus 0.3x (patches from fedora)
[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
28 # show "Starting %s service" Bluetooth
29 msg_starting Bluetooth
30 if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
221d00b8 31 grep -v '^#' $UART_CONF | while read i; do
32 /usr/sbin/hciattach $i
33 done
967b575d
JB
34 fi
35 daemon /usr/sbin/hcid -f /etc/bluetooth/hcid.conf
36 RETVAL=$?
37 if [ $RETVAL -ne 0 ]; then
221d00b8 38 killproc hciattach >/dev/null 2>&1
967b575d 39 elif [ -x /usr/sbin/sdpd ]; then
221d00b8 40 msg_starting "Bluetooth SDP"
41 daemon /usr/sbin/sdpd
42 RETVAL=$?
43 if [ $RETVAL -ne 0 ]; then
44 killproc hcid >/dev/null 2>&1
45 if [ "$UART_CONF" != "no" ]; then
46 killproc hciattach >/dev/null 2>&1
47 fi
967b575d 48 fi
967b575d
JB
49 fi
50 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bluetooth
51 else
52 # show "%s service is already running." Bluetooth
53 msg_already_running Bluetooth
967b575d 54 fi
221d00b8 55 ;;
967b575d
JB
56 stop)
57 if [ -f /var/lock/subsys/bluetooth ]; then
58 if [ -x /usr/sbin/sdpd ]; then
221d00b8 59 msg_stopping "Bluetooth SDP"
60 killproc sdpd
967b575d
JB
61 fi
62 # show "Stopping %s service" Bluetooth
63 msg_stopping Bluetooth
64 killproc hcid
967b575d 65 if [ "$UART_CONF" != "no" ]; then
221d00b8 66 killproc hciattach >/dev/null 2>&1
967b575d
JB
67 fi
68 rm -f /var/lock/subsys/bluetooth
69 else
70 # show "%s service is not running." Bluetooth
71 msg_not_running Bluetooth
967b575d
JB
72 fi
73 ;;
74 restart)
75 $0 stop
76 $0 start
18c1a831 77 exit $?
967b575d 78 ;;
18c1a831 79 reload|force-reload)
967b575d
JB
80 if [ -f /var/lock/subsys/bluetooth ]; then
81 # show "Reload %s service" Bluetooth
82 msg_reloading Bluetooth
83 killproc hcid -HUP
84 RETVAL=$?
85 else
86 # show "%s service is not running." Bluetooth
63e20b4e 87 msg_not_running Bluetooth >&2
88 exit 7
967b575d
JB
89 fi
90 ;;
967b575d
JB
91 status)
92 status hcid
63e20b4e 93 exit $?
79f13a51 94 ;;
967b575d 95 *)
79f13a51 96 # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
97 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
18c1a831 98 exit 3
967b575d
JB
99esac
100
101exit $RETVAL
102
103# This must be last line !
104# vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.044872 seconds and 4 git commands to generate.