| # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "D-Bus message bus daemon" |
| author "chromium-os-dev@chromium.org" |
| |
| # Stop conditions for this job deliberately omitted: D-Bus clients |
| # routinely terminate with crashes when dbus-daemon terminates before |
| # them. Ordering process termination with upstart is hard, so we |
| # simply leave dbus-daemon running to ensure the rest of the system |
| # can shut down cleanly. |
| start on starting boot-services |
| respawn |
| |
| # Sets up the D-Bus environment. |
| pre-start script |
| mkdir -p /var/run/dbus |
| chown messagebus:messagebus /var/run/dbus |
| mkdir -p /var/lib/dbus |
| |
| # The following ensures that there is a valid machine-id for dbus and |
| # that it's regenerated on every boot to avoid potential privacy |
| # issues. |
| rm -f /var/lib/dbus/machine-id |
| dbus-uuidgen --ensure |
| end script |
| |
| expect fork |
| exec dbus-daemon --system --fork |
| |
| # Instruct Upstart to establish a connection to the System Bus so that |
| # dbus-send can be used to communicate with it. |
| post-start exec kill -USR1 1 |
| |
| # The post-stop script will clean up after d-dbus. It's better to put this |
| # here rather than in pre-start since post-stop is always guaranteed to run |
| # while pre-start can exit pre-maturely. |
| post-stop script |
| rm -rf /var/run/dbus |
| end script |