upgrade revision 27f8adec83293fb8bd3bfa37175322b0ee3bb933
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# CDDL HEADER START
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# The contents of this file are subject to the terms of the
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# Common Development and Distribution License, Version 1.0 only
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# (the "License"). You may not use this file except in compliance
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# with the License.
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# You can obtain a copy of the license at
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# trunk/opends/resource/legal-notices/OpenDS.LICENSE
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# See the License for the specific language governing permissions
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# and limitations under the License.
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# When distributing Covered Code, include this CDDL HEADER in each
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# file and include the License file at
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# add the following below this CDDL HEADER, with the fields enclosed
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# by brackets "[]" replaced with your own identifying information:
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# Portions Copyright [yyyy] [name of copyright owner]
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# CDDL HEADER END
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# Portions Copyright 2006-2007 Sun Microsystems, Inc.
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# Capture the current working directory so that we can change to it later.
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# Then capture the location of this script and the Directory Server instance
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# root so that we can use them to create appropriate paths.
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_sutercd "${WORKING_DIR}"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# Set java home
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara. "${INSTANCE_ROOT}/lib/_script-util.sh"
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# Set environment variables
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara. "${INSTANCE_ROOT}/lib/_script-util.sh"
5b3741e0620fd2baaa974cecc2c2d953bb7d4fbbkenneth_suter# Configure the appropriate CLASSPATH to test.
857225469c51bedb8c0566aa7757800cfaac4075kenneth_suterfor JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
857225469c51bedb8c0566aa7757800cfaac4075kenneth_suterCLASSPATH=${CLASSPATH}:${INSTANCE_ROOT}/classes
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara# Test the java installation
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara. "${INSTANCE_ROOT}/lib/_script-util.sh"
d18ac24c35f0fd0cd2414730ebce9edcfea8b47ekenneth_suterif [ -r "${INSTANCE_ROOT}/tmp/upgrade" ]
358aa64445313154ce8f5e0acca0966f5a40fa0bkenneth_suter# Launch the build extractor.
358aa64445313154ce8f5e0acca0966f5a40fa0bkenneth_suter# Configure the appropriate CLASSPATH.
358aa64445313154ce8f5e0acca0966f5a40fa0bkenneth_suter# BuildExtractor uses the existing install's
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter# Run the build extractor first. An exit code of 99 from the extractor
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter# means that this is indeed an upgrade (as opposed to a reversion) and
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter# that the upgrade should continue. An exit code of 98 means that this
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter# operation is a reversion. An exit code of 50 means that the usage
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter# statement was printed and there is nothing else to do
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara"${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} org.opends.quicksetup.upgrader.BuildExtractor "${@}"
a68203de3c573de383ff57dc62a62ef102344985kenneth_suter # Configure the appropriate CLASSPATH.
358aa64445313154ce8f5e0acca0966f5a40fa0bkenneth_suter # Unlike BuildExtractor, the Upgrader uses
358aa64445313154ce8f5e0acca0966f5a40fa0bkenneth_suter # the newly extracted build's jars.
358aa64445313154ce8f5e0acca0966f5a40fa0bkenneth_suter CLASSPATH=${INSTANCE_ROOT}/tmp/upgrade/classes
358aa64445313154ce8f5e0acca0966f5a40fa0bkenneth_suter for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
358aa64445313154ce8f5e0acca0966f5a40fa0bkenneth_suter # Launch the upgrade process.
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter # Copy jars to a temporary place from which to run the reverter
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter # in order to avoid potential file lock issues.
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter echo "ERROR: Failed to initialize reversion."
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter for JAR in ${INSTANCE_ROOT}/tmp/revert/lib/*.jar
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter # Launch the upgrade process.
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
da7ab15aee42edf1c4ff33f66ca717f019b4a578lutoff # Version info was on requested
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter # Usage printed
bae806fb480fd70aa10de1cfdc7850ae6f95cb81kenneth_suter # Some unknown return code returned