#!/bin/sh
###########VRP Installer .1 Beta################
# Copyright Shane R. Nay (shane@agendacomputing.com)
# License terms under the GPL
# This file takes the package name as it's argument.
# Or if run within vrpsync it is passed a variable
# with the package name.  This programs job is to
# expand the package in the temp directory, and then
# execute the installer program.

#FILEENT=${1##*/};
if [ "${VRP_SYNC_INTERNAL}" != "true" ]; then
    VRP_CONF=${VRP_CONF:=/opt/snow-gcc-1.4/etc/vrp.conf}
    VRP_PACKAGE=$1
    if [ -f ${VRP_CONF} ]; then
	source $VRP_CONF
    else
	echo Your VRP config file was not at $VRP_CONF
	exit 1
    fi
fi

if [ ! -f $VRP_PACKAGE ]; then
    echo Package file: $VRP_PACKAGE not found
    exit 1
fi

rm -f -r $VRP_TEMP
mkdir $VRP_TEMP
STARTDIR=`pwd`
cd $VRP_TEMP; tar xf ${STARTDIR}/${VRP_PACKAGE}
if test $VERBOSITY -gt 0; then
  echo ${STARTDIR}/${VRP_PACKAGE}
fi
chmod +x ${VRP_TEMP}/install
${VRP_TEMP}/install ${VRP_CONF} $VRP_PACKAGE
rm -f -r $VRP_TEMP
