#!/usr/bin/ksh 
# Install the product package file $1
#
# $1 is the package name. Example: 55.vaserver (Note the <version>.<name> format)
#
#	1. install the contents of the installp file;
#
#	2. install a contents listing and an install log record.
#
# This script for AIX installations only.
#

#--------------------------------------------------------------------------------
# 	Verify superuser authority. It is not necessary for the user to
#	actually *be* 'root'.  It is only necessary that they have
#	root-like authority.
#--------------------------------------------------------------------------------
touchfile=/a.$$.tmp
touch $touchfile 2>/dev/null
if [  $? -ne 0  ] ; then
	echo "ERROR: You must have root authority to run this program."
	exit 1
fi
rm $touchfile

#--------------------------------------------------------------------------------
# Script var summary:
#
#	INSTALLDIR		- The root directory for this install							
	
#
#	PKGNAME			- The installp image file (leaf) [script parm $1]
#	PKGFILE			- The installp image file (path+leaf)
#
#	LOGDIR			- The directory into which we place the install log.
#	LOGFILE			- The leaf install log filename.
#
#--------------------------------------------------------------------------------

PKGNAME=$1
PKGFILE=$PWD/$PKGNAME
INSTALLDIR=/opt/IBMvast/5.5

LOGDIR=$INSTALLDIR/inst
LOGFILE=$LOGDIR/install_$PKGNAME.log
INSTALLP=/usr/sbin/installp

#--------------------------------------------------------------------------------
# Ensure that the product root directory and the log directory exist.
#--------------------------------------------------------------------------------
test -d $INSTALLDIR || mkdir $INSTALLDIR
test -d $LOGDIR || mkdir $LOGDIR

echo
echo "Start"
echo "   Installing $PKGNAME"

if [ "$PKGNAME" = "netq" ]
then
	$INSTALLP -e $LOGFILE -acgqXd $PWD/netquestion IMNSearch.rte
	$PWD/abtcrtln.sh en_US
else
	if [ "$PKGNAME" = "aixupdates" ]
	then
		test -f aixupdates.tar && tar -xvf aixupdates.tar >> $LOGFILE
	else
		$INSTALLP -e $LOGFILE -acd $PKGFILE IBMvast$PKGNAME.rte  
	fi
fi

