trap 'exit 3' 15

# January 1997 eks : a request script supporting 
# NIL_HEAVY interactive install option for AB2 packages

## Finding the data on the CD:
#  If the pkg* supplied mount point is available, use it.

Distrib=""

export Distrib

if [ "$INST_DATADIR" != ""  -a "$INST_DATADIR" != "/" ]
then
	Distrib="$INST_DATADIR"

fi

while  [ ! -d ${Distrib}/${PKG} ]
do
	Distrib=`ckpath -Qaroy -p "Enter the mount point of the ${PKG} AnswerBook cdrom:"`
	if [ ! -d ${Distrib}/${PKG} ]
	then
		echo "Can't find the ${PKG} AnswerBook package under $Distrib !"
	else
		break
	fi
done

#
# find out whether the reloc tree is available or is in a compressed
# archive

    # assume compressed:
    RELOC_COMPRESSED="true"
 
    # check for other case:
    if [ -d ${Distrib}/${PKG}/reloc ]
    then
        RELOC_COMPRESSED="false"
    fi
    export RELOC_COMPRESSED


# force the choice

opt="heavy"

COLL_PARENTDIR=${BASEDIR}

if [ "${COLL_PARENTDIR}" != "/" ]
then
        AB2INSTALLDIR=${COLL_PARENTDIR}/${ABHOME}
else
        AB2INSTALLDIR=/${ABHOME}
fi

if [ "$opt" = "heavy" ]
then
	AB2DATADIR=$AB2INSTALLDIR
	CLASSES="none Main CONFIG"
else
	CLASSES="none CONFIG"
	AB2DATADIR=${Distrib}/${PKG}/reloc/AB2INSTALLDIR
fi

# here we write shell assignments to pkgadd/request's mysterious $1  
# in order that the encapsulating pkgadd code places them in the
# "packaging environment"

# Create the output file with the CLASSES assignment:

echo "CLASSES=${CLASSES}" > $1

# append until done:

# write the handles to the source and target dirs:

echo "CLASSES=${CLASSES}" >> $1
echo "Distrib=${Distrib}" >> $1
echo "ABHOME=${ABHOME}" >> $1
echo "COLL_PARENTDIR=${COLL_PARENTDIR}" >> $1
echo "AB2INSTALLDIR=${AB2INSTALLDIR}" >> $1
echo "AB2DATADIR=${AB2DATADIR}" >> $1
echo "RELOC_COMPRESSED=${RELOC_COMPRESSED}" >> $1
 
# write the rest of the assignments:

exit 0
