setup revision 37f9a536593b696e5a3dcec443e1475f22fb5afd
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes#!/bin/sh
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes#
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# CDDL HEADER START
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes#
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# The contents of this file are subject to the terms of the
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg# Common Development and Distribution License, Version 1.0 only
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# (the "License"). You may not use this file except in compliance
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# with the License.
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes#
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# You can obtain a copy of the license at
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# trunk/opends/resource/legal-notices/OpenDS.LICENSE
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
0662ed52e814f8f08ef0e09956413a792584eddffuankg# See the License for the specific language governing permissions
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# and limitations under the License.
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes#
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# When distributing Covered Code, include this CDDL HEADER in each
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# file and include the License file at
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# add the following below this CDDL HEADER, with the fields enclosed
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# by brackets "[]" replaced with your own identifying information:
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# Portions Copyright [yyyy] [name of copyright owner]
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes#
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# CDDL HEADER END
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes#
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes#
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# Portions Copyright 2006-2007 Sun Microsystems, Inc.
70953fb44a7140fe206c3a5f011e24209c8c5c6abnicholes
70953fb44a7140fe206c3a5f011e24209c8c5c6abnicholes
44f575c8cb19a7a5cd61664a7848be6bc197df02fuankg# Capture the current working directory so that we can change to it later.
44f575c8cb19a7a5cd61664a7848be6bc197df02fuankg# Then capture the location of this script and the Directory Server instance
16b55a35cff91315d261d1baa776138af465c4e4fuankg# root so that we can use them to create appropriate paths.
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesWORKING_DIR=`pwd`
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholescd `dirname "${0}"`
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesSCRIPT_DIR=`pwd`
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesINSTANCE_ROOT=${SCRIPT_DIR}
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesexport INSTANCE_ROOT
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholescd "${WORKING_DIR}"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# See if the environment variables are set. If not, then see if there is a java
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# executable in the path and try to figure it out.
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesif test -z "${OPENDS_JAVA_BIN}"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesthen
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes if test -z "${OPENDS_JAVA_HOME}"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes then
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes if test -f "${INSTANCE_ROOT}/lib/set-java-home"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes then
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes . "${INSTANCE_ROOT}/lib/set-java-home"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes export OPENDS_JAVA_BIN
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes else
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes if test -z "${JAVA_BIN}"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes then
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes if test -z "${JAVA_HOME}"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes then
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes OPENDS_JAVA_BIN=`which java 2> /dev/null`
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes if test ${?} -eq 0
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes then
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes export OPENDS_JAVA_BIN
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes else
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes exit 1
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes fi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes else
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes export OPENDS_JAVA_BIN
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes fi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes else
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes OPENDS_JAVA_BIN="${JAVA_BIN}"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes export OPENDS_JAVA_BIN
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes fi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes fi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes else
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes export OPENDS_JAVA_BIN
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes fi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesfi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# system environment variables for security and compatibility reasons.
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesPATH=/bin:/usr/bin
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesLD_LIBRARY_PATH=
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesLD_LIBRARY_PATH_32=
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesLD_LIBRARY_PATH_64=
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesLD_PRELOAD=
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesLD_PRELOAD_32=
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesLD_PRELOAD_64=
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# Configure the appropriate CLASSPATH.
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesCLASSPATH=${INSTANCE_ROOT}/classes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesfor JAR in ${INSTANCE_ROOT}/lib/*.jar
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesdo
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes CLASSPATH=${CLASSPATH}:${JAR}
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesdone
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesexport CLASSPATH
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# Determine whether the detected Java environment is acceptable for use.
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesif test -z "${JAVA_ARGS}"
ac7985784d08a3655291f24f711812b4d8b1cbcffuankgthen
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes "${OPENDS_JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes if test ${?} -eq 0
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes then
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes JAVA_ARGS="-client"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes else
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes if test ${?} -ne 0
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes then
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes echo "ERROR: The detected Java version could not be used. Please set "
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes exit 1
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg fi
0662ed52e814f8f08ef0e09956413a792584eddffuankg fi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholeselse
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes if test ${?} -ne 0
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes then
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes echo "ERROR: The detected Java version could not be used. Please set "
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes exit 1
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes fi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesfi
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# Launch the setup process.
0662ed52e814f8f08ef0e09956413a792584eddffuankg"${OPENDS_JAVA_BIN}" -Dorg.opends.server.scriptName=setup org.opends.quicksetup.installer.SetupLauncher "${@}"
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# return part
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesRETURN_CODE=$?
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesif test ${RETURN_CODE} -eq 50
0662ed52e814f8f08ef0e09956413a792584eddffuankgthen
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes # Version info was on requested
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes exit 0
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholeselse
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes exit ${RETURN_CODE}
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholesfi