

#------------------------------------------------------------------------------
#
# 1  absolute source directory
# 2  file name
# 3  absolute installation directory
#
#------------------------------------------------------------------------------

source_dir=$1
file_name=$2
install_dir=$3
install_command=$4

dest_file_path=${install_dir}/${file_name}
ref_file=${dest_file_path}.cmtref
full_source_name=${source_dir}/${file_name}

if test "${CMTINSTALLAREA}" = "" ; then
  echo "No installation directory specified"
  exit 0
fi

b=`(cd ${CMTINSTALLAREA%/InstallArea}; /bin/pwd)`
a=`/bin/pwd | grep -e "${b}"`
if test "${a}" = ""; then
  echo "Current directory outside of the installation area. Cannot proceed"
  exit 0
fi

if test "${install_dir}" = "" ; then
  exit 0
fi

if test ! -d ${install_dir}; then
  echo "Cannot uninstall file ${file_name}, no installation directory specified"
  exit 0
fi

echo Removing file ${file_name} from ${install_dir}

if test -f ${dest_file_path}; then
  /bin/rm -f ${dest_file_path}
fi

if test -f ${ref_file}; then
  /bin/rm -f ${ref_file}
fi

