upgrade revision 4b96f5a934679a5e6841dadd9da652f935c135ab
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# CDDL HEADER START
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# The contents of this file are subject to the terms of the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Common Development and Distribution License, Version 1.0 only
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# (the "License"). You may not use this file except in compliance
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# with the License.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# You can obtain a copy of the license at
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# trunk/opends/resource/legal-notices/OpenDS.LICENSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# See the License for the specific language governing permissions
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# and limitations under the License.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# When distributing Covered Code, include this CDDL HEADER in each
28b3569d6248168e6c00caab951521cc8141a49dAutomatic Updater# file and include the License file at
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# add the following below this CDDL HEADER, with the fields enclosed
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# by brackets "[]" replaced with your own identifying information:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Portions Copyright [yyyy] [name of copyright owner]
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# CDDL HEADER END
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Portions Copyright 2006-2007 Sun Microsystems, Inc.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# See if JAVA_HOME is set. If not, then see if there is a java executable in
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the path and try to figure it out.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinif test -z "${JAVA_BIN}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if test -z "${JAVA_HOME}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if test -f "${INSTANCE_ROOT}/bin/set-java-home"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein . "${INSTANCE_ROOT}/bin/set-java-home"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
ab8729140b1ad688ab03e1e9ce438fb1cbb49222Automatic Updater# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
ab8729140b1ad688ab03e1e9ce438fb1cbb49222Automatic Updater# system environment variables for security and compatibility reasons.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Capture the current working directory so that we can change to it later.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Then capture the location of this script and the Directory Server instance
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# root so that we can use them to create appropriate paths.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeincd "${WORKING_DIR}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Configure the appropriate CLASSPATH to test.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinfor JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Determine whether the detected Java environment is acceptable for use.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsif test -z "${JAVA_ARGS}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein "${JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein echo "ERROR: The detected Java version could not be used. Please set "
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein echo " JAVA_HOME to the root of a Java 5.0 installation."
acb72d5e2c83b597332e3eb0c7d59e1142f1adfdMark Andrews "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
acb72d5e2c83b597332e3eb0c7d59e1142f1adfdMark Andrews echo "ERROR: The detected Java version could not be used. Please set "
acb72d5e2c83b597332e3eb0c7d59e1142f1adfdMark Andrews echo " JAVA_HOME to the root of a Java 5.0 installation."
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Launch the build extractor.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Configure the appropriate CLASSPATH.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# BuildExtractor uses the existing install's
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein"${JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [ -r "./tmp/upgrade" ]
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Configure the appropriate CLASSPATH.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Unlike BuildExtractor, the Upgrader uses
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # the newly extracted build's jars.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Launch the upgrade process.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein "${JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Clean up if necessary
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [ -r "./tmp/upgrade" ]
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # URL FOR TESTING ONLY
b05bdb520d83f7ecaad708fe305268c3420be01dMark Andrews # JAVAWS_VM_ARGS="-Dorg.opends.quicksetup.upgrader.Root=$INSTANCE_ROOT -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein JAVAWS_VM_ARGS="-Xclearcache -Dorg.opends.quicksetup.upgrader.Root=$INSTANCE_ROOT"