#!/bin/sh
#
#  $Id: install,v 1.51 2004/03/19 14:13:34 jason Exp $
#
#  $Log: install,v $
#  Revision 1.51  2004/03/19 14:13:34  jason
#  changes for 1.2 release
#
#  Revision 1.50  2004/03/19 13:52:23  jason
#  change for bugzilla 586
#
#  Revision 1.49  2004/03/19 09:13:41  jason
#  changed copyright message to 2004
#
#  Revision 1.48  2004/03/18 17:15:33  jason
#  change for oob 1.4
#
#  Revision 1.47  2003/05/23 09:51:00  jason
#  return key in incorrect place
#
#  Revision 1.46  2003/05/21 08:58:33  jason
#  add security notice
#
#  Revision 1.45  2003/03/19 14:06:55  jason
#  change oob version
#
#  Revision 1.44  2003/02/05 09:32:26  jason
#  change odbc-odbc bridge version
#
#  Revision 1.43  2003/01/27 13:42:34  jason
#  updated copyright
#
#  Revision 1.42  2002/12/13 12:49:05  jason
#  removed internal use banner
#
#  Revision 1.41  2002/11/28 15:42:00  jason
#  updated oob
#
#  Revision 1.40  2002/11/19 10:47:59  jason
#  up oob version to 1.0.0.43
#
#  Revision 1.39  2002/10/23 13:08:56  jason
#  changes to formatting of install text
#
#  Revision 1.38  2002/10/23 08:56:29  jason
#  changed for 1.1 beta release
#
#  Revision 1.37  2002/10/11 13:50:32  jason
#  changes for short names in packages
#
#  Revision 1.36  2002/10/04 13:58:21  jason
#  increased minimum oob version to 1.0.0.42
#
#  Revision 1.35  2002/09/26 15:36:49  jason
#  added slibclean for aix installations
#
#  Revision 1.34  2002/08/27 12:51:23  jason
#  changed oob version
#
#  Revision 1.33  2002/07/11 13:34:33  jason
#  add unixware
#
#  Revision 1.32  2002/05/31 15:38:17  jason
#  removed jdbc question from install
#
#  Revision 1.31  2002/05/03 08:37:41  jason
#  upgrade oob version
#
#  Revision 1.30  2002/02/26 14:52:13  jason
#  update copyright message
#
#  Revision 1.29  2002/02/21 14:22:35  jason
#  up oob version
#
#  Revision 1.28  2002/02/21 08:40:26  jason
#  change permissions on datatypes directory
#
#  Revision 1.27  2002/02/20 16:01:25  jason
#  change copyright notice
#
#  Revision 1.26  2001/11/14 12:18:48  jason
#  spelling mistake correction
#
#  Revision 1.25  2001/11/13 11:50:06  jason
#  install now stops any running httpisam servers
#
#  Revision 1.24  2001/08/17 16:00:39  jason
#  change minimum oob version
#
#  Revision 1.23  2001/08/14 09:49:36  jason
#  change to include new argument to uodbc dsn to stop existing datasources
#  being overwritten on installation
#
#  Revision 1.22  2001/07/31 09:49:51  jason
#  add unixware 2.1.3
#
#  Revision 1.21  2001/07/04 15:29:21  jason
#  update for siemens mips
#
#  Revision 1.20  2001/06/27 10:26:09  jason
#  add unixware
#
#  Revision 1.19  2001/06/04 15:28:43  jason
#  change version on jdbc-odbc bridget
#
#  Revision 1.18  2001/05/11 08:41:09  jason
#  last change not completed correctly should now be fixed
#
#  Revision 1.17  2001/05/10 14:28:34  jason
#  changes to remove multiple packages
#
#  Revision 1.16  2001/05/10 08:21:31  jason
#  change oob and job questions
#
#  Revision 1.15  2001/05/10 07:51:08  jason
#  change to prompt for OOB and JOB installs
#
#  Revision 1.14  2001/05/09 10:55:11  jason
#  added calls to install_check_products and install_other_products
#
#  Revision 1.13  2001/05/09 09:56:53  jason
#  change version and product lines which are generated in isam info file
#
#  Revision 1.12  2001/05/08 12:39:08  jason
#  changes for version file
#
#  Revision 1.11  2001/05/02 10:16:48  jason
#  change isql to demosql
#
#  Revision 1.10  2001/03/26 14:43:37  jason
#  Remove beta tag
#
#  Revision 1.9  2001/03/01 14:55:12  jason
#  copyright message needed amending
#
#  Revision 1.8  2001/03/01 13:23:06  jason
#  update for release
#
#  Revision 1.7  2000/11/08 16:57:02  jason
#  *** empty log message ***
#
#  Revision 1.6  2000/11/08 16:52:14  jason
#  *** empty log message ***
#
#  Revision 1.5  2000/11/08 16:12:17  jason
#  *** empty log message ***
#
#  Revision 1.4  2000/11/08 14:50:23  jason
#  change DRIVER from EASYSOFT_ISAM to ISAM
#
#  Revision 1.3  2000/11/08 13:44:48  jason
#  *** empty log message ***
#
#  Revision 1.2  2000/07/20 10:10:30  jason
#  *** empty log message ***
#
#  Revision 1.1  2000/07/20 09:18:06  jason
#  Initial revision
#
#
# Clear the screen
#
DRIVER="EASYSOFT_ISAM"
PRODUCTLONG="Easysoft Data Access for ISAM"

