#
#
# ----------------------------------------------------------------------
# PURPOSE:  Install application software either 3b2 or PLUS style.
# ----------------------------------------------------------------------
# CONTENTS FILE LAYOUT:
# KEY_NAME TYPE NAME
# KEY_NAME is the date+pid+number if needed to make unique
# TYPE is 1 of PLUS stlye and 2 for 3b2 style.
# NAME is the Name file.

trap "trap '' 1 2 3 9 15; cd /; rm -rf ${TMPDIR} ${CPLOG} & echo You have canceled the installation.; exit 1" 1 2 3 9 15

INDIR=/usr/lib/installed
CONTENTS=${INDIR}/CONTENTS
TMPDIR=/usr/tmp/install$$

RC=`id | sed -e 's/uid=//' -e 's/(.*//'`
if [ "$RC" != "0" ]
then
	message -d "You (${LOGNAME}) do not have permission to perform software \
installation.  Please consult your Operations/System Administration Guide for more \
information on assigning permissions to privileged operations."
	exit 1
fi

if [ -z "$TERM" ]
# CChan. Changed TERM type from AT386-M
then TERM=vt100
fi
CLEAR=`tput clear 2>/dev/null`

cd /
if [ ! -d /usr/options ]
then
	rm -rf /usr/options
	mkdir /usr/options
	chmod 755 /usr/options
fi

if [ ! -d ${INDIR} ]
then
	rm -rf ${INDIR}
	mkdir ${INDIR}
	chmod 755 ${INDIR}
fi
exec /usr/lbin/Install.tape
if [ $? -ne 0 ]
then
	echo "Can not install from tape."
	exit 1
fi
exit 0
