#! /bin/sh
#
# @(#)kitcheck	1.4	LPS_UNX_COM	02/19/95
#
# Copyright 1993   Digital Equipment Corporation, Maynard, MA
#
# kitcheck
#
# Shell script to scan the directory tree (starting with the current
# working directory) to ensure all kit components are present.
#
# Parameters:
#    -none-
#
# Global variables:
#    ECHON
#    KITLIST
#    LPSDEBUG
#
# Exit values:
#    0 - All kit components currently exist
#    1 - One or more kit components could not be found

CWD="`pwd`"
: ${KITLIST:=KITLIST}

LPSDEBUG=""   # Comment-out this line if you want to propagate debugging

problem=false

if [ -f ./$KITLIST ]
then
    for k in `find $CWD -name $KITLIST -print`
    do
	d="`dirname $k`"
	for f in `cat $k`
	do
	    ff="$d/$f"
	    if [ -f $ff -o -d $ff ]
	    then
		if [ "$LPSDEBUG" ]
		then
		    echo "  $ff [OK]"
		fi
	    else
		echo "    \"$ff\" NOT FOUND!"
		problem=true
	    fi
	done
    done
else
    echo "    The top-level \"$KITLIST\" file could not be found!"
    problem=true
fi

if [ "$LPSDEBUG" ]
then
    echo
    pause "Press RETURN to continue... "
fi

if $problem
then
    exit 1
fi

exit 0
