#!/bin/sh
#
# Start the dbus messaging system
#
# runlevels: geexbox, debug


DAEMON=/usr/bin/dbus-daemon

test -x $DAEMON || exit 0

UUIDGEN=/usr/bin/dbus-uuidgen
UUIDGEN_OPTS=--ensure
NAME=dbus
DAEMONUSER=root
PIDDIR=/var/run/dbus
PIDFILE=$PIDDIR/pid
DESC="system message bus"
EVENTDIR=/etc/dbus-1/event.d

test -x $DAEMON || exit 0

if [ ! -d $PIDDIR ]; then
  mkdir -p $PIDDIR
fi

create_machineid() {
  # Create machine-id file
  if [ -x $UUIDGEN ]; then
    $UUIDGEN $UUIDGEN_OPTS=$PIDDIR/machineid
  fi
}

create_machineid

echo "Starting $DESC" "$NAME"
$DAEMON --system

exit 0
