Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 55e253350a3eebf88cda43f962427b0e > files > 4

bluez-utils-2.3-1mdk.ppc.rpm

#!/bin/sh
#
# bluetooth    Bluetooth subsystem starting and stopping
#
# chkconfig: 345 25 90
# description: Bluetooth subsystem
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source Bluetooth configuration.
#. /etc/sysconfig/bluetooth

prog="Bluetooth"

UART_CONF="/etc/bluetooth/uart"

start_uarts()
{
	[ -f /sbin/hciattach -a -f $UART_CONF ] || return
	grep -v '^#' $UART_CONF | while read i; do
		/sbin/hciattach $i
	done
}

stop_uarts()
{
	killproc hciattach > /dev/null 2>&1
}

start() 
{
        gprintf "Starting %s: " "$prog"
        daemon /sbin/hcid

	if [ -x /usr/sbin/sdpd ]; then
		daemon /usr/sbin/sdpd
	fi

	start_uarts
	touch /var/lock/subsys/bluetooth
        echo
}

stop() 
{
        gprintf "Shutting down %s: " "$prog"
	killproc hcid

	if [ -x /usr/sbin/sdpd ]; then
		killproc sdpd
	fi

	stop_uarts
	rm -f  /var/lock/subsys/bluetooth
        echo
}

[ -f /sbin/hcid ] || exit 0

# See how we were called.
case "$1" in
  start)
	start
        ;;
  stop)
	stop
        ;;
  restart|reload)
	stop
	start
	;;
  condrestart)
	[ -e /var/lock/subsys/bluetooth ] && (stop; start)
	;;
  *)
        gprintf "Usage: %s {start|stop|restart|reload|condrestart}\n" "$0"
        exit 1
esac

exit 0