Files
bpfire/src/initscripts/packages/bluetooth
2017-02-24 12:12:52 +01:00

69 lines
1.7 KiB
Bash

#!/bin/sh
# Begin $rc_base/init.d/bluetooth
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
. /etc/sysconfig/rc
. $rc_functions
eval $(/usr/local/bin/readhash /var/ipfire/bluetooth/settings)
case "$1" in
start)
boot_mesg "Starting Bluetooth daemon..."
loadproc /usr/sbin/hcid
sleep 1
if [ "$PASSKEY_AGENT" == "on" ]; then
boot_mesg "Starting Bluetooth passkey-agent..."
loadproc /usr/bin/passkey-agent --default $PWD &
fi
if [ "$RFCOMM0_BIND" == "on" ]; then
boot_mesg "Bind rfcomm0 to cellphone/modem ${RFCOMM0_DEVICE//-/:}/$RFCOMM0_CHANNEL ..."
rfcomm bind /dev/rfcomm0 ${RFCOMM0_DEVICE//-/:} $RFCOMM0_CHANNEL
evaluate_retval
fi
if [ "$RFCOMM1_BIND" == "on" ]; then
boot_mesg "Bind rfcomm1 to cellphone/modem ${RFCOMM1_DEVICE//-/:}/${RFCOMM1_CHANNEL} ..."
rfcomm bind /dev/rfcomm1 ${RFCOMM1_DEVICE//-/:} $RFCOMM1_CHANNEL
evaluate_retval
fi
exit 0;
;;
stop)
if [ -e /dev/rfcomm0 ]; then
boot_mesg "Release rfcomm0..."
rfcomm release rfcomm0
fi
if [ -e /dev/rfcomm1 ]; then
boot_mesg "Release rfcomm1..."
rfcomm release rfcomm1
fi
boot_mesg "Stopping Bluetooth daemon..."
killproc /usr/sbin/hcid
exit 0;
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
statusproc /usr/sbin/hcid
statusproc /usr/bin/passkey-agent
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
# End $rc_base/init.d/bluetooth