#!/bin/sh -f

#////////////////////////////////////////////////
# Usage :
#   UNIX> cd some_path/pack/version/obuild
# ( UNIX> chmod a+x sh/install )
#   UNIX> sh/install
#
# This script is intended to install the 
# setup.sh and setup.csh scripts. 
#
# For setup.sh, it edits the path line :
#   path_<package>=@@absolute_dir@@
# and for setup.csh, the path line :
#   set path_BatchLab="@@absolute_dir@@"
#
# The script replaces in these lins the string : 
#   @@absolute_dir@@ 
# by the return of the pwd command.
#
#////////////////////////////////////////////////

obuild_current=`pwd`

obuild_dir=`echo ${obuild_current} | sed -e 's#/obuild##g'`

obuild_from='="@@absolute_dir@@"'

obuild_to='="'"${obuild_dir}"'"'

if test -e setup.sh ; then
  /bin/rm -f obuild_tmp
  sed -e "s#${obuild_from}#${obuild_to}#g" setup.sh > obuild_tmp
  /bin/mv obuild_tmp setup.sh
  /bin/rm -f obuild_tmp
fi

if test -e setup.csh ; then
  /bin/rm -f obuild_tmp
  sed -e "s#${obuild_from}#${obuild_to}#g" setup.csh > obuild_tmp
  /bin/mv obuild_tmp setup.csh
  /bin/rm -f obuild_tmp
fi