if [ -x /usr/bin/clear ]; then
  /usr/bin/clear
fi
if [ ! -x ./install ];then
  echo "You must run the install script from the directory created by"
  echo "untarring the main distribution file."
  exit 1
fi

#
# Output starting screen
#
cat <<EOF

Installation procedure for $PRODUCTLONG

(c) Easysoft Limited 1993-2024


Please read the file INSTALL.txt before attempting to install.

EOF
#
# Which echo?
#
if [ -x /bin/echo ];then
  ECHO="/bin/echo"
else
  if [ -x /usr/bin/echo ];then
    ECHO="/usr/bin/echo"
  else
    cat <<EOF
Cannot even find the echo command
EOF
  exit 1
  fi
fi
#
# echo interprets backslash chrs by default? POSIX says no.
#
test=`$ECHO "fred\c"`
if [ "$test" = "fred\c" ];then
  ECHO="$ECHO -e "
  test=`$ECHO "fred\c"`
  if [ "$test" != "fred" ];then
    cat <<EOF
echo command ($ECHO) does not interpret backslash characters.
You may see backslash c's when asked questions during this install.
You can safely ignore this except in Linux where you may need to
edit /etc/ld.so.conf to remove extra backslash n's from the lines added
by this script.
EOF
  fi
fi
export ECHO         # allow child scripts to see ECHO

#
# Introduction and licencing
#
./install_intro EASYSOFT_ISAM_intro.txt "" license.txt
if [ $? -ne 0 ];then
  exit $?
fi
  
#
# Check we have the tools we need.
#
./install_check_tools
if [ $? -ne 0 ];then
  exit $?
fi
  
LOWERCASE=""
if ( $ECHO "TeSt" | tr '[A-Z]' '[a-z]' 1>/dev/null 2>/dev/null )
then
  $ECHO "tr \c"
  lowctest=`$ECHO "TeSt" | tr '[A-Z]' '[a-z]'`
  if [ "$lowctest" != "test" ];then
    $ECHO
    $ECHO "Do not know how to use tr command to convert uppercase to lowercase"
  else
    LOWERCASE="tr '[A-Z]' '[a-z]'"
  fi
fi
if [ "$LOWERCASE" = "" ];then
  $ECHO "Trying dd"
  lowctest=`$ECHO "TeSt" | dd conv=lcase`
  if [ "$lowctest" != "test" ];then
    $ECHO "Do not know how to use dd command to convert uppercase to lowercase"
  else
    LOWERCASE="dd conv=lcase"
  fi
fi
if [ "$LOWERCASE" = "" ];then
  $ECHO "Trying sed"
  lowctest=`$ECHO "TeSt" | sed 'y/TES/tes/'`
  if [ "$lowctest" != "test" ];then
    $ECHO "Do not know how to use sed command to convert uppercase to lowercase"
    $ECHO "Cannot continue without a working tr, dd or sed command"
    exit 1
  else
    LOWERCASE="sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'"
  fi
fi
export LOWERCASE

$ECHO
$ECHO
#
# Set up vars used throughout.
#
INST_SUBDIR="easysoft"
INSTINFOFILE="isam_install.info" #where certain install information is recorded
DEFAULT_PATH="/usr/local"
SUPPORT_EMAIL="support@easysoft.com"
export SUPPORT_EMAIL
INSTALLED_UNIXODBC=""        # installed unixODBC DM?
INSTALLED_LDSO_LINKS=""      # Updated ld.so (linux only)

