setup revision 873
c20e7e3e6b1dd174c025487ceef713f07d77ba4bneil_a_wilson#!/bin/sh
c20e7e3e6b1dd174c025487ceef713f07d77ba4bneil_a_wilson#
c20e7e3e6b1dd174c025487ceef713f07d77ba4bneil_a_wilson# CDDL HEADER START
c20e7e3e6b1dd174c025487ceef713f07d77ba4bneil_a_wilson#
e4ff5e7757146c139160c3e78f4ac5ee1584dde5coulbeck# The contents of this file are subject to the terms of the
e4ff5e7757146c139160c3e78f4ac5ee1584dde5coulbeck# Common Development and Distribution License, Version 1.0 only
267e43ad6455f631dfdb9e552909a137b9e4f087boli# (the "License"). You may not use this file except in compliance
267e43ad6455f631dfdb9e552909a137b9e4f087boli# with the License.
267e43ad6455f631dfdb9e552909a137b9e4f087boli#
78ebdb0fc9f2a940f8385300ee5b4952d225b899boli# You can obtain a copy of the license at
a89f073e2246d8dc081ec584f19bbcd813b9a44cneil_a_wilson# trunk/opends/resource/legal-notices/OpenDS.LICENSE
a89f073e2246d8dc081ec584f19bbcd813b9a44cneil_a_wilson# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
a89f073e2246d8dc081ec584f19bbcd813b9a44cneil_a_wilson# See the License for the specific language governing permissions
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# and limitations under the License.
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson#
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# When distributing Covered Code, include this CDDL HEADER in each
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# file and include the License file at
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# add the following below this CDDL HEADER, with the fields enclosed
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# by brackets "[]" replaced with your own identifying information:
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# Portions Copyright [yyyy] [name of copyright owner]
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson#
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# CDDL HEADER END
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson#
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson#
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# Portions Copyright 2006-2007 Sun Microsystems, Inc.
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# See if JAVA_HOME is set. If not, then see if there is a java executable in
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson# the path and try to figure it out.
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilsonif test -z "${JAVA_BIN}"
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilsonthen
89bb69f651eab9fd3f4091800e226342444f2fb2neil_a_wilson if test -z "${JAVA_HOME}"
267e43ad6455f631dfdb9e552909a137b9e4f087boli then
03839fc8bfcf7f63ca2b9d3a48faabf94642b00bdugan if test -f "${INSTANCE_ROOT}/bin/set-java-home"
03839fc8bfcf7f63ca2b9d3a48faabf94642b00bdugan then
03839fc8bfcf7f63ca2b9d3a48faabf94642b00bdugan . "${INSTANCE_ROOT}/bin/set-java-home"
03839fc8bfcf7f63ca2b9d3a48faabf94642b00bdugan JAVA_BIN="${JAVA_HOME}/bin/java"
03839fc8bfcf7f63ca2b9d3a48faabf94642b00bdugan export JAVA_BIN
03839fc8bfcf7f63ca2b9d3a48faabf94642b00bdugan else
267e43ad6455f631dfdb9e552909a137b9e4f087boli JAVA_BIN=`which java 2> /dev/null`
267e43ad6455f631dfdb9e552909a137b9e4f087boli if test ${?} -eq 0
267e43ad6455f631dfdb9e552909a137b9e4f087boli then
78ebdb0fc9f2a940f8385300ee5b4952d225b899boli export JAVA_BIN
ae8010f9ddf526c96a9274296e01f6aa3f122d72neil_a_wilson else
3effb6e09816d45ff07f200fec2b6ecb9588fa7fneil_a_wilson echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
3effb6e09816d45ff07f200fec2b6ecb9588fa7fneil_a_wilson exit 1
3effb6e09816d45ff07f200fec2b6ecb9588fa7fneil_a_wilson fi
3effb6e09816d45ff07f200fec2b6ecb9588fa7fneil_a_wilson fi
3effb6e09816d45ff07f200fec2b6ecb9588fa7fneil_a_wilson else
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson JAVA_BIN="${JAVA_HOME}/bin/java"
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson export JAVA_BIN
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson fi
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilsonfi
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson# system environment variables for security and compatibility reasons.
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilsonPATH=/bin:/usr/bin
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilsonLD_LIBRARY_PATH=
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilsonLD_LIBRARY_PATH_32=
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilsonLD_LIBRARY_PATH_64=
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilsonLD_PRELOAD=
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonLD_PRELOAD_32=
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonLD_PRELOAD_64=
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson# Capture the current working directory so that we can change to it later.
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson# Then capture the location of this script and the Directory Server instance
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson# root so that we can use them to create appropriate paths.
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonWORKING_DIR=`pwd`
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsoncd `dirname "${0}"`
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonSCRIPT_DIR=`pwd`
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonINSTANCE_ROOT=${SCRIPT_DIR}
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonexport INSTANCE_ROOT
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsoncd "${WORKING_DIR}"
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson# Configure the appropriate CLASSPATH.
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonCLASSPATH=${INSTANCE_ROOT}/classes
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonfor JAR in ${INSTANCE_ROOT}/lib/*.jar
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsondo
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson CLASSPATH=${CLASSPATH}:${JAR}
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsondone
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonexport CLASSPATH
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson# Determine whether the detected Java environment is acceptable for use.
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonif test -z "${JAVA_ARGS}"
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonthen
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson "${JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson if test ${?} -eq 0
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson then
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson JAVA_ARGS="-client"
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson else
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson if test ${?} -ne 0
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson then
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson echo "ERROR: The detected Java version could not be used. Please set "
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson echo " JAVA_HOME to the root of a Java 5.0 installation."
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson exit 1
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson fi
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson fi
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonelse
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson if test ${?} -ne 0
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson then
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson echo "ERROR: The detected Java version could not be used. Please set "
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson echo " JAVA_HOME to the root of a Java 5.0 installation."
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson exit 1
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson fi
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilsonfi
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson# Launch the setup process.
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson"${JAVA_BIN}" org.opends.quicksetup.installer.InstallLauncher -P setup "${@}"
af6117fa729925b9e6cccbda589fecbb83f2b70fneil_a_wilson
7ea3e4667fd4a40f7792638bc429b36d8066557aneil_a_wilson