#!/bin/sh

SCRIPT_PATH=`dirname $0`
SCRIPT_PATH=`cd $SCRIPT_PATH; pwd`

if [ "x$SCRIPT_PATH" = "x/home/build/tmp/gnome-do-0.4.0.1/Do/bin/Debug" ] ||
   [ "x$SCRIPT_PATH" = "x/home/build/tmp/gnome-do-0.4.0.1/Do" ] ; then
    echo "*** Running uninstalled ***"
    GNOME_DO_EXE="/home/build/tmp/gnome-do-0.4.0.1/Do/bin/Debug/Do.exe"
else
    GNOME_DO_EXE="/usr/lib/gnome-do/Do.exe"
fi

# Send the dbus Summon signal right away for fastest response if
# Do is already running.
dbus-send --session --type=method_call --dest='org.gnome.Do' \
	'/org/gnome/Do/Controller' 'org.gnome.Do.Controller.Summon'

# If Do is not running, run it.
if pgrep -u "`id -un`" '^gnome-do$' >/dev/null; then
	exec mono "$GNOME_DO_EXE" "$@"
fi
