#! /bin/sh
# (C) Copyright 1991, 1992 Tektronix, Inc.  All rights reserved.
SOUR=$1
DEST=$2
if [ -z "$TEE" ] 
then
   TEE='cat'
fi
if [ -f $SOUR/rgb.txt ]
then
  echo "copying file XP/site/rgb.txt" | $TEE
  if [ -f $DEST/XP/site/rgb.txt ]
  then
    if [ -f $DEST/XP/site/rgb.tmpl ]
    then
       rm -f $DEST/XP/site/rgb.tmpl
    fi
    cp $SOUR/rgb.txt $DEST/XP/site/rgb.tmpl
  else
    cp $SOUR/rgb.txt $DEST/XP/site/rgb.txt
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURrgb.txt not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/rgb.txt
fi
if [ -f $SOUR/hosts.tbl ]
then
  echo "copying file XP/site/hosts.tbl" | $TEE
  if [ -f $DEST/XP/site/hosts.tbl ]
  then
    if [ -f $DEST/XP/site/hosts.tmpl ]
    then
       rm -f $DEST/XP/site/hosts.tmpl
    fi
    cp $SOUR/hosts.tbl $DEST/XP/site/hosts.tmpl
  else
    cp $SOUR/hosts.tbl $DEST/XP/site/hosts.tbl
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURhosts.tbl not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/hosts.tbl
fi
if [ -f $SOUR/nfs.tbl ]
then
  echo "copying file XP/site/nfs.tbl" | $TEE
  if [ -f $DEST/XP/site/nfs.tbl ]
  then
    if [ -f $DEST/XP/site/nfs.tmpl ]
    then
       rm -f $DEST/XP/site/nfs.tmpl
    fi
    cp $SOUR/nfs.tbl $DEST/XP/site/nfs.tmpl
  else
    cp $SOUR/nfs.tbl $DEST/XP/site/nfs.tbl
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURnfs.tbl not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/nfs.tbl
fi
if [ -f $SOUR/gateway.tbl ]
then
  echo "copying file XP/site/gateway.tbl" | $TEE
  if [ -f $DEST/XP/site/gateway.tbl ]
  then
    if [ -f $DEST/XP/site/gateway.tmpl ]
    then
       rm -f $DEST/XP/site/gateway.tmpl
    fi
    cp $SOUR/gateway.tbl $DEST/XP/site/gateway.tmpl
  else
    cp $SOUR/gateway.tbl $DEST/XP/site/gateway.tbl
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURgateway.tbl not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/gateway.tbl
fi
if [ -f $SOUR/xhosts.tbl ]
then
  echo "copying file XP/site/xhosts.tbl" | $TEE
  if [ -f $DEST/XP/site/xhosts.tbl ]
  then
    if [ -f $DEST/XP/site/xhosts.tmpl ]
    then
       rm -f $DEST/XP/site/xhosts.tmpl
    fi
    cp $SOUR/xhosts.tbl $DEST/XP/site/xhosts.tmpl
  else
    cp $SOUR/xhosts.tbl $DEST/XP/site/xhosts.tbl
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURxhosts.tbl not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/xhosts.tbl
fi
if [ -f $SOUR/fonts.tbl ]
then
  echo "copying file XP/site/fonts.tbl" | $TEE
  if [ -f $DEST/XP/site/fonts.tbl ]
  then
    if [ -f $DEST/XP/site/fonts.tmpl ]
    then
       rm -f $DEST/XP/site/fonts.tmpl
    fi
    cp $SOUR/fonts.tbl $DEST/XP/site/fonts.tmpl
  else
    cp $SOUR/fonts.tbl $DEST/XP/site/fonts.tbl
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURfonts.tbl not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/fonts.tbl
fi
if [ -f $SOUR/fonts.ultrix ]
then
  echo "copying file XP/site/fonts.ultrix" | $TEE
  if [ -f $DEST/XP/site/fonts.ultrix ]
  then
    if [ -f $DEST/XP/site/fonts.ultrix.tmpl ]
    then
       rm -f $DEST/XP/site/fonts.ultrix.tmpl
    fi
    cp $SOUR/fonts.ultrix $DEST/XP/site/fonts.ultrix.tmpl
  else
    cp $SOUR/fonts.ultrix $DEST/XP/site/fonts.ultrix
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURfonts.ultrix not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/fonts.ultrix
fi
if [ -f $SOUR/fonts.ultrix32 ]
then
  echo "copying file XP/site/fonts.ultrix32" | $TEE
  if [ -f $DEST/XP/site/fonts.ultrix32 ]
  then
    if [ -f $DEST/XP/site/fonts.ultrix32.tmpl ]
    then
       rm -f $DEST/XP/site/fonts.ultrix32.tmpl
    fi
    cp $SOUR/fonts.ultrix32 $DEST/XP/site/fonts.ultrix32.tmpl
  else
    cp $SOUR/fonts.ultrix32 $DEST/XP/site/fonts.ultrix32
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURfonts.ultrix32 not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/fonts.ultrix32
fi
if [ -f $SOUR/nodes.tbl ]
then
  echo "copying file XP/site/nodes.tbl" | $TEE
  if [ -f $DEST/XP/site/nodes.tbl ]
  then
    if [ -f $DEST/XP/site/nodes.tmpl ]
    then
       rm -f $DEST/XP/site/nodes.tmpl
    fi
    cp $SOUR/nodes.tbl $DEST/XP/site/nodes.tmpl
  else
    cp $SOUR/nodes.tbl $DEST/XP/site/nodes.tbl
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURnodes.tbl not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/nodes.tbl
fi
if [ -f $SOUR/remap.dir ]
then
  echo "copying file XP/site/remap.dir" | $TEE
  if [ -f $DEST/XP/site/remap.dir ]
  then
    if [ -f $DEST/XP/site/remap.tmpl ]
    then
       rm -f $DEST/XP/site/remap.tmpl
    fi
    cp $SOUR/remap.dir $DEST/XP/site/remap.tmpl
  else
    cp $SOUR/remap.dir $DEST/XP/site/remap.dir
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURremap.dir not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/remap.dir
fi
if [ -f $SOUR/remap.all ]
then
  echo "copying file XP/site/remap.all" | $TEE
  if [ -f $DEST/XP/site/remap.all ]
  then
    if [ -f $DEST/XP/site/remap.tmpl ]
    then
       rm -f $DEST/XP/site/remap.tmpl
    fi
    cp $SOUR/remap.all $DEST/XP/site/remap.tmpl
  else
    cp $SOUR/remap.all $DEST/XP/site/remap.all
  fi
  if [ $? -ne 0 ] 
  then
    echo "ERROR - $SOURremap.all not copied to $DEST/XP/site" | $TEE
  fi
  rm -f $SOUR/remap.all
fi
exit 0