#
# See what platform we are on
# ===========================
#
PLATFORM=`uname -s`
platform=`uname -s | $LOWERCASE`
export platform
osrelease=`uname -r`
osversions=`uname -v`
#
# Platform specific differences
# =============================
#
# PIDARG is column is ps output where process ID shown
# PSARGS are the arguments to ps to generate process output that can be
# grepped for inetd's PID
#
echo "Installation for $platform chosen"
TARARGS="-xvf"
PIDARG="1"
TESTLINK="-L"
TESTEXISTS="-e"
DEMODSN="demo.dsn"
BLANKDSN="blank.dsn"
DRV="isam.drv"

SHARED_EXT=".so"

if [ "$platform" = "aix" ];then
  PSARGS="ax"
  SHARED_EXT=".a"
  DEMODSN="demo.dsn.aix"
  BLANKDSN="blank.dsn.aix"
  DRV="isam.drv.aix"
fi

if [ "$platform" = "hp-ux" ];then
  PSARGS="-ef"
  PIDARG="2"
  SHARED_EXT=".sl"
  DEMODSN="demo.dsn.hp-ux"
  BLANKDSN="blank.dsn.hp-ux"
  DRV="isam.drv.hp-ux"
fi

if [ "$platform" = "linux" ];then
  PSARGS="ax"
fi

if [ "$platform" = "sunos" ];then
  PSARGS="-ef"
  PIDARG="2"
  TESTEXISTS="-r"
  TESTLINK="-h"
fi

if [ "$platform" = "sco_sv" ];then
  PSARGS="-ef"
  PIDARG="2"
  TESTEXISTS="-r"
fi

if [ "$platform" = "freebsd" ];then
  PSARGS="ax"
  TESTLINK="-h"
fi

if [ "$platform" = "osf1" ];then
  PSAREGS="-ef"
  PIDARG="2"
fi

if [ "$platform" = "unixware" ];then
  PSARGS="-ef"
  PIDARG="2"
  TESTEXISTS="-r"
  TARARGS="-xvopf"
fi

if [ "$platform" = "sinix-n" ];then
  PSARGS="-ef"
  PIDARG="2"
  TESTEXISTS="-r"
  TESTLINK="-h"
fi

# UnixWare 2.1.3
if [ "$platform" = "unix_sv" ];then
  PSARGS="-ef"
  PIDARG="2"
  TESTEXISTS="-r"
fi

# caldera openunix 
if [ "$platform" = "openunix" ];then
  PSARGS="-ef"
  PIDARG="2"
  TESTEXISTS="-r"
fi

export TESTEXISTS       # make TESTEXISTS available to child scripts
export TESTLINK         # make TESTLINK available to child scripts

#
# Platform specific checks
#
# Linux - see what the highest version of libc installed is.
#
if [ "$platform" = "linux" ];then
  ./install_check_linux "$PRODUCTLONG" 1
  if [ $? != 0 ];then
     exit $?
  fi
fi
#
# Check the package
# =================
# 
# Check the tar file(s) exist (there may be more than one)
#  e.g. for multiple sub-packages
# Check the md5sum/sum is correct.
# 
####$ECHO "Press the return key to continue"
####read press
$ECHO
$ECHO "Checking your package is OK..."
TARPATTERN="*all*.tar"
TARFILE_LIST=`$ECHO $TARPATTERN`
exist=`$ECHO $TARFILE_LIST`
#
# If the shell did not expand *.tar then there can't be any matching
# tar files in this dir.
#
if [ "$exist" = "$TARPATTERN" ]; then
  $ECHO "Cannot find any tar file packages matching \"$TARPATTERN\" in"
  $ECHO "the current directory. Are you sure you are running the install"
  $ECHO "script in the same directory the first tar file was unpacked to?"
  exit 1
