#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008-2010 Sun Microsystems, Inc.
# Portions Copyright 2010-2013 ForgeRock AS
#
# Display an error message
#
echo "Please set OPENDJ_JAVA_HOME to the root of a Java 6 update 10 (or higher) installation"
echo "or edit the java.properties file and then run the dsjavaproperties script to"
echo "specify the Java version to be used"
}
#
# function that tests the JAVA_HOME env variable.
#
if test -z "${JAVA_HOME}"
then
exit 1
else
OPENDJ_JAVA_BIN="${JAVA_HOME}/bin/java"
if test -f "${OPENDJ_JAVA_BIN}"
then
export OPENDJ_JAVA_BIN
else
exit 1
fi
fi
}
#
# function that tests the JAVA_BIN env variable.
#
if test -z "${JAVA_BIN}"
then
else
OPENDJ_JAVA_BIN="${JAVA_BIN}"
if test -f "${OPENDJ_JAVA_BIN}"
then
export OPENDJ_JAVA_BIN
else
fi
fi
}
#
# function that tests the java executable in the PATH env variable.
#
OPENDJ_JAVA_BIN=`which java 2> /dev/null`
if test -f "${OPENDJ_JAVA_BIN}"
then
export OPENDJ_JAVA_BIN
else
fi
}
#
# function that tests legacy OPENDS_JAVA_HOME env variable.
#
if test -z "${OPENDS_JAVA_HOME}"
then
else
OPENDJ_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
if test -f "${OPENDJ_JAVA_BIN}"
then
export OPENDJ_JAVA_BIN
else
fi
fi
}
#
# function that tests the OPENDJ_JAVA_HOME env variable.
#
if test -z "${OPENDJ_JAVA_HOME}"
then
else
OPENDJ_JAVA_BIN="${OPENDJ_JAVA_HOME}/bin/java"
if test -f "${OPENDJ_JAVA_BIN}"
then
export OPENDJ_JAVA_BIN
else
fi
fi
}
#
# function that tests the OPENDJ_JAVA_BIN env variable.
#
if test -z "${OPENDJ_JAVA_BIN}"
then
# Check for legacy OPENDS_JAVA_BIN
if test -z "${OPENDS_JAVA_BIN}"
then
else
if test -f "${OPENDS_JAVA_BIN}"
then
OPENDJ_JAVA_BIN="${OPENDS_JAVA_BIN}"
export OPENDJ_JAVA_BIN
else
fi
fi
else
if test -f "${OPENDJ_JAVA_BIN}"
then
export OPENDJ_JAVA_BIN
else
fi
fi
}
#
# function that sets the java home
#
if test -f "${INSTANCE_ROOT}/lib/set-java-home"
then
. "${INSTANCE_ROOT}/lib/set-java-home"
fi
}
# Function that sets OPENDJ_JAVA_ARGS if not yet set but OPENDS_JAVA_ARGS is.
if test -z "${OPENDJ_JAVA_ARGS}"
then
if test -n "${OPENDS_JAVA_ARGS}"
then
OPENDJ_JAVA_ARGS="${OPENDS_JAVA_ARGS}"
export OPENDJ_JAVA_ARGS
fi
fi
}
# Determine whether the detected Java environment is acceptable for use.
if test -z "${OPENDJ_JAVA_ARGS}"
then
RESULT_CODE=${?}
if test ${RESULT_CODE} -eq 13
then
# This is a particular error code that means that the Java version is 6
# but not supported. Let InstallDS to display the localized error message
exit 1
elif test ${RESULT_CODE} -ne 0
then
echo "ERROR: The detected Java version could not be used. The detected"
echo "Java binary is:"
echo "${OPENDJ_JAVA_BIN}"
echo "You must specify the path to a valid Java 6.0 update 10 or higher version."
echo "The procedure to follow is:"
echo "2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid "
echo "Java 6.0 installation."
echo "If you want to have specific Java settings for each command line you must"
echo "follow the steps 3 and 4."
echo "3. Edit the properties file specifying the Java binary and the Java arguments"
echo "for each command line. The Java properties file is located in:"
echo "${INSTANCE_ROOT}/config/java.properties."
echo "4. Run the command-line ${INSTANCE_ROOT}/bin/dsjavaproperties"
exit 1
fi
else
RESULT_CODE=${?}
if test ${RESULT_CODE} -eq 13
then
# This is a particular error code that means that the Java version is 6
# but not supported. Let InstallDS to display the localized error message
exit 1
elif test ${RESULT_CODE} -ne 0
then
echo "ERROR: The detected Java version could not be used with the set of Java"
echo "arguments ${OPENDJ_JAVA_ARGS}."
echo "The detected Java binary is:"
echo "${OPENDJ_JAVA_BIN}"
echo "You must specify the path to a valid Java 6.0 update 10 or higher version."
echo "The procedure to follow is:"
echo "2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid "
echo "Java 6.0 installation."
echo "If you want to have specific Java settings for each command line you must"
echo "follow the steps 3 and 4."
echo "3. Edit the properties file specifying the Java binary and the Java arguments"
echo "for each command line. The Java properties file is located in:"
echo "${INSTANCE_ROOT}/config/java.properties."
echo "4. Run the command-line ${INSTANCE_ROOT}/bin/dsjavaproperties"
exit 1
fi
fi
}
# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
# system environment variables for security and compatibility reasons.
export SCRIPT_NAME_ARG
}
# Configure the appropriate CLASSPATH.
CLASSPATH="${INSTANCE_ROOT}/classes"
do
done
CLASSPATH="${CLASSPATH}:${INSTALL_ROOT}/lib/bootstrap.jar"
if [ "${INSTALL_ROOT}" != "${INSTANCE_ROOT}" ]
then
do
done
fi
export CLASSPATH
}
do
then
return 0
fi
done
return 1
}
if test "${INSTALL_ROOT}" = ""
then
# Capture the current working directory so that we can change to it later.
# Then capture the location of this script and the Directory Server instance
# root so that we can use them to create appropriate paths.
WORKING_DIR=`pwd`
cd ..
INSTALL_ROOT=`pwd`
cd "${WORKING_DIR}"
fi
if test "${INSTANCE_ROOT}" = ""
then
if [ -f "${INSTALL_ROOT}/configure" ]
then
then
if [ "${SCRIPT_NAME}" = "configure" ]
then
if [ $? -eq 1 ]
then
echo "${INSTALL_ROOT}/configure has already been run. Exiting."
exit 0
fi
fi
else
if [ "${SCRIPT_NAME}" != "configure" ]
then
if [ $? -eq 1 ]
then
echo "No instance found. Run ${INSTALL_ROOT}/configure to create it."
exit 1
fi
fi
fi
else
if [ -f "${INSTALL_ROOT}/instance.loc" ]
then
/*)
;;
*)
;;
esac
else
fi
fi
if [ -d "${INSTANCE_ROOT}" ]
then
CURRENT_DIR=`pwd`
cd "${INSTANCE_ROOT}"
INSTANCE_ROOT=`pwd`
export INSTANCE_ROOT
cd "${CURRENT_DIR}"
fi
fi
if test "${SCRIPT_UTIL_CMD}" = "set-full-environment-and-test-java"
then
elif test "${SCRIPT_UTIL_CMD}" = "set-full-environment"
then
elif test "${SCRIPT_UTIL_CMD}" = "set-java-home-and-args"
then
elif test "${SCRIPT_UTIL_CMD}" = "set-environment-vars"
then
elif test "${SCRIPT_UTIL_CMD}" = "set-classpath"
then
elif test "${SCRIPT_UTIL_CMD}" = "test-java"
then
fi