#!/bin/sh

myinstall() {
    file=$1
    dir=$2
    mode=$3
   
    if [ ! -f ${file} ]; then
        echo "Cant find $file to install in $dir..."
        return
    fi
    echo "Installing $file in $dir..."
    cp ${file} $dir/${file}.new
    chmod $mode $dir/${file}.new
    rm -f $dir/${file}.old
    ln $dir/${file} $dir/${file}.old
    if mv $dir/${file}.new $dir/${file} 2>/tmp/out$$
    then
	:
    else
	if mv -f $dir/${file}.new $dir/${file} 2>>/tmp/out$$ 
	then
	    :
        else
	    cat /tmp/out$$
	    mv $dir/${file}.old $dir/${file}
	fi
    fi
    rm -f /tmp/out$$
}

if [ -w /usr/local/bin ]
then
    cd ${UPS_PROD_DIR}/bin
    myinstall tcsh /usr/local/bin 755
fi
