#! /bin/sh
#
# An Eclipse startup script
#

ECLIPSE_HOME=/usr/lib/eclipse
[ -n "$MOZILLA_FIVE_HOME" ] || MOZILLA_FIVE_HOME=/usr/lib/mozilla

if [ -f /etc/eclipse.conf ]; then
    . /etc/eclipse.conf
fi
if [ -f "$HOME"/.eclipserc ]; then
    . "$HOME"/.eclipserc
fi

timestamp_file="$HOME"/.eclipse/org.eclipse.platform_3.0.1/configuration/org.eclipse.osgi/.bundledata
if [ "$ECLIPSE_HOME"/plugins -nt "$timestamp_file" -o \
     "$ECLIPSE_HOME"/features -nt "$timestamp_file" ]
then
    ECLIPSE_ARGS="$ECLIPSE_ARGS -clean"
fi

if [ -n "$JAVA_BIN" ]; then
    ECLIPSE_ARGS="-vm $JAVA_BIN $ECLIPSE_ARGS"
fi
if [ -n "$ECLIPSE_VMARGS" ]; then
    ECLIPSE_ARGS="$ECLIPSE_ARGS -vmargs $ECLIPSE_VMARGS"
fi

export MOZILLA_FIVE_HOME

exec "$ECLIPSE_HOME"/eclipse $ECLIPSE_ARGS
