#!/bin/csh -f
#Tag 1024

#    Install: Alias 3DCD Installation Script

echo ""
echo ""
echo "       Alias|Wavefront Docs/Tutorials Setup Script"
echo ""

# Determine where the CD-ROM is mounted.

set pdir = `dirname $0`
set pfc = `echo $pdir | cut -c1`
if ("$pfc" == "/") then
    set cdir = $pdir
else
    set cdir = $cwd
endif

#    Set the environment variable, ALIAS_CDLOCN to the mount point of the
#    Alias|Wavefront CD-ROM. This variable will be used by the other install
#    scripts to determine the mount point of the CD-ROM.

setenv ALIAS_CDLOCN $cdir

set ALDOC = 1
set CD3D = 2
set TUTOR = 3 

#    Ask the installer which product(s) they wish to setup

top:

echo ""
echo "The following Alias|Wavefront products provide valuable online documentation"
echo "and tutorial lessons for using the Alias software:"
echo ""
echo "    $ALDOC) Alias V8.2 online documentation"
echo "    $CD3D) Alias|Wavefront 3DCD"
echo "    $TUTOR) Alias V8.2 CourseWare"
echo ""
echo "Please specify which products you are interested in using. You will be given"
echo "the option of installing each of the above products."
echo ""
echo "If you do not wish to use any of the above products, leave the line blank and"
echo "press <ENTER>."
echo ""
echo -n "Please specify your choice(s): "

set ans = $<
set choice = ($ans)

#    If the installer did not specify any products they are interested in
#    using, exit

if ($#choice == 0) then
    echo ""
    echo -n "Press <ENTER> to continue: "
    set a = $<
    exit 0
endif

#    Unset all the variables used for indicating which product(s) are to be
#    setup. This code serves a purpose:
#
#    - if the installer makes a mistake when choosing which products to
#      setup, Install asks them to specify their choices again. The
#      variables must be unset to indicate that no products have been
#      chosen yet.

unset    inst_3dcd int_aldoc inst_tutor

@ i = 1
while ($i <= $#choice)
    if ($choice[$i] == $CD3D) then
        set inst_3dcd
    else if ($choice[$i] == $ALDOC) then
        set inst_aldoc
    else if ($choice[$i] == $TUTOR) then
        set inst_tutor
    else
        echo ""
        echo "Illegal product specification: $choice[$i]. Please try again."
        goto top
    endif
    @ i++
end

if ($?inst_3dcd) then
    echo ""
    $cdir/InstallScripts/Install.3DCD
endif

if ($?inst_aldoc) then
    echo ""
    $cdir/InstallScripts/Install.Aliasdocs
endif

if ($?inst_tutor) then
    echo ""
    $cdir/InstallScripts/Install.Tutorial
endif

echo ""
echo "The installations are complete."
echo ""
echo -n "Press <ENTER> to continue: "
set a = $<
exit 0
