27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# CDDL HEADER START
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# The contents of this file are subject to the terms of the
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# Common Development and Distribution License, Version 1.0 only
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# (the "License"). You may not use this file except in compliance
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# with the License.
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# See the License for the specific language governing permissions
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# and limitations under the License.
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# When distributing Covered Code, include this CDDL HEADER in each
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac# file and include the License file at legal-notices/CDDLv1_0.txt.
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac# If applicable, add the following below this CDDL HEADER, with the
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac# fields enclosed by brackets "[]" replaced with your own identifying
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac# information:
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# Portions Copyright [yyyy] [name of copyright owner]
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# CDDL HEADER END
8bf067f46db522a89becdd33572a68963ae5dce0jvergara# Copyright 2008-2010 Sun Microsystems, Inc.
a5b9f8fb834b1b2208e59a2fa76714bd91a5f147violette# Portions Copyright 2010-2013 ForgeRock AS
ebf178d895c6d928d23c9f22bc0520c9cb991086jvergara# Display an error message
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo echo "Please set OPENDJ_JAVA_HOME to the root of a Java 6 update 10 (or higher) installation"
ebf178d895c6d928d23c9f22bc0520c9cb991086jvergara echo "or edit the java.properties file and then run the dsjavaproperties script to"
ebf178d895c6d928d23c9f22bc0520c9cb991086jvergara# function that tests the JAVA_HOME env variable.
ebf178d895c6d928d23c9f22bc0520c9cb991086jvergara# function that tests the JAVA_BIN env variable.
ebf178d895c6d928d23c9f22bc0520c9cb991086jvergara# function that tests the java executable in the PATH env variable.
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo# function that tests legacy OPENDS_JAVA_HOME env variable.
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo# function that tests the OPENDJ_JAVA_HOME env variable.
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo# function that tests the OPENDJ_JAVA_BIN env variable.
ebf178d895c6d928d23c9f22bc0520c9cb991086jvergara# function that sets the java home
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo# Function that sets OPENDJ_JAVA_ARGS if not yet set but OPENDS_JAVA_ARGS is.
a3eae3a580853d8f1e40a236900143bef7b30a19abobrov# Determine whether the detected Java environment is acceptable for use.
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
da8294d71b7f77aa6cf6620af53b0ea864c2db8bjvergara if test ${RESULT_CODE} -eq 13
8fd3bbe5654a26bb33b1a3bbfd158f272ee0d18cludovicp # This is a particular error code that means that the Java version is 6
da8294d71b7f77aa6cf6620af53b0ea864c2db8bjvergara # but not supported. Let InstallDS to display the localized error message
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS -t
da8294d71b7f77aa6cf6620af53b0ea864c2db8bjvergara elif test ${RESULT_CODE} -ne 0
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara echo "ERROR: The detected Java version could not be used. The detected"
2ffcba79653c7f754d15fe9be1bf21378c601f81ludovicp echo "You must specify the path to a valid Java 6.0 update 10 or higher version."
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara echo "1. Delete the file ${INSTANCE_ROOT}/lib/set-java-home" if it exists.
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo echo "2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid "
de386868bf369f19a6d4ffeb2bbdd4aa2146d769jvergara echo "If you want to have specific Java settings for each command line you must"
de386868bf369f19a6d4ffeb2bbdd4aa2146d769jvergara echo "3. Edit the properties file specifying the Java binary and the Java arguments"
de386868bf369f19a6d4ffeb2bbdd4aa2146d769jvergara echo "for each command line. The Java properties file is located in:"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara echo "4. Run the command-line ${INSTANCE_ROOT}/bin/dsjavaproperties"
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
da8294d71b7f77aa6cf6620af53b0ea864c2db8bjvergara if test ${RESULT_CODE} -eq 13
8fd3bbe5654a26bb33b1a3bbfd158f272ee0d18cludovicp # This is a particular error code that means that the Java version is 6
da8294d71b7f77aa6cf6620af53b0ea864c2db8bjvergara # but not supported. Let InstallDS to display the localized error message
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS -t
da8294d71b7f77aa6cf6620af53b0ea864c2db8bjvergara elif test ${RESULT_CODE} -ne 0
de386868bf369f19a6d4ffeb2bbdd4aa2146d769jvergara echo "ERROR: The detected Java version could not be used with the set of Java"
2ffcba79653c7f754d15fe9be1bf21378c601f81ludovicp echo "You must specify the path to a valid Java 6.0 update 10 or higher version."
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara echo "1. Delete the file ${INSTANCE_ROOT}/lib/set-java-home" if it exists.
0f8553e2af5fc49a510ecfcfc93e66d06713f631ludo echo "2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid "
de386868bf369f19a6d4ffeb2bbdd4aa2146d769jvergara echo "If you want to have specific Java settings for each command line you must"
de386868bf369f19a6d4ffeb2bbdd4aa2146d769jvergara echo "3. Edit the properties file specifying the Java binary and the Java arguments"
de386868bf369f19a6d4ffeb2bbdd4aa2146d769jvergara echo "for each command line. The Java properties file is located in:"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara echo "4. Run the command-line ${INSTANCE_ROOT}/bin/dsjavaproperties"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# system environment variables for security and compatibility reasons.
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara export PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=${SCRIPT_NAME}
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# Configure the appropriate CLASSPATH.
06491301493f728fbf77ce1935549c11edab2247JnRouvignac CLASSPATH="${CLASSPATH}:${INSTALL_ROOT}/lib/bootstrap.jar"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara # Capture the current working directory so that we can change to it later.
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara # Then capture the location of this script and the Directory Server instance
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara # root so that we can use them to create appropriate paths.
d319724fed3be916a9f68676aac6eb203d44b551chebrard cd "${WORKING_DIR}"
b39429129734a9adb7ac0d662e2e378534d58415jvergara if [ -f "${INSTALL_ROOT}/configure" ]
6733dfd94dda39b3bce6e9fe9713d4d2379cbb85chebrard echo "${INSTALL_ROOT}/configure has already been run. Exiting."
2f9e866dc4cbcbfdc541e27291fee3f2435485ddchebrard echo "No instance found. Run ${INSTALL_ROOT}/configure to create it."
b39429129734a9adb7ac0d662e2e378534d58415jvergara if [ -f "${INSTALL_ROOT}/instance.loc" ]
d319724fed3be916a9f68676aac6eb203d44b551chebrard if [ -d "${INSTANCE_ROOT}" ]
d8ce179034d9423197a842266e78c67275c6b601ctissot cd "${INSTANCE_ROOT}"
d8ce179034d9423197a842266e78c67275c6b601ctissot cd "${CURRENT_DIR}"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergaraif test "${SCRIPT_UTIL_CMD}" = "set-full-environment-and-test-java"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergaraelif test "${SCRIPT_UTIL_CMD}" = "set-full-environment"
b39429129734a9adb7ac0d662e2e378534d58415jvergara elif test "${SCRIPT_UTIL_CMD}" = "set-java-home-and-args"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergaraelif test "${SCRIPT_UTIL_CMD}" = "set-environment-vars"