@@ -24,6 +24,9 @@ cleanup()
24 if [ -n "$INIT_PID" ]; then
24 if [ -n "$INIT_PID" ]; then
25 kill "$INIT_PID"
25 kill "$INIT_PID"
27+ if [ -n "$DBUS_PID" ]; then
27 if [ -n "$CMD_PID" ]; then
30 if [ -n "$CMD_PID" ]; then
28 kill "$CMD_PID"
31 kill "$CMD_PID"
@@ -32,8 +35,6 @@ cleanup()
33set_greeter_var()
36set_greeter_var()
35− # Only use this after upstart has been started, otherwise multiple dbus
36− # daemons are spawned.
37 export "$1=$2"
38 export "$1=$2"
38 gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "{'$1': '$2'}"
39 gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "{'$1': '$2'}"
39 if [ -n "$INIT_PID" ]; then
40 if [ -n "$INIT_PID" ]; then
@@ -41,6 +42,14 @@ set_greeter_var()
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")
44SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
53SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
45rm -f $SUB_SOCKET # clear socket in case we were hard shut down
54rm -f $SUB_SOCKET # clear socket in case we were hard shut down
@@ -54,6 +63,11 @@ fi
54# will start.
63# will start.
55export DESKTOP_SESSION=ubuntu-touch
64export DESKTOP_SESSION=ubuntu-touch
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
57# Normal unity8 sessions are entirely driven by Upstart. But greeters
71# Normal unity8 sessions are entirely driven by Upstart. But greeters
58# are special. They need access to the file descriptors that lightdm
72# are special. They need access to the file descriptors that lightdm
59# creates for them and don't want to start all the services that a normal
73# creates for them and don't want to start all the services that a normal
@@ -64,14 +78,6 @@ INIT_PID=$!
64while [ ! -e "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session" ]; do sleep 0.1; done
78while [ ! -e "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session" ]; do sleep 0.1; done
65export UPSTART_SESSION=$(/sbin/initctl list-sessions | grep "^$INIT_PID " | cut -d' ' -f2)
79export UPSTART_SESSION=$(/sbin/initctl list-sessions | grep "^$INIT_PID " | cut -d' ' -f2)
67−/sbin/initctl start dbus
68−export DBUS_SESSION_BUS_ADDRESS="$(/sbin/initctl get-env DBUS_SESSION_BUS_ADDRESS)"
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
75# Start any pre-greeter tasks if needed (like wizard)
81# Start any pre-greeter tasks if needed (like wizard)
76/sbin/initctl emit unity8-greeter-starting
82/sbin/initctl emit unity8-greeter-starting