fi
#
# Find out how many tar files we have and check each one.
#
TARFILES=`$ECHO $TARFILE_LIST | wc -w | awk '{print $1}'`
$ECHO "Found $TARFILES package(s)"
for TARFILE in $TARFILE_LIST
do
  $ECHO "Checking $TARFILE"
  if [ ! -r $TARFILE ];then
    $ECHO "Cannot find readable $TARFILE file"
    exit 1
  fi
  #
  # Try checking the tar file with md5sum.
  #
  checked=""
  if [ -r $TARFILE.md5sum ];then
    sh -c md5sum < ./install 2> /dev/null 1> /dev/null
    if [ $? -eq 0 ];then
      HASMD5SUM="y"
    fi
    if [ "$HASMD5SUM" = "y" ]
    then
      check=`md5sum $TARFILE | awk '{print $1}'`
      check2=`cat $TARFILE.md5sum`
      if [ "$check" = "$check2" ];then
        checked="ok"
      else
        checked="fail"
      fi
    else
      #$ECHO "Can't find md5sum on this machine"
      $ECHO
    fi
  else
    #$ECHO "$TARFILE.md5sum not found - ignoring."
    $ECHO
  fi
  #
  # Try checking the tar file with sum.
  #
  if [ "$checked" = "" ];then
    if  [ -r $TARFILE.sum ];then
      if ( $ECHO "test" | sum 2> /dev/null 1> /dev/null )
      then
        check=`sum $TARFILE | awk '{print $1}'`
        check2=`cat $TARFILE.sum`
        if [ "$check" = "$check2" ];then
          checked="ok"
        else
          checked="fail"
        fi
      else
        $ECHO "Can't find sum on this machine"
      fi
    else
      $ECHO "$TARFILE.sum not found - ignoring,"
    fi
  fi
done

#
# Tar files not checksummed
# =========================
#
# If we failed to check a tar file then give the installer a chance to
# pull out of the installation.
#
if [ "$checked" = "" ];then
  $ECHO "Tarred packages not checked - can't find md5sum or sum."
  $ECHO "This package comes with a md5 message digest and a checksum."
  $ECHO "The installation was unable to check the package due to either"
  $ECHO "[1] failed to locate md5sum or sum."
  $ECHO "[2] failed to locate the md5 or checksum package files."
  $ECHO "It is not absolutely necessary to check your package in this way"
  $ECHO "and it is usually safe to continue."
  $ECHO
  $ECHO "Do you want to continue? (y/n) [n]: \c"
  answer="haha"
  while [ "$answer" != "" -a "$answer" != "n" -a "$answer" != "y" ]
  do
    read answer
    if [ "$answer" = "" ];then
      answer="n"
    fi
    if [ "$answer" != "y" ];then
      $ECHO "Installation terminated"
      exit 99
    fi
  done
fi
$ECHO "Package check - OK"
$ECHO
###$ECHO "Press the return key to continue"
####read press

#
# Check for root
# ==============
#
./install_check_root "$PRODUCTLONG" EASYSOFT_ISAM_check_root.txt 1
if [ $? -ne 0 ];then
  exit $?
fi


#
# Install Path
# ============
#
cat <<EOF
Installing $PRODUCTLONG

You need to enter a location for $PRODUCTLONG.
You should specify an existing directory under which the following
directories will be created

  $INST_SUBDIR/bin 
  $INST_SUBDIR/etc
  $INST_SUBDIR/isam
  $INST_SUBDIR/lib
  $INST_SUBDIR/license
  $INST_SUBDIR/unixODBC

You need write permission to the specified directory.
If the last directory in the path you specify does not exist the
installation will ask whether you would like it to be created.

Just hit <enter> for the defaults.
EOF

#
# Request and create installation path
# ====================================
#
path=""
while [ "$path" = "" ]
do
  $ECHO "Enter a base install directory (q=quit) [ $DEFAULT_PATH ]: \c"
  read path
  if [ "$path" = "q" ];then
    $ECHO "Installation aborted at user request"
    exit 99
  fi
  if [ "$path" = "" ];then
    path="$DEFAULT_PATH"
  fi
  if [ ! -d "$path" ]; then
    $ECHO "$path does not exist"
    $ECHO "Do you want to attempt to create it (y/n) [y]: \c"
    answer="hoho"
    while [ "$answer" != "" -a "$answer" != "n" -a "$answer" != "y" ]
    do
      read answer
      if [ "$answer" = "" ];then
        answer="y"
      fi
      if [ "$answer" = "y" ];then
        mkdir $path
	if [ $? -ne 0 ]
	then
          $ECHO "Failed to create $path"
	  path=""
	fi
      else
        path=""
      fi
    done
  elif [ ! -w "$path" ]; then
    $ECHO "$path is not writeable"
    path=""
  fi
