| 1 |
#!/bin/sh
|
| 2 |
#
|
| 3 |
# bluetooth.sh: udev external RUN script
|
| 4 |
#
|
| 5 |
# Copyright:
|
| 6 |
# 2005-2006 Henrik Brix Andersen <brix@gentoo.org>
|
| 7 |
# 2007 Petteri Räty <betelgeuse@gentoo.org>
|
| 8 |
# 2008 Tiziano Müller <dev-zero@gentoo.org>
|
| 9 |
# Distributed under the terms of the GNU General Public License v2
|
| 10 |
|
| 11 |
script=/etc/init.d/bluetooth
|
| 12 |
|
| 13 |
# Find out where sysfs is mounted. Exit if not available
|
| 14 |
sysfs=`grep -F sysfs /proc/mounts | awk '{print $2}'`
|
| 15 |
if [ "$sysfs" = "" ]; then
|
| 16 |
echo "sysfs is required"
|
| 17 |
exit 1
|
| 18 |
fi
|
| 19 |
|
| 20 |
if [ ! -d $sysfs/class/bluetooth/hci[0-9]* -a ! -d $sysfs/bus/bluetooth/devices/hci[0-9]* ]; then
|
| 21 |
if $script --quiet status; then
|
| 22 |
IN_HOTPLUG=1 $script --quiet stop
|
| 23 |
fi
|
| 24 |
else
|
| 25 |
if ! $script --quiet status; then
|
| 26 |
IN_HOTPLUG=1 $script --quiet start
|
| 27 |
fi
|
| 28 |
fi
|