#!/bin/sh

# implement the bits of the old oss-af-init/af-defines.sh that we need:
DBUS_ENV_SH=/tmp/session_bus_address;

# apparently the environment can be hyper-scrubbed:
if [ x$USER = x ]; then USER=$(id -un); fi;

if [ x$USER = xroot ];
then
    DBUS_ENV_SH=$DBUS_ENV_SH.user;
else
    DBUS_ENV_SH=$DBUS_ENV_SH.$USER;
fi;

if [ -r "$DBUS_ENV_SH" ];
then
    . "$DBUS_ENV_SH";
fi;

# if we couldn't patch up the environment above, hope that our caller already
# patched it up for us, or that we're running in user's dbus session anyway:
/usr/bin/mc-await-disconnect;

exit 0;
