#! /bin/sh
#	@(#)postinstall	1.1 97/10/06 

PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH

XILCOMPUTE=$BASEDIR/SUNWits/Graphics-sw/xil/lib/xil.compute
INPUTFILE=$PKG_INSTALL_ROOT/var/sadm/pkg/$PKGINST/install/compute.bak

dest=$XILCOMPUTE
src=$INPUTFILE

if [ ! -d `dirname $dest` ]
then
	echo "Directory has not been created"
	exit 2
fi

if [ ! -f $dest ];  then
   cp $src $dest
else
  if [ ! -w $dest ]; then
     echo "Error: $dest not writeable"
     exit 2
  fi

  echo "Performing merge for $dest..."	
  # merge existing and new version
  while read line
  do
    grep "^$line\$" $dest > /dev/null
    if [ $? != 0 ] ; then
       echo "$line" >> $dest
    fi
  done < $src
fi

