upgrade revision 1051
1051N/A#!/bin/sh
1051N/A#
1051N/A# CDDL HEADER START
1051N/A#
1051N/A# The contents of this file are subject to the terms of the
1051N/A# Common Development and Distribution License, Version 1.0 only
1051N/A# (the "License"). You may not use this file except in compliance
1051N/A# with the License.
1051N/A#
1051N/A# You can obtain a copy of the license at
1051N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE
1051N/A# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
1051N/A# See the License for the specific language governing permissions
1051N/A# and limitations under the License.
1051N/A#
1051N/A# When distributing Covered Code, include this CDDL HEADER in each
1051N/A# file and include the License file at
1051N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1051N/A# add the following below this CDDL HEADER, with the fields enclosed
1051N/A# by brackets "[]" replaced with your own identifying information:
1051N/A# Portions Copyright [yyyy] [name of copyright owner]
1051N/A#
1051N/A# CDDL HEADER END
1051N/A#
1051N/A#
1051N/A# Portions Copyright 2006-2007 Sun Microsystems, Inc.
1051N/A
1051N/A
1051N/A# See if JAVA_HOME is set. If not, then see if there is a java executable in
1051N/A# the path and try to figure it out.
1051N/Aif test -z "${JAVA_BIN}"
1051N/Athen
1051N/A if test -z "${JAVA_HOME}"
1051N/A then
1051N/A if test -f "${INSTANCE_ROOT}/bin/set-java-home"
1051N/A then
1051N/A . "${INSTANCE_ROOT}/bin/set-java-home"
1051N/A JAVA_BIN="${JAVA_HOME}/bin/java"
1051N/A export JAVA_BIN
1051N/A else
1051N/A JAVA_BIN=`which java 2> /dev/null`
1051N/A if test ${?} -eq 0
1051N/A then
1051N/A export JAVA_BIN
1051N/A else
1051N/A echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
1051N/A exit 1
1051N/A fi
1051N/A fi
1051N/A else
1051N/A JAVA_BIN="${JAVA_HOME}/bin/java"
1051N/A export JAVA_BIN
1051N/A fi
1051N/Afi
1051N/A
1051N/A
1051N/A# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
1051N/A# system environment variables for security and compatibility reasons.
1051N/APATH=/bin:/usr/bin
1051N/ALD_LIBRARY_PATH=
1051N/ALD_LIBRARY_PATH_32=
1051N/ALD_LIBRARY_PATH_64=
1051N/ALD_PRELOAD=
1051N/ALD_PRELOAD_32=
1051N/ALD_PRELOAD_64=
1051N/Aexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
1051N/A LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
1051N/A
1051N/A
1051N/A# Capture the current working directory so that we can change to it later.
1051N/A# Then capture the location of this script and the Directory Server instance
1051N/A# root so that we can use them to create appropriate paths.
1051N/AWORKING_DIR=`pwd`
1051N/A
1051N/Acd `dirname "${0}"`
1051N/ASCRIPT_DIR=`pwd`
1051N/A
1051N/AINSTANCE_ROOT=${SCRIPT_DIR}
1051N/Aexport INSTANCE_ROOT
1051N/A
1051N/Acd "${WORKING_DIR}"
1051N/A
1051N/A
1051N/A# Configure the appropriate CLASSPATH to test.
1051N/ACLASSPATH=${INSTANCE_ROOT}/classes
1051N/Afor JAR in ${INSTANCE_ROOT}/lib/*.jar
1051N/Ado
1051N/A CLASSPATH=${CLASSPATH}:${JAR}
1051N/Adone
1051N/Aexport CLASSPATH
1051N/A
1051N/A# Determine whether the detected Java environment is acceptable for use.
1051N/Aif test -z "${JAVA_ARGS}"
1051N/Athen
1051N/A "${JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
1051N/A if test ${?} -eq 0
1051N/A then
1051N/A JAVA_ARGS="-client"
1051N/A else
1051N/A "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
1051N/A if test ${?} -ne 0
1051N/A then
1051N/A echo "ERROR: The detected Java version could not be used. Please set "
1051N/A echo " JAVA_HOME to the root of a Java 5.0 installation."
1051N/A exit 1
1051N/A fi
1051N/A fi
1051N/Aelse
1051N/A "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
1051N/A if test ${?} -ne 0
1051N/A then
1051N/A echo "ERROR: The detected Java version could not be used. Please set "
1051N/A echo " JAVA_HOME to the root of a Java 5.0 installation."
1051N/A exit 1
1051N/A fi
1051N/Afi
1051N/A
1051N/A
1051N/A# Launch the uninstall process.
1051N/A"${JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"