# -*- mode: shell-script; -*-

start on stopped bootmisc

pre-start script
    # deal with dbus not being present
    [ -x /usr/bin/dbus-daemon ] || stop
    mkdir -p /var/run/dbus /var/lib/dbus

    if [ ! -f /var/lib/dbus/machine-id ]; then
        echo 8564ef71cceddcecee092de2386d4386 > /var/lib/dbus/machine-id
    fi
end script

script
    rm -f /var/run/dbus/pid
    # Need to use || here since the script is run with -e
    /usr/bin/dbus-daemon --nofork --system || \
        /usr/sbin/reboot_dbus_if.sh $? $UPSTART_JOB
end script
