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