gdm-{x,wayland}-session: don't start dbus-daemon if unneeded
Desktop sessions require a message bus to be present for IPC between
the various desktop services and applications.
GDM handles that by manually, unconditionally spawning an instance of
dbus-daemon at login time before starting the user session (from the
gdm-x-session and gdm-wayland-session launcher programs).
Newer versions of the kernel will support this message bus functionality
without needing to start dbus-daemon (via kdbus). The message bus is
initialized as part of the login process by a kernel interface exercised
from pam_systemd.
Since gdm-x-session and gdm-wayland-session spawn a dbus-daemon
unconditionally as part of session startup, users using kdbus end up with
two message buses per session. The extra bus gets in the way, confusing
programs and wasting resources.
This commit changes gdm-x-session and gdm-wayland-session to check for
DBUS_SESSION_BUS_ADDRESS in the environment, and if set, skip spawning
a dbus-daemon based session bus.
https://bugzilla.gnome.org/show_bug.cgi?id=750358