summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am2
-rw-r--r--scripts/Makefile.in2
-rwxr-xr-xscripts/bluetooth.rc.deb60
3 files changed, 62 insertions, 2 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 12f32c78..117c3186 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -15,4 +15,4 @@ redhat:
debian:
$(mkinstalldirs) $(DESTDIR)/etc/init.d
- $(INSTALL) -m 755 $(srcdir)/bluetooth.rc.rh $(DESTDIR)/etc/init.d/bluetooth
+ $(INSTALL) -m 755 $(srcdir)/bluetooth.rc.deb $(DESTDIR)/etc/init.d/bluetooth
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index d750a69c..ccc6f79f 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -220,7 +220,7 @@ redhat:
debian:
$(mkinstalldirs) $(DESTDIR)/etc/init.d
- $(INSTALL) -m 755 $(srcdir)/bluetooth.rc.rh $(DESTDIR)/etc/init.d/bluetooth
+ $(INSTALL) -m 755 $(srcdir)/bluetooth.rc.deb $(DESTDIR)/etc/init.d/bluetooth
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/scripts/bluetooth.rc.deb b/scripts/bluetooth.rc.deb
new file mode 100755
index 00000000..36892187
--- /dev/null
+++ b/scripts/bluetooth.rc.deb
@@ -0,0 +1,60 @@
+#! /bin/sh
+#
+# bluetooth Bluetooth subsystem starting and stopping
+#
+# Edd Dumbill <edd@usefulinc.com>
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/sbin/hcid
+HCIATTACH=/sbin/hciattach
+UART_CONF=/etc/bluetooth/uart
+NAME=hcid
+DESC=bluez-utils
+
+test -f $DAEMON || exit 0
+test -f $HCIATTACH || exit 0
+
+set -e
+
+start_uarts()
+{
+ [ -f $HCIATTACH -a -f $UART_CONF ] || return
+ grep -v '^#' $UART_CONF | while read i; do
+ $HCIATTACH $i
+ done
+}
+
+stop_uarts()
+{
+ killall hciattach > /dev/null 2>&1 || true
+}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: "
+ $DAEMON
+ echo "$NAME."
+ start_uarts || true
+ ;;
+ stop)
+ echo -n "Stopping $DESC: "
+ killall $NAME || true
+ echo "$NAME."
+ stop_uarts
+ ;;
+ restart|force-reload)
+ echo -n "Restarting $DESC: "
+ killall $NAME || true
+ sleep 1
+ $DAEMON
+ echo "$NAME."
+ ;;
+ *)
+ N=/etc/init.d/bluez-utils
+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $N {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0