done
$ECHO
#
# We now make the <install_path>/$INST_SUBDIR tree.
# INST_SUBDIR may have more than one dir in it.
#
$ECHO "Making install dir \c"
echo "$path/$INST_SUBDIR" | sed 's,//,/,g'
flds=`echo "$INST_SUBDIR" | sed 's,/, ,g'`
base=`echo "$INST_SUBDIR" | awk -F/ '{print $NF}'`
stem=""
for dir in $flds
do
  xpath=`echo $path/$stem/$dir | sed 's,//,/,g'`
  if [ -d "$path/$stem/$dir" ];then
    $ECHO "$xpath already exists."
    $ECHO
    if [ "$dir" = "$base" ];then
      $ECHO "If you are reinstalling then it is wise to delete"
      $ECHO "$path/easysoft/isam/bin and $path/easysoft/isam/lib"
      $ECHO "(as this will tell you if files are in use)."
      $ECHO
      $ECHO "If you are upgrading from a previous beta then Easysoft strongly"
      $ECHO "recommend you remove the previous beta first."
      $ECHO "However, you may continue if you wish."
      $ECHO ""
      $ECHO "Continue with install? (y/n) [y]: \c"
      answer="haha"
      while [ "$answer" != "" -a "$answer" != "n" -a "$answer" != "y" ]
      do
        read answer
        if [ "$answer" = "" ];then
          answer="y"
        fi
        if [ "$answer" != "y" ];then
          $ECHO "Installation terminated"
          exit 99
        fi
      done
    fi
  else
    if ( mkdir $xpath )
    then
      $ECHO "$xpath created"
    else
      $ECHO "Failed to create $xpath"
      exit 1
    fi
  fi
  stem="$stem/$dir"
done
#
#  If not installed in the default place provide a symbolic link from the
#  default to the actual or shared object runpaths won't work.
#
if [ "$path" != "$DEFAULT_PATH" ];then
cat <<EOF

You have not chosen the default path for installing 
$PRODUCTLONG. For the built-in shared object run paths to work the 
installation needs to link $DEFAULT_PATH/$INST_SUBDIR to $path/$INST_SUBDIR.

EOF
  answer="hoho"
  if [ "$TESTEXISTS" "$DEFAULT_PATH/$INST_SUBDIR" ];then
    $ECHO "but $DEFAULT_PATH/$INST_SUBDIR already exists"
    if [ "$TESTLINK" "$DEFAULT_PATH/$INST_SUBDIR" ];then
      $ECHO "and is a symbolic link."
      $ECHO "Do you want to replace the symbolic link"
      $ECHO "$DEFAULT_PATH/$INST_SUBDIR ? (y/n) [y]: \c"
      while [ "$answer" != "" -a "$answer" != "n" -a "$answer" != "y" ]
      do
  	read answer
  	if [ "$answer" = "" ];then
  	  answer="y"
  	fi
      done
    else
      $ECHO "and is not a symbolic link."
      $ECHO "Please see the INSTALL.txt file for information on how this may be corrected"
    fi
  else
    if [ ! "$TESTEXISTS" /usr/local ]; then
      if ( mkdir /usr/local )
      then
        $ECHO "/usr/local created"
      else
        $ECHO "Failed to create /usr/local"
      fi
    fi
    answer="y"
  fi
  if [ "$answer" = "y" ];then
    ln -sf $path/$INST_SUBDIR $DEFAULT_PATH/$INST_SUBDIR
    if [ $? -ne 0 ]; then
      $ECHO "**WARNING** Failed to create symbolic link"
      $ECHO "See INSTALL.txt file for information on how this may be corrected"
    fi
  fi
fi

#
# check to see if web admin server is running, if so stop it
#
$ECHO "Stopping any httpisam servers currently running"
https=`ps ${PSARGS} | grep "httpisam" | grep -v "grep"`
while [ -n "$https" ]
do
  if [ "$PIDARG" = "1" ];then
     pid=`echo $https | awk '{ print $1 }'`
  fi
  if [ "$PIDARG" = "2" ];then
     pid=`echo $https | awk '{ print $2 }'`
  fi
  echo "stopping httpisam (pid $pid)"
  kill -9 $pid > /dev/null
  https=`ps ${PSARGS} | grep "httpisam" | grep -v "grep"`
done
#
# platform variations
# ===================
#
if [ "$platform" = "aix" ];then
  if [ -x /usr/sbin/slibclean ];then
    /usr/sbin/slibclean
  fi
