#!/bin/sh
#
# chkconfig: 345 50 83
# description: Turn HID adapters into Bluetooth ones
#
### BEGIN INIT INFO
# Short-Description: Turn HID adapters into Bluetooth ones
# Description: Turn HID adapters into Bluetooth ones
### END INIT INFO

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

[ -e /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth

prog="bluetoothd"
lockfile=/var/lock/subsys/bluetoothd

start()
{
	echo -n $"Starting $prog: "
	daemon /usr/sbin/bluetoothd
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && touch $lockfile
	return $RETVAL
}

stop()
{
	echo -n "Stopping $prog: "
	killproc bluetoothd
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f $lockfile
	return $RETVAL
}

restart()
{
	stop
	start
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  force-reload|restart|reload)
	restart
	;;
  try-restart|condrestart)
	[ -f $lockfile ] && restart ||:
	;;
  status)
	status $prog
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|contrestart|status}"
	exit 3
	;;
esac

exit $RETVAL
