diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2016-09-22 04:43:33 -0700 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2016-09-26 12:58:27 +0200 |
commit | b6f6f61bce3a2f5cac51be1b435566a81754fb2d (patch) | |
tree | 32af272c666f6ca48dfb6ff75fc829905271511e | |
parent | f2c9838e97f8b7e732dc53ce986daf3f2d9bac66 (diff) |
dbus-session.sh: avoid using dbus-launch
dbus-launch is considered deprecated because of the X11 dependency.
See https://lists.debian.org/debian-devel/2016/08/msg00554.html "Mass bug
filing: use and misuse of dbus-launch (dbus-x11)"
The script still needs to start the D-Bus daemon when used in the nightly
testing, so the code now does it as in
https://github.com/flatpak/flatpak/commit/6cc8062cfb3f9410d54a27e7ccca77c103e441e8
syncevo-http-server still has some usage of dbus-launch left, but that's
strictly for systems which don't have the more modern D-Bus.
-rwxr-xr-x | test/dbus-session.sh | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/test/dbus-session.sh b/test/dbus-session.sh index 4530eb90..da7d0b3c 100755 --- a/test/dbus-session.sh +++ b/test/dbus-session.sh @@ -2,14 +2,30 @@ # # Wrapper script which starts a new D-Bus session before # running a program and kills the D-Bus daemon when done. +# This script is meant for a very specific environment +# (SyncEvolution nightly testing). +# +# dbus-run-session (available since dbus 1.8) should be used instead +# for normal use cases. unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID XDG_RUNTIME_DIR # Ensure that we have a unique, empty XDG_RUNTIME_DIR. export XDG_RUNTIME_DIR=`mktemp -d` -# start D-Bus session -eval `dbus-launch` +# Start D-Bus session. We want to use the real D-Bus configuration +# of the host here, because want to use some of its services (GNOME keyring, +# GNOME/Ubuntu Online Accounts, etc.). +for i in /etc/dbus-1/session.conf /usr/share/dbus-1/session.conf; do + if [ -e $i ]; then + DBUS_CONFIG=$i + break + fi +done +dbus-daemon --fork --config-file=$DBUS_CONFIG --print-address=3 --print-pid=4 \ + 3>$XDG_RUNTIME_DIR/dbus-bus-address 4>$XDG_RUNTIME_DIR/dbus-bus-pid +DBUS_SESSION_BUS_PID="$(cat $XDG_RUNTIME_DIR/dbus-bus-pid)" +DBUS_SESSION_BUS_ADDRESS="$(cat $XDG_RUNTIME_DIR/dbus-bus-address)" export DBUS_SESSION_BUS_ADDRESS if [ "$DBUS_SESSION_SH_SYSTEM_BUS" ]; then @@ -17,7 +33,10 @@ if [ "$DBUS_SESSION_SH_SYSTEM_BUS" ]; then DBUS_SYSTEM_BUS_PID=$DBUS_SESSION_BUS_PID DBUS_SYSTEM_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS export DBUS_SYSTEM_BUS_ADDRESS - eval `dbus-launch` + dbus-daemon --fork --config-file=$DBUS_CONFIG --print-address=3 --print-pid=4 \ + 3>$XDG_RUNTIME_DIR/dbus-2-bus-address 4>$XDG_RUNTIME_DIR/dbus-2-bus-pid + DBUS_SESSION_BUS_PID="$(cat $XDG_RUNTIME_DIR/dbus-2-bus-pid)" + DBUS_SESSION_BUS_ADDRESS="$(cat $XDG_RUNTIME_DIR/dbus-2-bus-address)" fi # Ensure that XDG dirs exist. Otherwise some daemons do not work correctly. |