summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMax Krasnyansky <maxk@qualcomm.com>2002-05-03 22:15:02 +0000
committerMax Krasnyansky <maxk@qualcomm.com>2002-05-03 22:15:02 +0000
commit79095069d348e61dc26c6fa6e35428c5d90887ff (patch)
tree0a3ba141d9fea1d4a19e77d9a6522a641997133e /scripts
parent095e2ef25275e4682b9c1a51d6f9f233f0360d18 (diff)
downloadbluez-79095069d348e61dc26c6fa6e35428c5d90887ff.tar.gz
Bluetooth rc script for Debian distro.
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 12f32c78d..117c31866 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 d750a69c8..ccc6f79f5 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 000000000..36892187c
--- /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