#!/bin/sh

############################
## BLUETOOTHD INIT SCRIPT ##
############################

## Callum Dickinson <gcfreak_ag20@hotmail.com>
## Sonic Team Junior <http://www.srb2.org>
## http://mb.srb2.org/showthread.php?t=31137
## svn://code.srb2.org/SRB2/branches/WII

## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.


## Any lines in this file preceeded by a hash ('#') indicates a comment, and is not read by the interpreter.

#--------------------#
. /lib/lsb/init-functions
. /etc/profile
BLUETOOTHD="`which bluetoothd || which hcid`"
LOGFILE="$LOGDIR/$ME.log"
#--------------------#
case "$1" in
	"start") log_action_begin_msg "Starting Bluetooth system"
		$BLUETOOTHD > /dev/null 2>&1
		log_action_end_msg 0
   		;;
	"stop") log_action_begin_msg "Stopping Bluetooth system"
		killall `basename $BLUETOOTHD` > /dev/null 2>&1
		log_action_end_msg 0
		;;
	restart|reload|force-reload) log_action_begin_msg "Restarting Bluetooth system"
		killall `basename $BLUETOOTHD` > /dev/null 2>&1
		$BLUETOOTHD > /dev/null 2>&1
		log_action_end_msg 0
   		;;
	*) print "Usage: /etc/init.d/$BLUETOOTHD {start|stop|restart|reload|force-reload}" && exit 1;;
esac
