mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
28.50.2007 fd123dfd23f241e312dfa5e6430dc52cf4a0a98d
opendj-sdk/opends/resource/upgrade
@@ -25,36 +25,6 @@
#
#      Portions Copyright 2006-2007 Sun Microsystems, Inc.
# See if JAVA_HOME is set.  If not, then see if there is a java executable in
# the path and try to figure it out.
if test -z "${JAVA_BIN}"
then
  if test -z "${JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      JAVA_BIN="${JAVA_HOME}/bin/java"
      export JAVA_BIN
    else
      JAVA_BIN=`which java 2> /dev/null`
      if test ${?} -eq 0
      then
        export JAVA_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
    fi
  else
    JAVA_BIN="${JAVA_HOME}/bin/java"
    export JAVA_BIN
    export JAVA_WS
  fi
fi
# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
# system environment variables for security and compatibility reasons.
PATH=/bin:/usr/bin
@@ -81,6 +51,45 @@
cd "${WORKING_DIR}"
# See if the environment variables are set.  If not, then see if there is a java
# executable in the path and try to figure it out.
if test -z "${OPENDS_JAVA_BIN}"
then
  if test -z "${OPENDS_JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
      export OPENDS_JAVA_BIN
    else
      if test -z "${JAVA_BIN}"
      then
        if test -z "${JAVA_HOME}"
        then
          OPENDS_JAVA_BIN=`which java 2> /dev/null`
          if test ${?} -eq 0
          then
            export OPENDS_JAVA_BIN
          else
            echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
            exit 1
          fi
        else
          OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
          export OPENDS_JAVA_BIN
        fi
      else
        OPENDS_JAVA_BIN="${JAVA_BIN}"
        export OPENDS_JAVA_BIN
      fi
    fi
  else
    OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
    export OPENDS_JAVA_BIN
  fi
fi
# Configure the appropriate CLASSPATH to test.
for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
@@ -97,25 +106,25 @@
# 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
  "${OPENDS_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
    "${OPENDS_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."
      echo "        OPENDS_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
  "${OPENDS_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."
    echo "        OPENDS_JAVA_HOME to the root of a Java 5.0 installation."
    exit 1
  fi
fi
@@ -142,7 +151,7 @@
# operation is a reversion.  An exit code of 50 means that the usage
# statement was printed and there is nothing else to do
"${JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
"${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
RETURN_CODE=$?
if test ${RETURN_CODE} -eq 99
then
@@ -155,7 +164,7 @@
    CLASSPATH=${JAR}:${CLASSPATH}
  done
  # Launch the upgrade process.
  "${JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
  "${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
elif test ${RETURN_CODE} -eq 98
then
  # Copy jars to a temporary place from which to run the reverter
@@ -173,7 +182,7 @@
      CLASSPATH=${JAR}:${CLASSPATH}
    done
    # Launch the upgrade process.
    "${JAVA_BIN}" org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
    "${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
  fi
elif test ${RETURN_CODE} -eq 50
then