Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 7c79cc99c8021650b66112f4b25c4b3a > files > 5

dbus-1.4.1-3.1.mga1.src.rpm

--- dbus-1.4.1/bus/messagebus.in.initscripts	2010-10-05 14:50:54.000000000 -0300
+++ dbus-1.4.1/bus/messagebus.in	2011-01-17 18:27:27.000000000 -0200
@@ -2,7 +2,7 @@
 #
 # messagebus:   The D-BUS systemwide message bus
 #
-# chkconfig: 345 22 85
+# chkconfig: 23457 53 66
 # description:  This is a daemon which broadcasts notifications of system events \
 #               and other messages. See http://www.freedesktop.org/software/dbus/
 #
@@ -13,7 +13,8 @@
 # Provides: messagebus
 # Required-Start: $syslog $local_fs
 # Required-Stop: $syslog $local_fs
-# Default-Start: 2 3 4 5
+# Should-Start: network-auth
+# Default-Start: 2 3 4 5 7
 # Default-Stop: 0 1 6
 # Short-Description: The D-Bus systemwide message bus
 # Description: This is a daemon which broadcasts notifications of system 
@@ -33,19 +34,34 @@ servicename=messagebus
 RETVAL=0
 
 start() {
-    echo -n $"Starting system message bus: "
-    if [ -x @EXPANDED_BINDIR@/dbus-uuidgen ] ; then
-        @EXPANDED_BINDIR@/dbus-uuidgen --ensure
+    # are we running from systemd?
+    systemd_enabled=$([ -x /bin/systemctl ] && /bin/systemctl is-active dbus.service)
+    if [ "$systemd_enabled" = "active" ]; then
+            echo "Running from systemd"
+            return
+    fi
+    gprintf "Starting system message bus: "
+    if [ -x /usr/bin/dbus-uuidgen ] ; then
+        /usr/bin/dbus-uuidgen --ensure
     fi
 
     daemon --check $servicename $processname --system
     RETVAL=$?
+    countdown=10
+    until [ -e @DBUS_SYSTEM_SOCKET@ -o $countdown -eq 0 ]; do
+       sleep 1; let countdown=$countdown-1;
+    done
     echo
     [ $RETVAL -eq 0 ] && touch @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename
 }
 
 stop() {
-    echo -n $"Stopping system message bus: "
+    systemd_enabled=$( [ -x /bin/systemctl ] && /bin/systemctl is-active dbus.service)
+    if [ "$systemd_enabled" = "active" ]; then
+            echo "Running from systemd"
+            return
+    fi
+    gprintf "Stopping system message bus: "
 
     ## we don't want to kill all the per-user $processname, we want
     ## to use the pid file *only*; because we use the fake nonexistent 
@@ -76,17 +92,17 @@ case "$1" in
         start
         ;;
     condrestart)
-        if [ -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename ]; then
+        if [ -f /var/lock/subsys/$servicename ]; then
             stop
             start
         fi
         ;;
     reload)
-        echo "Message bus can't reload its configuration, you have to restart it"
+        gprintf "Message bus can't reload its configuration, you have to restart it\n"
         RETVAL=$?
         ;;
     *)
-        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
+        gprintf "Usage: %s {start|stop|status|restart|condrestart|reload}\n" "$0"
         ;;
 esac
 exit $RETVAL