Add IgnoreOnIsolate=yes to dbus.service
[platform/upstream/dbus.git] / tools / run-with-tmp-session-bus.sh
1 #! /bin/sh
2
3 SCRIPTNAME="$0"
4 WRAPPED_SCRIPT="$1"
5 shift
6
7 CONFIG_FILE=./tmp-session-bus.$$.conf
8
9 die ()
10 {
11     echo "$SCRIPTNAME: $*" >&2
12     rm -f "$CONFIG_FILE"
13     exit 1
14 }
15
16 if test -z "$DBUS_TOP_BUILDDIR" ; then
17     die "Must set DBUS_TOP_BUILDDIR"
18 fi
19
20 SERVICE_DIR="$DBUS_TOP_BUILDDIR/test/data/valid-service-files"
21 ESCAPED_SERVICE_DIR=`echo $SERVICE_DIR | sed -e 's/\//\\\\\\//g'`
22 echo "escaped service dir is: $ESCAPED_SERVICE_DIR" >&2
23
24 if test -z "$SOURCE_CONFIG_FILE"; then
25     SOURCE_CONFIG_FILE="$DBUS_TOP_BUILDDIR/bus/session.conf";
26 fi
27 ## create a configuration file based on the standard session.conf
28 cat $SOURCE_CONFIG_FILE |  \
29     sed -e 's/<standard_session_servicedirs.*$/<servicedir>'$ESCAPED_SERVICE_DIR'<\/servicedir>/g' |  \
30     sed -e 's/<include.*$//g'                \
31   > $CONFIG_FILE
32
33 echo "Created configuration file $CONFIG_FILE" >&2
34
35 if ! test -e "$DBUS_TOP_BUILDDIR"/bus/dbus-daemon ; then
36     die "$DBUS_TOP_BUILDDIR/bus/dbus-daemon does not exist"
37 fi
38
39 PATH="$DBUS_TOP_BUILDDIR"/bus:$PATH
40 export PATH
41
42 ## the libtool script found by the path search should already do this, but
43 LD_LIBRARY_PATH=$DBUS_TOP_BUILDDIR/dbus/.libs:$LD_LIBRARY_PATH
44 export LD_LIBRARY_PATH
45 unset DBUS_SESSION_BUS_ADDRESS
46 unset DBUS_SESSION_BUS_PID
47
48 $DBUS_TOP_BUILDDIR/tools/dbus-run-session \
49     --config-file="$CONFIG_FILE" \
50     --dbus-daemon="$DBUS_TOP_BUILDDIR/bus/dbus-daemon" \
51     -- \
52     "$WRAPPED_SCRIPT" "$@"
53 error=$?
54
55 # clean up
56 rm -f "$CONFIG_FILE"
57 exit $error