#!/bin/sh

# Location of the Opera binary
OPERA=/usr/lib/opera/5.05_tp1/opera-shared

if test ! -e $OPERA; then
    echo "The Opera binary is not located at \"$OPERA\"."
    echo "Please modify the wrapper script at \"$0\"."
    exit 1
elif test ! -x $OPERA; then
    echo "You do not have execute rights on \"$OPERA\", please ask the sysadmin to chmod +x it."
    exit 1
fi

# Opera enviroment
if test "$OPERA_DIR" = '' ; then 
  if test -d /usr/share/opera ; then 
    OPERA_DIR=/usr/share/opera
  else
    echo "OPERA_DIR unset and not in default location (/usr/share/opera)"
    exit 1
  fi
fi

# Opera Plug-in enviroment, Add more plugin search paths here
# If OPERA_PLUGIN_PATH is set NPX_PLUGIN_PATH will be ignored

for DIR in \
    /usr/lib/opera/plugins \
    /usr/local/Acrobat4/Browsers/intellinux \
    /usr/java/jre1.3.1/plugin/i386/ns4 \
    /usr/lib/RealPlayer8/Plugins \
    /usr/lib/realplay/plugins \
    /usr/lib/RealPlayer8 \
    /usr/lib/realplay \
    "$HOME/.netscape/plugins" \
    /opt/netscape/plugins \
    /usr/lib/netscape/plugins \
    /usr/local/netscape/plugins \
    /usr/local/lib/netscape/plugins \
    ; do
    if test -d $DIR ; then 
	OPERA_PLUGIN_PATH="$OPERA_PLUGIN_PATH":"$DIR"
    fi
done

# Acrobat Reader
if test -d /usr/local/Acrobat4/bin ; then 
    PATH=$PATH:/usr/local/Acrobat4/bin
fi

OPERA_PLUGIN_PATH="$OPERA_PLUGIN_PATH":"$NPX_PLUGIN_PATH"
 
# Exporting the enviroment
export OPERA_DIR OPERA_PLUGIN_PATH

# Running Opera
$OPERA "$@"
