#!/bin/sh

# $Id: installMakexite,v 1.3 1996/03/18 16:50:20 svein Exp $

if test "$quiet" -eq 0
then
  echo "Editing makexite." 1>&2
fi

if test "$buildOnly" -eq 0
then
  if test -f makexite
  then
    echo "Moving existing makexite to makexite.old." 1>&2
    mv makexite makexite.old
  fi

  awk -f $edmakexite home=$XITE_HOME \
    exceptions="$exceptionDirs" xite_hosttype="$XITE_HOSTTYPE" \
    makexite.tmpl > makexite
else
  if test -f makexite
  then
    echo "Backup copy of existing makexite in makexite.bak." 1>&2
    cp makexite makexite.bak

    awk -f $edmakexite home=$XITE_HOME \
      exceptions="$exceptionDirs" \
      xite_hosttype="$XITE_HOSTTYPE" \
      makexite.bak > makexite
  else
    echo "ERROR:" 1>&2
    echo "Could not find the file makexite, which must exist for" 1>&2
    echo "a successful rebuild." 1>&2
    echo "You need to do a complete installation instead." 1>&2
    echo "" 1>&2
    $paramMessage 1>&2

    exit 1
  fi
fi # $buildOnly

if test $? -ne 0
then
  echo "ERROR:" 1>&2
  echo "Editing makexite failed." 1>&2
  rm makexite > /dev/null 2>&1
  echo "" 1>&2
  $paramMessage 1>&2

  exit 1
fi

chmod u+rx makexite

exit 0
