#!/bin/sh

#
# Copyright  Digital Equipment Corporation, 1995, 1996 All Rights Reserved.
#
# Restricted Rights: Use, duplication, or disclosure by the U.S. Government is
# subject to restrictions as set forth in subparagraph (C)(1)(ii) of DFARS
# 252.227-7013, or in FAR 52.227-14 Alt. III, as applicable. Unpublished
# rights reserved under applicable copyright laws.
#
# This software is proprietary to and embodies the confidential technology of
# Digital Equipment Corporation.  Possession, use, or copying of this software
# and media is authorized only pursuant to a valid written license from
# Digital or an authorized sublicensor.
#

#
# Initialise
#
cd `dirname $0`
. ./globals
export ECHONNL NNL

#
# No point in continuing if we're not root
#
case `whoami` in
root) ;;
* )
        echo "You must be superuser to install the $PRODUCT."
        exit 1
        ;;
esac

#
# Select the right installation script for this platform
#
set -- `uname -a`

case "$1$5" in
OSF1alpha)
	ISCRIPT="dunix"
	ECHONNL="/bin/echo -n"
	NNL=""
	MMAJOR=3
	MMINOR=2
	MINVER="V3.2C"
	PLATFORM="Digital UNIX"
	;;
*)
	ISCRIPT="not-this-platform"
	;;
esac

#
# No point continuing if there isn't an installation script
#
[ ! -f $SCPDIR/$ISCRIPT ] && {
	echo "The $PRODUCT cannot be installed on this platform."
	exit 1
}

# Check OS version
OSOK=1
MAJOR=`echo $3 | sed -n 's/^[A-Za-z]*\([0-9]*\).*$/\1/p'`
MINOR=`echo $3 | sed -n 's/^.*\.\([0-9]*\).*$/\1/p'`

if [ "$MAJOR" -lt "$MMAJOR" ] 
    then OSOK=0
    fi
if [ "$MAJOR" -eq "$MMAJOR" -a "$MINOR" -lt "$MMINOR" ]
    then OSOK=0
    fi

[ "$OSOK" -eq "0" ] && {
	echo "The $PRODUCT cannot be installed."
	echo "Your version of $PLATFORM is not supported."
	echo "Minimum supported version is ${MINVER}."
	exit 1
}
#
# Prechecks done; now the installation proper can start
#
echo
echo "Installation of $PRODUCT starting at `date`"
echo

#
# Give the installer a chance to read the readme first file, in case they
# haven't done so already.
#
[ -f README.1ST ] && {
	$ECHONNL "Do you want to read the README.1ST file (y/n)? $NNL"
	read ANS
	if [ "$ANS" = "y" -o "$ANS" = "Y" ]
	    then more README.1ST
	fi
	echo
}

trap "echo" 1 2 15

[ -f $SYMDIR/$ISCRIPT ] && . $SYMDIR/$ISCRIPT
./$SCPDIR/$ISCRIPT $*

cat <<xxCOPYRIGHTxx

  Copyright  Digital Equipment Corporation, 1995, 1996. All Rights Reserved.

  Restricted Rights: Use, duplication, or disclosure by the U.S. Government is
  subject to restrictions as set forth in subparagraph (C)(1)(ii) of DFARS
  252.227-7013, or in FAR 52.227-14 Alt. III, as applicable. Unpublished
  rights reserved under applicable copyright laws.

  This software is proprietary to and embodies the confidential technology of
  Digital Equipment Corporation.  Possession, use, or copying of this software
  and media is authorized only pursuant to a valid written license from
  Digital or an authorized sublicensor.

xxCOPYRIGHTxx

echo
echo "Installation of $PRODUCT finished at `date`"

