#!/bin/sh
##########################################################################
#
#
# Script to install the Passport DM/VM software onto the user's hard disk.
#
# Usage  : install_dmvm [sw-version] [target-directory]
#
# Example: install_dmvm dm_3.1.0.0 /opt/NortelFS
#
#
##########################################################################
#
# V1.0   - 12/12/97 [ET]
#
# V1.0.1 - 01/04/98 [ET/DJE] - Add HP/UX 10.2 support and file name
#				correction
# V1.0.2 - 01/06/98 [ET/DJE] - Script for re-mastered CD with
#				correct filename and general
#				clean-up of script
# V1.3.0 - 08/13/98 [ET]     - Added AIX support and updated for
#				Release 1.3.0
# V1.3.3 - 12/09/98 [JH]     - Added support for Accelar agent s/w
#				Release 1.3.1
# V2.0  -  3/02/99  [JH]     - Added support for Accelar agent s/w
#				Release 2.0
# V2.0.1 - 4/16/99  [JH]     - Added support for Accelar agent s/w
#                               Release 2.0.1
# V3.0.0 - 6/18/99  [JH]     - Added support for Accelar 8100 Edge Switch 
#                               Agent s/w Release 3.0.0
# V3.0.1 - 9/29/99  [JH]     - Added support for Accelar 8100 Edge Switch 
#                               Agent s/w Release 3.0.1
# V3.0.3 - 11/20/99 [ET]     - Added support for Accelar 8600 Core Switch 
#                               Agent s/w Release 3.0.3
# V3.1.0 - 04/27/00 [ET]     - Added support for Passport 8600 Core Switch 
#                               Agent s/w Release 3.1.0.0
#
#########################################################################

os=`uname`
if [ $os = "HP-UX" -o $os = "SunOS" -o $os = "AIX" ] 
then {

if [ ! -f "$1.tar.Z" ]
then
   echo "Cannot find $1.tar.Z in the current directory"
   exit 1
fi

#
# Make sure the target-directory exist 
#
if [ ! -d "$2" ]
then
   echo "$2 is not a valid target-directory. Check for spelling errors or"
   echo "use the command 'mkdir $2' to create this directory."
   exit 1
fi

#
# Copy the compressed tar file to the user's hard-disk
#
echo "Copying $1.tar.Z to $2/$1.tar.Z"
cp $1.tar.Z $2/$1.tar.Z

#
# Uncompress and untar the file 
#
cd $2
echo "Uncompressing and extracting $1.tar.Z"
zcat $1.tar.Z | tar xf - 
echo "Removing $2/$1.tar.Z"
rm -f $1.tar.Z

#
# Execute the stand-alone install script
#
cd $1
./standalone_setup

exit 0
}
fi

echo "Only AIX, HP-UX and Solaris supported."
exit 1
