#!/bin/sh
#
# Make this script executable or start with
#   sh installrenew
# to generate the Renew scripts. java must be
# present for this script to complete.
#
cd ../..
if test ! -d bin/unix
then
  echo Please change to renew1.2/bin/unix where install is located!
  exit
fi

if test ! -r renew.jar
then
  echo Please change to renew1.2/bin/unix where install is located!
  exit
fi

# If the following plausibility check poses a problem, simply delete
# everything up to the next comment.
if (java -version) 2>/dev/null
then
  echo Command java detected. Proceeding.
else
  echo Command java not found. Aborting.
  exit
fi
# This is the next comment.

addcp=`pwd`'/renew.jar:'`pwd`':.'

if test -x bin/unix/renew
then
  echo A script named renew is already present. I will not overwrite it.
else
  echo '#!/bin/sh' >bin/unix/renew
  echo 'export CLASSPATH' >>bin/unix/renew
  echo 'if test "$CLASSPATH" != ""' >>bin/unix/renew
  echo 'then' >>bin/unix/renew
  echo '  CLASSPATH=$CLASSPATH:'$addcp >>bin/unix/renew
  echo 'else' >>bin/unix/renew
  echo '  CLASSPATH='$addcp >>bin/unix/renew
  echo 'fi' >>bin/unix/renew
  echo 'java de.renew.gui.CPNApplication $*' >>bin/unix/renew
  chmod 755 bin/unix/renew
fi

echo Created renew script.

if test -x bin/unix/srenew
then
  echo A script named srenew is already present. I will not overwrite it.
else
  echo '#!/bin/sh' >bin/unix/srenew
  echo 'export CLASSPATH' >>bin/unix/srenew
  echo 'if test "$CLASSPATH" != ""' >>bin/unix/srenew
  echo 'then' >>bin/unix/srenew
  echo '  CLASSPATH=$CLASSPATH:'$addcp >>bin/unix/srenew
  echo 'else' >>bin/unix/srenew
  echo '  CLASSPATH='$addcp >>bin/unix/srenew
  echo 'fi' >>bin/unix/srenew
  echo 'java -Dde.renew.mode=de.renew.gui.SequentialJavaMode \\' >>bin/unix/srenew
  echo '  de.renew.gui.CPNApplication $*' >>bin/unix/srenew
  chmod 755 bin/unix/srenew
fi

echo Created srenew script.

if test -x bin/unix/makestub
then
  echo A script named makestub is already present. I will not overwrite it.
else
  echo '#!/bin/sh' >bin/unix/makestub
  echo 'export CLASSPATH' >>bin/unix/makestub
  echo 'if test "$CLASSPATH" != ""' >>bin/unix/makestub
  echo 'then' >>bin/unix/makestub
  echo '  CLASSPATH=$CLASSPATH:'$addcp >>bin/unix/makestub
  echo 'else' >>bin/unix/makestub
  echo '  CLASSPATH='$addcp >>bin/unix/makestub
  echo 'fi' >>bin/unix/makestub
  echo 'java de.renew.call.StubGenerator $*' >>bin/unix/makestub
  chmod 755 bin/unix/makestub
fi

echo Created makestub script.

if test -x bin/unix/compilestub
then
  echo A script named compilestub is already present. I will not overwrite it.
else
  echo '#!/bin/sh' >bin/unix/compilestub
  echo 'export CLASSPATH' >>bin/unix/compilestub
  echo 'if test "$CLASSPATH" != ""' >>bin/unix/compilestub
  echo 'then' >>bin/unix/compilestub
  echo '  CLASSPATH=$CLASSPATH:'$addcp >>bin/unix/compilestub
  echo 'else' >>bin/unix/compilestub
  echo '  CLASSPATH='$addcp >>bin/unix/compilestub
  echo 'fi' >>bin/unix/compilestub
  echo 'java de.renew.call.StubCompiler $*' >>bin/unix/compilestub
  chmod 755 bin/unix/compilestub
fi

echo Created compilestub script.


