upgrade revision f5bbd7023cc96dccff382d0f7911d356fcd9769d
551N/A#!/bin/sh
551N/A#
551N/A# CDDL HEADER START
551N/A#
1392N/A# The contents of this file are subject to the terms of the
551N/A# Common Development and Distribution License, Version 1.0 only
551N/A# (the "License"). You may not use this file except in compliance
919N/A# with the License.
919N/A#
919N/A# You can obtain a copy of the license at
919N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE
919N/A# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
919N/A# See the License for the specific language governing permissions
919N/A# and limitations under the License.
919N/A#
919N/A# When distributing Covered Code, include this CDDL HEADER in each
919N/A# file and include the License file at
919N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
919N/A# add the following below this CDDL HEADER, with the fields enclosed
919N/A# by brackets "[]" replaced with your own identifying information:
919N/A# Portions Copyright [yyyy] [name of copyright owner]
919N/A#
919N/A# CDDL HEADER END
919N/A#
551N/A#
551N/A# Portions Copyright 2006-2007 Sun Microsystems, Inc.
551N/A
551N/A
551N/A# See if JAVA_HOME is set. If not, then see if there is a java executable in
551N/A# the path and try to figure it out.
1392N/Aif test -z "${JAVA_BIN}"
1392N/Athen
1392N/A if test -z "${JAVA_HOME}"
1392N/A then
1392N/A if test -f "${INSTANCE_ROOT}/lib/set-java-home"
1392N/A then
1392N/A . "${INSTANCE_ROOT}/lib/set-java-home"
970N/A JAVA_BIN="${JAVA_HOME}/bin/java"
970N/A export JAVA_BIN
970N/A else
970N/A JAVA_BIN=`which java 2> /dev/null`
970N/A if test ${?} -eq 0
970N/A then
970N/A export JAVA_BIN
970N/A else
551N/A echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
551N/A exit 1
551N/A fi
551N/A fi
551N/A else
551N/A JAVA_BIN="${JAVA_HOME}/bin/java"
1097N/A export JAVA_BIN
1097N/A export JAVA_WS
1097N/A fi
1097N/Afi
551N/A
551N/A
551N/A# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
551N/A# system environment variables for security and compatibility reasons.
551N/APATH=/bin:/usr/bin
551N/ALD_LIBRARY_PATH=
551N/ALD_LIBRARY_PATH_32=
551N/ALD_LIBRARY_PATH_64=
1193N/ALD_PRELOAD=
1193N/ALD_PRELOAD_32=
1193N/ALD_PRELOAD_64=
551N/Aexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
1193N/A LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
1193N/A
1193N/A
551N/A# Capture the current working directory so that we can change to it later.
970N/A# Then capture the location of this script and the Directory Server instance
970N/A# root so that we can use them to create appropriate paths.
970N/AWORKING_DIR=`pwd`
551N/A
cd `dirname "${0}"`
SCRIPT_DIR=`pwd`
INSTANCE_ROOT=${SCRIPT_DIR}
export INSTANCE_ROOT
cd "${WORKING_DIR}"
# Configure the appropriate CLASSPATH to test.
for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
do
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