156 lines
3.7 KiB
Plaintext
156 lines
3.7 KiB
Plaintext
|
#! /bin/sh
|
||
|
# Copyright (c) 1995-2003 SuSE Linux AG, Nuernberg, Germany.
|
||
|
# All rights reserved.
|
||
|
#
|
||
|
# Author: Stefan Behlert <feedback@suse.de>, based on
|
||
|
# proposals and templates from Marcel Holtmann
|
||
|
# and Stefan Reinauer <feedback@suse.de>
|
||
|
#
|
||
|
# /etc/init.d/bluetooth
|
||
|
# and its symbolic link
|
||
|
# /(usr/)sbin/rcbluetooth
|
||
|
#
|
||
|
### BEGIN INIT INFO
|
||
|
# Provides: bluetooth
|
||
|
# Required-Start: $syslog $remote_fs
|
||
|
# Should-Start: dbus
|
||
|
# Required-Stop: $syslog $remote_fs
|
||
|
# Should-Stop: $null
|
||
|
# Default-Start: 3 5
|
||
|
# Default-Stop: 0 1 2 6
|
||
|
# Short-Description: Bluetooth protocol stack services
|
||
|
# Description: Bluetooth protocol stack services
|
||
|
### END INIT INFO
|
||
|
#
|
||
|
|
||
|
DAEMON_EXEC=/usr/sbin/bluetoothd
|
||
|
HID2HCI_EXEC=/usr/sbin/hid2hci
|
||
|
RFCOMM_EXEC=/usr/bin/rfcomm
|
||
|
PAND_EXEC=/usr/sbin/pand
|
||
|
DUND_EXEC=/usr/sbin/dund
|
||
|
DAEMON_ENABLE=true
|
||
|
HID2HCI_ENABLE=false
|
||
|
RFCOMM_ENABLE=true
|
||
|
PAND_ENABLE=false
|
||
|
DUND_ENABLE=false
|
||
|
|
||
|
# Check for existence of needed config file and read it
|
||
|
BLUETOOTH_CONFIG=/etc/sysconfig/bluetooth
|
||
|
test -r $BLUETOOTH_CONFIG || exit 6
|
||
|
. $BLUETOOTH_CONFIG
|
||
|
|
||
|
. /etc/rc.status
|
||
|
|
||
|
# Reset status of this service
|
||
|
rc_reset
|
||
|
|
||
|
# check_service "hcid" "$HCI_START" "$HCI_DAEMON"
|
||
|
function check_service()
|
||
|
{
|
||
|
if [ "$2" = "yes" ]; then
|
||
|
printf "%10s (%s)" "$1" "activated"
|
||
|
/sbin/checkproc $3 || rc_failed 7
|
||
|
rc_status -v
|
||
|
else
|
||
|
printf "%10s" "$1"
|
||
|
/sbin/checkproc $3 || rc_failed 3
|
||
|
rc_status -v
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
case "$1" in
|
||
|
start)
|
||
|
echo -n "Starting bluetooth: "
|
||
|
|
||
|
if [ $DAEMON_ENABLE = "yes" ] && [ -x "$DAEMON_EXEC" ] ; then
|
||
|
/sbin/checkproc $DAEMON_EXEC || $DAEMON_EXEC $DAEMON_ARGS
|
||
|
echo -n " bluetoothd"
|
||
|
fi
|
||
|
if [ $HID2HCI_ENABLE != "no" ] && [ -x "$HID2HCI_EXEC" ] ; then
|
||
|
$HID2HCI_EXEC $HID2HCI_ARGS > /dev/null 2>&1
|
||
|
echo -n " hid2hci"
|
||
|
fi
|
||
|
if [ $RFCOMM_ENABLE = "yes" ] && [ -x "$RFCOMM_EXEC" ] ; then
|
||
|
$RFCOMM_EXEC $RFCOMM_ARGS
|
||
|
echo -n " rfcomm"
|
||
|
fi
|
||
|
if [ $PAND_ENABLE = "yes" ] && [ -x "$PAND_EXEC" ] ; then
|
||
|
/sbin/checkproc $PAND_EXEC || $PAND_EXEC $PAND_ARGS
|
||
|
echo -n " pand"
|
||
|
fi
|
||
|
if [ $DUND_ENABLE = "yes" ] && [ -x "$DUND_EXEC" ] ; then
|
||
|
/sbin/checkproc $DUND_EXEC || $DUND_EXEC $DUND_ARGS
|
||
|
echo -n " dund"
|
||
|
fi
|
||
|
|
||
|
rc_status -v
|
||
|
;;
|
||
|
stop)
|
||
|
echo -n "Shutting down bluetooth ("
|
||
|
|
||
|
if [ -x $DUND_EXEC ]; then
|
||
|
/sbin/killproc -TERM $DUND_EXEC && echo -n " dund"
|
||
|
fi
|
||
|
if [ -x $PAND_EXEC ]; then
|
||
|
/sbin/killproc -TERM $PAND_EXEC && echo -n " pand"
|
||
|
fi
|
||
|
if [ -x $RFCOMM_EXEC ]; then
|
||
|
/sbin/killproc -TERM $RFCOMM_EXEC && echo -n " rfcomm"
|
||
|
fi
|
||
|
if [ -x $DAEMON_EXEC ]; then
|
||
|
/sbin/killproc -TERM $DAEMON_EXEC && echo -n " bluetoothd"
|
||
|
fi
|
||
|
echo -n ")"
|
||
|
rc_status -v
|
||
|
;;
|
||
|
try-restart)
|
||
|
$0 status >/dev/null && $0 restart
|
||
|
rc_status
|
||
|
;;
|
||
|
restart)
|
||
|
$0 stop
|
||
|
$0 start
|
||
|
rc_status
|
||
|
;;
|
||
|
force-reload)
|
||
|
echo -n "Reload service BLUETOOTH "
|
||
|
$0 stop && $0 start
|
||
|
rc_status
|
||
|
;;
|
||
|
reload)
|
||
|
rc_failed 3
|
||
|
rc_status -v
|
||
|
;;
|
||
|
status)
|
||
|
echo -n "Checking service bluetooth "
|
||
|
if [ $START_SERVICES = 'no' ] ; then
|
||
|
echo "(disabled) :"
|
||
|
else
|
||
|
echo "(enabled) :"
|
||
|
fi;
|
||
|
check_service "bluetoothd" "$DAEMON_ENABLE" "$DAEMON_EXEC"
|
||
|
check_service "hid2hci" "$HID2HCI_ENABLE" "$HID2HCI_EXEC"
|
||
|
check_service "rfcomm" "$RFCOMM_ENABLE" "$RFCOMM_EXEC"
|
||
|
check_service "pand" "$PAND_ENABLE" "$PAND_EXEC"
|
||
|
check_service "dund" "$DUND_ENABLE" "$DUND_EXEC"
|
||
|
if [ $START_SERVICES = 'no' ] ; then
|
||
|
rc_failed 3
|
||
|
else
|
||
|
rc_failed 0
|
||
|
fi;
|
||
|
|
||
|
;;
|
||
|
probe)
|
||
|
## Optional: Probe for the necessity of a reload, print out the
|
||
|
## argument to this init script which is required for a reload.
|
||
|
## Note: probe is not (yet) part of LSB (as of 1.2)
|
||
|
# test /etc/FOO/FOO.conf -nt /var/run/FOO.pid && echo reload
|
||
|
;;
|
||
|
*)
|
||
|
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
rc_exit
|
||
|
|