]> git.pld-linux.org Git - packages/bluez-utils.git/blobdiff - bluez-utils.init
- obsolete
[packages/bluez-utils.git] / bluez-utils.init
index a2982242cfdf55dee09cfa036fe6a283c3cb6c1a..aae15d9a1d796061ea44181ddcac50a07a1acc38 100644 (file)
@@ -2,7 +2,7 @@
 #
 # bluetooth    Bluetooth subsystem starting and stopping
 #
-# chkconfig:    345  25 90
+# chkconfig:   345 25 90
 #
 # description: Bluetooth subsystem
 #
@@ -16,9 +16,10 @@ UART_CONF="/etc/bluetooth/uart"
 [ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
 
 if [ "$UART_CONF" != "no" -a ! -f "$UART_CONF" ]; then
-    UART_CONF="no"
+       UART_CONF="no"
 fi
 
+RETVAL=0
 # See how we were called.
 case "$1" in
   start)
@@ -27,57 +28,55 @@ case "$1" in
                # show "Starting %s service" Bluetooth
                msg_starting Bluetooth
                if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
-                   grep -v '^#' $UART_CONF | while read i; do
-                       /usr/sbin/hciattach $i
-                   done
+                       grep -v '^#' $UART_CONF | while read i; do
+                               /usr/sbin/hciattach $i
+                       done
                fi
                daemon /usr/sbin/hcid -f /etc/bluetooth/hcid.conf
                RETVAL=$?
                if [ $RETVAL -ne 0 ]; then
-                   killproc hciattach >/dev/null 2>&1
+                       killproc hciattach >/dev/null 2>&1
                elif [ -x /usr/sbin/sdpd ]; then
-                   msg_starting "Bluetooth SDP"
-                   daemon /usr/sbin/sdpd
-                   RETVAL=$?
-                   if [ $RETVAL -ne 0 ]; then
-                       killproc hcid >/dev/null 2>&1
-                       if [ "$UART_CONF" != "no" ]; then
-                           killproc hciattach >/dev/null 2>&1
+                       msg_starting "Bluetooth SDP"
+                       daemon /usr/sbin/sdpd
+                       RETVAL=$?
+                       if [ $RETVAL -ne 0 ]; then
+                               killproc hcid >/dev/null 2>&1
+                               if [ "$UART_CONF" != "no" ]; then
+                                       killproc hciattach >/dev/null 2>&1
+                               fi
                        fi
-                   fi
                fi
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bluetooth
        else
                # show "%s service is already running." Bluetooth
                msg_already_running Bluetooth
-               exit 1
        fi
-        ;;
+       ;;
   stop)
        if [ -f /var/lock/subsys/bluetooth ]; then
                if [ -x /usr/sbin/sdpd ]; then
-                   msg_stopping "Bluetooth SDP"
-                   killproc sdpd
+                       msg_stopping "Bluetooth SDP"
+                       killproc sdpd
                fi
                # show "Stopping %s service" Bluetooth
                msg_stopping Bluetooth
                killproc hcid
-               RETVAL=$?
                if [ "$UART_CONF" != "no" ]; then
-                   killproc hciattach >/dev/null 2>&1
+                       killproc hciattach >/dev/null 2>&1
                fi
                rm -f /var/lock/subsys/bluetooth
        else
                # show "%s service is not running." Bluetooth
                msg_not_running Bluetooth
-               exit 1
        fi      
        ;;
   restart)
        $0 stop
        $0 start
+       exit $?
        ;;
-  reload)
+  reload|force-reload)
        if [ -f /var/lock/subsys/bluetooth ]; then
                # show "Reload %s service" Bluetooth
                msg_reloading Bluetooth
@@ -85,22 +84,18 @@ case "$1" in
                RETVAL=$?
        else
                # show "%s service is not running." Bluetooth
-               msg_not_running Bluetooth
-               RETVAL=1
+               msg_not_running Bluetooth >&2
+               exit 7
        fi
        ;;
-  force-reload)
-       # if program allows reloading without stopping
-       $0 reload
-       ;;
   status)
        status hcid
-       RETVAL=$?
-        ;;
+       exit $?
+       ;;
   *)
-        # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0
-       msg_usage "$0 {start|stop|status|restart|reload|force-reload}"
-        exit 1
+       # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       exit 3
 esac
 
 exit $RETVAL
This page took 0.035484 seconds and 4 git commands to generate.