#!/bin/sh


# This script should be used to start Liferea
# to ensure a running DBUS session.

# default dist dir to <install root>/bin
dist_bin=/usr/bin

# autodetect alternate location when $0 provides information
if [ "`basename $0`" != "$0" ]; then
       dist_bin=`dirname $0`
fi

params="$@"

mozdir="/usr/lib/xulrunner-`xulrunner-1.9.2 --gre-version`"
if [ "$LD_LIBRARY_PATH" = "" ]; then
	LD_LIBRARY_PATH=${mozdir}
else
	LD_LIBRARY_PATH=${mozdir}:$LD_LIBRARY_PATH
fi
export LD_LIBRARY_PATH

if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
	eval `dbus-launch`
	export DBUS_SESSION_BUS_ADDRESS
fi

exec $DEBUGGER "$dist_bin/liferea-bin" $params
