#!/bin/sh
echo ""
echo "SIP Communicator 1.0.draft - starting installation... please wait"
echo ""

# create a temp directory to extract to.
export WRKDIR=`mktemp -d /tmp/selfextract.XXXXXX`

SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`

# Take the TGZ portion of this file and pipe it to tar.
tail -n +$SKIP $0 | tar xz -C $WRKDIR

# execute the installation script

PREV=`pwd`
cd $WRKDIR
chmod +x setup.sh
chmod +x jre/bin/java

# this change is due to the fact that the installer searches
# the jre in this directory to copy it to the installation folder
#mkdir -p release/linux/tmp
#ln -s `pwd`/jre release/linux/tmp/jre
./setup.sh

INSTALL_PATH=`cat inst_path`
cp -r jre $INSTALL_PATH
chmod a+x $INSTALL_PATH/jre/bin/java

# delete the temp files
cd $PREV
rm -rf $WRKDIR

exit 0

__ARCHIVE_FOLLOWS__
