#!/usr/bin/ksh
#
# Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
#
# @(#)preconfig     1.0 03/07/15
#
###

# This script is ONLY applicable to the Installation context,
# so quietly exit with success if the ESM context is anything
# other than "install".
#
[ "$ESM_CONTEXT" = 'install' ] || exit 0

# Define the paths used by this script
SCRIPT=$0
SCRNAME=`basename $SCRIPT`
COMPONENT_DIR=`dirname $0`

# Include function libraries
. $ESM_BASE/lib/esm_lib.ksh
. $ESM_BASE/lib/esm_globals.ksh

. $COMPONENT_DIR/component_lib.ksh

if [ "$DEBUG" = "1" ]; then
    el_debug
    cl_debug
    el_secho 1 $ESM_LOG n "Local Environment Variables:"
    el_secho 1 $ESM_LOG n "    COMPONENT_DIR |$COMPONENT_DIR|"
    el_secho 1 $ESM_LOG n "    SCRIPT        |$SCRIPT|"
    el_secho 1 $ESM_LOG n "    SCRNAME       |$SCRNAME|"
fi

#------------------------------------------------------------------------------
# Check for the existence of a defined, non-null special environment variable
# used by QA for testing the installation to this point.  If it is defined,
# then immediately post an assertion that causes the installation to stop; the
# installation will appear to fail, but in actuality we are just stopping it.
#
if [ -n "$ESM_EXIT_FOR_CLI_PARSE_TESTING" ] ; then
  el_log 1 ""
  el_log 1 "*** The ESM_EXIT_FOR_CLI_PARSE_TESTING variable is defined ***"
  el_log 1 ""
  el_log 1 "The installation has been successful thus far, but will now stop"
  el_log 1 "as directed by the user due to this special variable being defined."
  el_log 1 ""

  exit 1
fi

exit 0
