#!/bin/sh
#
# This script is run to package up this Ganymede schema kit for
# distribution.  The only thing we count on to run this script is 
# that /bin/sh works.
#
# Get enough information from the user to be able to find Perl 5 and
# run scripts/installKit.pl.  We'll set a bunch of environment variables
# for installKit.pl to use to do its thing.
#
# Release: $Name: userkit_105 $
# Version: $Revision: 1.1.1.1 $
# Last Mod Date: $Date: 2000/11/16 19:06:58 $
#
###############################################################################

echo "Ganymede userKit packaging script"

# Find the source files, if location was not specified.

# Try the directory containing this script, then its parent.

prog=$0

GROOTDIR=`echo $prog|sed 's%/[^/][^/]*$%%'`
# if the program name is the same as the srcdir name, we have no path
# set.. must be .
test "x$GROOTDIR" = "x$prog" && GROOTDIR=.
if test ! -d $GROOTDIR/src/classes; then
  echo "configure: error: can not find sources in $rootdir" 1>&2; exit 1;
fi
export GROOTDIR

# Find perl (GPERL).. we need version 5.003 or later. If we can't find
# it on our own, ask the user

guessperl=`which perl5`

 if test ! -r "$guessperl"; then
  guessperl=`which perl`
 fi

 if `$guessperl $GROOTDIR/scripts/versiontest.pl > /dev/null 2>&1`; then
	GPERL=$guessperl
    else
	echo "Where is perl 5 installed? [$guessperl] \c" 

	read userperl

	if  test ! -z "$userperl"; then
	    GPERL=$userperl
	else
	    GPERL=$guessperl
	fi
 fi

export GPERL

$GPERL $GROOTDIR/scripts/makeArchive.pl $*
