#!/bin/sh -x
##########################################################################
#
# routine: cdbcln.sh 
#
# purpose: Performs cleanup after a CDBS catalog has completed installation.
#
# modification history:
#
#   date    opr     who     reason
# -------- -----  --------  --------------------------------------
# 10/08/98 36608  MSwam     first version
# 04/09/99 38834  MSwam     add banner print
# 
##########################################################################
banner=">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo $banner
date
#
all_is_well=0
error_occurred=1
#
# remove all catalog-related files left in the incoming directory
rm ${CATALOG_IN_DIR}${OSF_DATASET}*
if [ $? = 0 ]
then
    # success
    exit $all_is_well
fi
#
# delete failed, verify files still exist
numfiles=`ls -1 ${CATALOG_IN_DIR}${OSF_DATASET}* | wc -l`
if [ $numfiles = 0 ]
then
   # no files to clean
   exit $all_is_well
fi
#
# clean failed
exit $error_occurred
