Update of /cvsroot/devil-linux/build/scripts/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6436/scripts/scripts
Added Files:
bluetooth
Log Message:
initial checkin
--- NEW FILE: bluetooth ---
#!/bin/sh
#
# bluetooth Bluetooth subsystem starting and stopping
#
# chkconfig: 2345 25 90
# description: Bluetooth subsystem
#
# settings.
source /etc/sysconfig/config
# source function library
source /etc/init.d/functions
CONFIGNAME=BLUEZ
eval START=\$START_$CONFIGNAME
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
# Force execution if not called by a runlevel directory.
test $link = $base && START=yes
test "$START" = "yes" || exit 0
# Source Bluetooth configuration.
#. /etc/sysconfig/bluetooth
prog="Bluetooth"
UART_CONF="/etc/bluetooth/uart"
start_uarts()
{
[ -f /usr/sbin/hciattach -a -f $UART_CONF ] || return
grep -v '^#' $UART_CONF | while read i; do
/usr/sbin/hciattach $i
done
}
stop_uarts()
{
killproc hciattach > /dev/null 2>&1
}
start()
{
echo -n $"Starting $prog: "
loadproc /usr/sbin/hcid
if [ -x /usr/sbin/sdpd ]; then
loadproc /usr/sbin/sdpd
fi
if [ -x /bin/rfcomm -a -f /etc/bluetooth/rfcomm.conf ]; then
/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
fi
if [ -x /usr/bin/rfcomm -a -f /etc/bluetooth/rfcomm.conf ]; then
/usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
fi
if [ -x /usr/bin/dund ]; then
# iptables -A FORWARD -m state --state NEW -i ppp0 -j ACCEPT
# It's better to insert the following line to your firewall.rules:
# ${IPTABLES} -A FORWARD -m state --state NEW -i ppp0 -j ACCEPT
loadproc /usr/bin/dund --listen
fi
start_uarts
touch /var/lock/subsys/bluetooth
echo
}
stop()
{
echo -n $"Shutting down $prog: "
killproc hcid
if [ -x /usr/sbin/sdpd ]; then
killproc sdpd
fi
if [ -x /usr/bin/rfcomm ]; then
/usr/bin/rfcomm release all
fi
if [ -x /bin/rfcomm ]; then
/bin/rfcomm release all
fi
if [ -x /usr/bin/dund ]; then
killproc dund
fi
stop_uarts
rm -f /var/lock/subsys/bluetooth
echo
}
[ -f /usr/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)
;;
status)
status hcid
status sdpd
status dund
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit 0
|