@@ -24,6 +24,9 @@ cleanup()
2424 if [ -n "$INIT_PID" ]; then
2525 kill "$INIT_PID"
2626 fi
27+ if [ -n "$DBUS_PID" ]; then
28+ kill "$DBUS_PID"
29+ fi
2730 if [ -n "$CMD_PID" ]; then
2831 kill "$CMD_PID"
2932 fi
@@ -32,8 +35,6 @@ cleanup()
3235
3336set_greeter_var()
3437{
35− # Only use this after upstart has been started, otherwise multiple dbus
36− # daemons are spawned.
3738 export "$1=$2"
3839 gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "{'$1': '$2'}"
3940 if [ -n "$INIT_PID" ]; then
@@ -41,6 +42,14 @@ set_greeter_var()
4142 fi
4243}
4344
45+# Start dbus if it hasn't already been started for us (such as on the Desktop
46+# images by dbus-launch). We don't want to use dbus-launch ourselves because
47+# we don't want dbus-x11 on the Touch images.
48+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
49+ export DBUS_SESSION_BUS_ADDRESS=unix:abstract=$(mktemp -u /tmp/dbus-XXXXXXXXXX)
50+ DBUS_PID=$(dbus-daemon --fork --session --print-pid --address="$DBUS_SESSION_BUS_ADDRESS")
51+fi
52+
4453SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
4554rm -f $SUB_SOCKET # clear socket in case we were hard shut down
4655
@@ -54,6 +63,11 @@ fi
5463# will start.
5564export DESKTOP_SESSION=ubuntu-touch
5665
66+# We disable ofono using pulse. It causes problems with racing with the user's
67+# pulse. We need to come up with a better long-term fix for this, because we
68+# eventually need the greeter to play ringtones for users that aren't logged in.
69+set_greeter_var PA_DISABLED 1
70+
5771# Normal unity8 sessions are entirely driven by Upstart. But greeters
5872# are special. They need access to the file descriptors that lightdm
5973# creates for them and don't want to start all the services that a normal
@@ -64,14 +78,6 @@ INIT_PID=$!
6478while [ ! -e "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session" ]; do sleep 0.1; done
6579export UPSTART_SESSION=$(/sbin/initctl list-sessions | grep "^$INIT_PID " | cut -d' ' -f2)
6680
67−/sbin/initctl start dbus
68−export DBUS_SESSION_BUS_ADDRESS="$(/sbin/initctl get-env DBUS_SESSION_BUS_ADDRESS)"
69−
70−# We disable ofono using pulse. It causes problems with racing with the user's
71−# pulse. We need to come up with a better long-term fix for this, because we
72−# eventually need the greeter to play ringtones for users that aren't logged in.
73−set_greeter_var PA_DISABLED 1
74−
7581# Start any pre-greeter tasks if needed (like wizard)
7682/sbin/initctl emit unity8-greeter-starting
7783