summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-05-07 17:51:28 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-05-07 17:51:28 +0000
commit63acfaaadfcf85aaba0fb63b9a600d89819cd47b (patch)
tree22e50491d0f1b6bcb4cd5b33c199378c94a78f01 /scripts
parent014f95443e8c29ffd6f28d7f3eac916b16f96b00 (diff)
Use one init.d script
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am8
-rwxr-xr-xscripts/bluetooth.rc.deb86
-rwxr-xr-xscripts/bluetooth.rc.rh90
3 files changed, 3 insertions, 181 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 8e05086b..6130c842 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -4,10 +4,8 @@
bin_SCRIPTS = bluepin
-EXTRA_DIST = bluepin bluetooth.rc.rh bluetooth.rc.deb create_dev
+EXTRA_DIST = bluepin bluetooth.init bluetooth.default create_dev
install-data-local:
- [ ! -f /etc/redhat-release -o ! -f /etc/mandrake-release ] || \
- $(INSTALL) -D -m 755 $(srcdir)/bluetooth.rc.rh $(DESTDIR)$(sysconfdir)/rc.d/init.d/bluetooth
- [ ! -f /etc/debian_version ] || \
- $(INSTALL) -D -m 755 $(srcdir)/bluetooth.rc.deb $(DESTDIR)$(sysconfdir)/init.d/bluetooth
+ $(INSTALL) -D -m 755 $(srcdir)/bluetooth.init $(DESTDIR)$(sysconfdir)/init.d/bluetooth
+ $(INSTALL) -D -m 644 $(srcdir)/bluetooth.default $(DESTDIR)$(sysconfdir)/default/bluetooth
diff --git a/scripts/bluetooth.rc.deb b/scripts/bluetooth.rc.deb
deleted file mode 100755
index 4c216c31..00000000
--- a/scripts/bluetooth.rc.deb
+++ /dev/null
@@ -1,86 +0,0 @@
-#! /bin/sh
-#
-# bluetooth Bluetooth subsystem starting and stopping
-#
-
-NAME=bluetooth
-DESC="Bluetooth subsystem"
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-HCID=/usr/sbin/hcid
-HCID_CONF=/etc/bluetooth/hcid.conf
-HCIATTACH=/usr/sbin/hciattach
-UART_CONF=/etc/bluetooth/uart
-SDPD=/usr/sbin/sdpd
-RFCOMM=/usr/bin/rfcomm
-RFCOMM_CONF=/etc/bluetooth/rfcomm.conf
-
-set -e
-
-start_uarts()
-{
- [ -x $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:"
- if [ -x $HCID -a -f $HCID_CONF ] ; then
- $HCID -f $HCID_CONF
- echo -n " hcid"
- fi
- if [ -x $SDPD ] ; then
- $SDPD
- echo -n " sdpd"
- fi
- if [ -x $RFCOMM -a -f $RFCOMM_CONF ] ; then
- $RFCOMM -f $RFCOMM_CONF bind all
- echo -n " rfcomm"
- fi
- echo "."
- start_uarts || true
- ;;
- stop)
- echo -n "Stopping $DESC:"
- if [ -x $RFCOMM ] ; then
- echo -n " rfcomm"
- $RFCOMM release all
- fi
- echo -n " sdpd"
- killall $SDPD > /dev/null 2>&1 || true
- echo -n " hcid"
- killall $HCID > /dev/null 2>&1 || true
- echo "."
- stop_uarts
- ;;
- restart|force-reload)
- echo -n "Restarting $DESC:"
- echo -n " hcid"
- killall $HCID > /dev/null 2>&1 || true
- sleep 1
- if [ -x $HCID -a -f $HCID_CONF ] ; then
- $HCID -f $HCID_CONF
- fi
- echo -n " sdpd"
- killall $SDPD > /dev/null 2>&1 || true
- sleep 1
- if [ -x $SDPD ] ; then
- $SDPD
- fi
- echo "."
- ;;
- *)
- N=/etc/init.d/bluetooth
- echo "Usage: $N {start|stop|restart|force-reload}" >&2
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/scripts/bluetooth.rc.rh b/scripts/bluetooth.rc.rh
deleted file mode 100755
index c8560946..00000000
--- a/scripts/bluetooth.rc.rh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/sh
-#
-# bluetooth Bluetooth subsystem starting and stopping
-#
-# chkconfig: 345 25 90
-# description: Bluetooth subsystem
-#
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-# Source Bluetooth configuration.
-#. /etc/sysconfig/bluetooth
-
-prog="Bluetooth"
-
-UART_CONF="/etc/bluetooth/uart"
-
-start_uarts()
-{
- [ -f /sbin/hciattach -a -f $UART_CONF ] || return
- grep -v '^#' $UART_CONF | while read i; do
- /sbin/hciattach $i
- done
-}
-
-stop_uarts()
-{
- killproc hciattach > /dev/null 2>&1
-}
-
-start()
-{
- echo -n $"Starting $prog: "
- daemon /sbin/hcid
-
- if [ -x /usr/sbin/sdpd ]; then
- daemon /usr/sbin/sdpd
- fi
-
- if [ -x /bin/rfcomm -a -f /etc/bluetooth/rfcomm.conf ]; then
- /bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
- fi
-
- start_uarts
- touch /var/lock/subsys/bluetooth
- echo
-}
-
-stop()
-{
- echo -n $"Shutting down $prog: "
- killproc hcid
-
- if [ -x /usr/sbin/sdpd ]; then
- killproc sdpd
- fi
-
- if [ -x /bin/rfcomm ]; then
- /bin/rfcomm release all
- fi
-
- stop_uarts
- rm -f /var/lock/subsys/bluetooth
- echo
-}
-
-[ -f /sbin/hcid ] || exit 0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart|reload)
- stop
- start
- ;;
- condrestart)
- [ -e /var/lock/subsys/bluetooth ] && (stop; start)
- ;;
- *)
- echo $"Usage: $0 {start|stop|restart|reload|condrestart}"
- exit 1
-esac
-
-exit 0