fi
#
cwd=`pwd`
cd $path/$INST_SUBDIR
$ECHO "Unpacking distribution"
tar "$TARARGS" $cwd/all*.tar
$ECHO
cd $cwd

#
# Record the version of ISAM installed
# Note this depends on the directory name.
#
VERSION=`pwd | sed 's|.*\([0-9]\{1,2\}\)\.\([0-9]\{1,2\}\)\.\([0-9]\{1,2\}\)\.\([0-9]\{1,3\}\).*|\1.\2.\3.\4|'`
$ECHO "product: eda-isam" >> $path/$INST_SUBDIR/$INSTINFOFILE
$ECHO "version: $VERSION" >> $path/$INST_SUBDIR/$INSTINFOFILE
$ECHO "date: \c" >> $path/$INST_SUBDIR/$INSTINFOFILE
date 2>/dev/null >> $path/$INST_SUBDIR/$INSTINFOFILE

#
# Cleanup old files these files have changed names 
#
rm -f /usr/local/easysoft/isam/doc/CHANGES 1>/dev/null 2>/dev/null
rm -f /usr/local/easysoft/isam/doc/README 1>/dev/null 2>/dev/null
rm -f /usr/local/easysoft/isam/doc/INSTALL 1>/dev/null 2>/dev/null

#
# Install unixODBC DM
# ===================
#
# Give the installer a chance to install unixODBC
#
####$ECHO "Press the return key to continue"
####read press
./uodbc install unixodbc $path/$INST_SUBDIR "$PRODUCTLONG" $DRIVER 1 0
if [ $? -gt 1 ];then
  $ECHO "Failed to install/locate unixODBC"
  exit 1
else
  if [ $? -eq 1 ];then
    INSTALLED_UNIXODBC="y"  # unixODBC DM was installed
  fi
fi

#
# Install Versioned Common Files
# ==============================
#
cwd=`pwd`
./install_versioned "$path/$INST_SUBDIR"
if [ $? -ne 0 ];then
  $ECHO "WARNING Failed to install all versioned files"
  $ECHO "Please mail Easysoft support at $SUPPORT_EMAIL"
fi
cd $cwd
chmod a+wr $path/easysoft/isam/schema
chmod a+wr $path/easysoft/isam/datatypes
chmod a+wr $path/easysoft/isam/demo/schema
chmod a+wr $path/easysoft/isam/demo/data

#
# Set LD_LIBRARY_PATH and LD_RUN_PATH so we can pick up unixODBC libs.
#
LDPATHLIBDIRS="$path/$INST_SUBDIR/lib:$path/$INST_SUBDIR/isam/lib"
if [ "$INSTALLED_UNIXODBC" != "" ];then
  LDPATHLIBDIRS="$LDPATHLIBDIRS:$path/$INST_SUBDIR/unixODBC/lib"
fi

LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LDPATHLIBDIRS"
export LD_LIBRARY_PATH
LD_RUN_PATH="$LD_RUN_PATH:$LDPATHLIBDIRS"
export LD_RUN_PATH
SHLIB_PATH="$SHLIB_PATH:$LDPATHLIBDIRS"
export SHLIB_PATH
LIBPATH="$LIBPATH:$LDPATHLIBDIRS"
export LIBPATH

LDLIBDIRS=`echo $LDPATHLIBDIRS | sed 's/:/ /g'`

#
# Install ld.so paths
# ===================
#
# To finish off the install for Linux, we need to add
# entries to the /etc/ld.so.conf file for the dynamic linker. We need to be
# root for that. In all cases we at least need to install the easysoft/lib dir.
#
./install_linkpaths "$PRODUCTLONG" $LDLIBDIRS
if [ $? -ne 0 ];then
  exit $?
fi
#
# Install esld.so.conf entries
#
./install_paths "$path/$INST_SUBDIR" $LDLIBDIRS
if [ $? -ne 0 ];then
  $ECHO "WARNING: esld.so.conf file not updated successfully"
fi
$ECHO "Press the return key to continue"
read press
#
# Checks for license file
#
cwd=`pwd`
./install_license "$PRODUCTLONG" $path/easysoft
cd $cwd

