#!/sbin/sh
#@(#)HP X Station Admin Scripts
#
# ckinstall	Check installation of X station software 
#

cat <<EOF

This test will:
	Check that all files necessary in order to boot an HP X Station
	are present on this computer.

EOF

$ECHO "Proceed with the install test [y|n] (y): $NL"
read SEL
echo ""

case $SEL in
    y|Y|yes|YES|Yes|"")
	;;
    *)
	exit 100
	;;
esac


RGBFILE=$SWHOME/rgb.txt

# Model groups already defined in xtadm
ALLMODELS="$MODELS_700X $MODELS_700RX $MODELS_ENVIZEX $MODELS_ENTRIA"

echo ""
if [ -f $RGBFILE ]
then
	echo "$RGBFILE is present."
else
	echo "ERROR: $RGBFILE is NOT present."
fi

cat <<EOF

*********************************************************
* Downloadables for the following X stations		*
* are present:						*
EOF
for i in $ALLMODELS
do
    if [ -f $SWHOME/bin/$i ]
    then
        echo "$MODELS_700X" | grep $i  > /dev/null 2>&1
        if [ $? -eq 0 ]
        then
            echo "*              700/X Series, model $i		*"
        fi

        echo "$MODELS_700RX" | grep $i  > /dev/null 2>&1
        if [ $? -eq 0 ]
        then
            echo "*              700/RX Series, model $i		*"
        fi

        echo "$MODELS_ENVIZEX" | grep $i  > /dev/null 2>&1
        if [ $? -eq 0 ]
        then
            echo "*              ENVIZEX Series, model $i		*"
        fi

        echo "$MODELS_ENTRIA" | grep $i  > /dev/null 2>&1
        if [ $? -eq 0 ]
        then
            echo "*              ENTRIA Series, model $i		*"
        fi
    fi
done
echo "*********************************************************"

FLAG=0
for i in $ALLMODELS
do
        if [ ! -f $SWHOME/bin/$i ]
        then
            FLAG=1
            break
        fi
done

if [ $FLAG -eq 1 ]
then
    cat <<EOF

*********************************************************
* Downloadables for the following X stations		*
* are NOT present:					*
EOF
    for i in $ALLMODELS
    do
        if [ ! -f $SWHOME/bin/$i ]
        then
            echo "$MODELS_700X" | grep $i  > /dev/null 2>&1
            if [ $? -eq 0 ]
            then
                echo "*              700/X Series, model $i		*"
            fi

            echo "$MODELS_700RX" | grep $i  > /dev/null 2>&1
            if [ $? -eq 0 ]
            then
                echo "*              700/RX Series, model $i		*"
            fi

            echo "$MODELS_ENVIZEX" | grep $i  > /dev/null 2>&1
            if [ $? -eq 0 ]
            then
                echo "*              ENVIZEX Series, model $i		*"
            fi

            echo "$MODELS_ENTRIA" | grep $i  > /dev/null 2>&1
            if [ $? -eq 0 ]
            then
                echo "*              ENTRIA Series, model $i		*"
            fi
        fi
    done
    echo "*********************************************************"
fi

cat <<EOF

*********************************************************
* Note: Look on the back of the HP X Station base unit	*
* for the model number.					*
*********************************************************

EOF

$ECHO "Please type <Enter> to continue, or ? for help: $NL"
read SEL
if [ $SEL ]
then
    if [ $SEL = "?" ]
    then
        echo ""
        echo '  The series and models of X stations that are supported'
        echo '  depends on the downloadable files that have been installed.'
        echo "  These files are located in $SWHOME/bin."
        echo '  All models need not be supported by your system, only'
        echo '  those that correspond to the models you have or would'
        echo '  like to install.'
        echo ""
        $ECHO "Please type <Enter> to continue: $NL"
        read SEL
    fi
fi

exit 100