#
# Install ISAM Driver into unixODBC
#
./uodbc driver $path/easysoft/isam/etc/$DRV "$PRODUCTLONG" $DRIVER
#
# Check if EASYSOFT_ISAM datasource already exists first
#
./uodbc dsn $path/easysoft/isam/schema/$BLANKDSN "$PRODUCTLONG" $DRIVER 0
#
# Check if sample datasource already exists
#
./uodbc dsn $path/easysoft/isam/demo/$DEMODSN "$PRODUCTLONG" $DRIVER 0

$ECHO
$ECHO "** $PRODUCTLONG has been installed **"
$ECHO
####$ECHO "Press any key to continue"
####read answer

#
# Check here for any other products which may require installation
# at present only ODBC-ODBC Bridge has skip entries
#
cwd=`pwd`
$ECHO ""
$ECHO "Easysoft ODBC-ODBC Bridge (remote ODBC data access)"
$ECHO "==================================================="
$ECHO ""
$ECHO "The ODBC-ODBC Bridge provides access to remote ODBC datasources between "
$ECHO "any combination of supported platforms."
$ECHO ""
$ECHO "Do you require remote ODBC access to your ISAM data? (y/n) [y]: \c"
$ECHO "" > EASYSOFT_ISAM_products.txt
answer="haha"
while [ "$answer" != "" -a "$answer" != "n" -a "$answer" != "y" ]
do
  read answer
  if [ "$answer" = "" ];then
    answer="y"
  fi
done
if [ "$answer" = "y" ];then
  $ECHO "oob,odbc-odbc-bridge,y,1.5.1" >> EASYSOFT_ISAM_products.txt
fi

cwd=`pwd`
./install_check_products EASYSOFT_ISAM_products.txt EASYSOFT_ISAM_install_products.txt
if [ $? -ne 0 ];then
  exit $?
fi

cd $cwd
./install_other_products EASYSOFT_ISAM_install_products.txt ucl
if [ $? -ne 0 ];then
  exit $?
fi
cd $cwd

$ECHO ""
$ECHO "For information on setting up a client datasource see the file datasource.txt"
$ECHO "located in the $path/easysoft/isam directory."
$ECHO ""
$ECHO ""
$ECHO "Press the return key to continue"
read press
$ECHO ""
$ECHO "**"
$ECHO "** $PRODUCTLONG has been installed."
$ECHO "**"
$ECHO ""
$ECHO "This installation has setup an example datasource : "
$ECHO ""
$ECHO "  SAMPLE_ISAM : Sample test data supplied by easysoft"
$ECHO ""
$ECHO "To test that the installation was a success perform the following :"
$ECHO ""
$ECHO " $ cd /usr/local/easysoft/isam/bin"
$ECHO " $./demosql "
$ECHO ""
$ECHO "Information similiar to the following should be displayed : "                                              
$ECHO ""                                                                                                          
$ECHO "Easysoft Interactive SQL."                                                                                 
$ECHO "conn = :DSN=sample_isam;UID=dbo;PWD=easysoft;SQICOUNT=1;..."                              
$ECHO ""                                                                                                          
$ECHO "At the > prompt type : "                                                                                   
$ECHO "select * from supplier;           (press return)"
$ECHO ""
$ECHO "If Easysoft Data Access for ISAM is installed and running"
$ECHO "example data will be displayed from the supplier table."
$ECHO ""
$ECHO "Please note the sample_isam datasource SHOULD NOT be used"
$ECHO "to store definitions of your files as subsequent installations"
$ECHO "could overwrite your definitions!"
$ECHO ""
$ECHO "Press the return key to continue"
read press
$ECHO ""
$ECHO "Security Notice"
$ECHO "==============="
$ECHO ""
$ECHO "This installation has setup a datasource EASYSOFT_ISAM to be used "
$ECHO "for your file definitions. The default database owner (dbo user) "
$ECHO "password is set to easysoft, it is recommended that this is changed"
$ECHO "immediately."
$ECHO ""
$ECHO "To change the database owner password for a datasource follow this"
$ECHO "procedure : "
$ECHO ""
$ECHO "(example shows how to change password in EASYSOFT_ISAM datasoure)"
$ECHO ""
$ECHO "cd /usr/local/easysoft/isam/bin"
$ECHO "./user.sh -d EASYSOFT_ISAM"
$ECHO ""
$ECHO "when prompted for User Name enter dbo, you'll then be asked for the"
$ECHO "old password followed by the new password. After confirmation the dbo"
$ECHO "password will be changed."
$ECHO ""

exit 0
