uninstall revision 37f9a536593b696e5a3dcec443e1475f22fb5afd
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara#!/bin/sh
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara#
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# CDDL HEADER START
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara#
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# The contents of this file are subject to the terms of the
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# Common Development and Distribution License, Version 1.0 only
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# (the "License"). You may not use this file except in compliance
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# with the License.
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara#
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# You can obtain a copy of the license at
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# trunk/opends/resource/legal-notices/OpenDS.LICENSE
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# See the License for the specific language governing permissions
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# and limitations under the License.
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara#
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# When distributing Covered Code, include this CDDL HEADER in each
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# file and include the License file at
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# add the following below this CDDL HEADER, with the fields enclosed
f71f7a61dec7c9089378d14493ad564a1dedf0b5neil_a_wilson# by brackets "[]" replaced with your own identifying information:
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# Portions Copyright [yyyy] [name of copyright owner]
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara#
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara# CDDL HEADER END
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara#
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara#
f71f7a61dec7c9089378d14493ad564a1dedf0b5neil_a_wilson# Portions Copyright 2006-2007 Sun Microsystems, Inc.
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara
b26e36d8a08a1c775531659c04abc3d4ed504139jvergara# This script may be used to uninstall the server.
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# system environment variables for security and compatibility reasons.
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraPATH=/bin:/usr/bin
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraLD_LIBRARY_PATH=
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraLD_LIBRARY_PATH_32=
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraLD_LIBRARY_PATH_64=
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraLD_PRELOAD=
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraLD_PRELOAD_32=
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraLD_PRELOAD_64=
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
c9d984b0d2c0fda320e79eb3868dd6fbeb1ffa34jvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# Capture the current working directory so that we can change to it later.
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# Then capture the location of this script and the Directory Server instance
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# root so that we can use them to create appropriate paths.
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraWORKING_DIR=`pwd`
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaracd `dirname "${0}"`
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraSCRIPT_DIR=`pwd`
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraINSTANCE_ROOT=${SCRIPT_DIR}
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraexport INSTANCE_ROOT
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaracd "${WORKING_DIR}"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# See if the environment variables are set. If not, then see if there is a java
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# executable in the path and try to figure it out.
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraif test -z "${OPENDS_JAVA_BIN}"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergarathen
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if test -z "${OPENDS_JAVA_HOME}"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara then
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if test -f "${INSTANCE_ROOT}/lib/set-java-home"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara then
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara . "${INSTANCE_ROOT}/lib/set-java-home"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara export OPENDS_JAVA_BIN
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara else
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if test -z "${JAVA_BIN}"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara then
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if test -z "${JAVA_HOME}"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara then
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara OPENDS_JAVA_BIN=`which java 2> /dev/null`
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if test ${?} -eq 0
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara then
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara export OPENDS_JAVA_BIN
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara else
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara exit 1
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara fi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara else
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara export OPENDS_JAVA_BIN
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara fi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara else
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara OPENDS_JAVA_BIN="${JAVA_BIN}"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara export OPENDS_JAVA_BIN
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara fi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara fi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara else
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara export OPENDS_JAVA_BIN
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara fi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergarafi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# Configure the appropriate CLASSPATH.
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraCLASSPATH=${INSTANCE_ROOT}/classes
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergarafor JAR in ${INSTANCE_ROOT}/lib/*.jar
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergarado
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara CLASSPATH=${CLASSPATH}:${JAR}
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaradone
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraexport CLASSPATH
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# Determine whether the detected Java environment is acceptable for use.
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraif test -z "${JAVA_ARGS}"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergarathen
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara "${OPENDS_JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if test ${?} -eq 0
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara then
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara JAVA_ARGS="-client"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara else
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if test ${?} -ne 0
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara then
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara echo "ERROR: The detected Java version could not be used. Please set "
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara exit 1
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara fi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara fi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraelse
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara if test ${?} -ne 0
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara then
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara echo "ERROR: The detected Java version could not be used. Please set "
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara exit 1
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara fi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergarafi
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# Launch the uninstall process.
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara"${OPENDS_JAVA_BIN}" -Dorg.opends.server.scriptName=uninstall org.opends.guitools.uninstaller.UninstallLauncher "${@}"
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara# return part
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraRETURN_CODE=$?
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraif test ${RETURN_CODE} -eq 50
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergarathen
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara # Version info was on requested
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara exit 0
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergaraelse
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergara exit ${RETURN_CODE}
37f9a536593b696e5a3dcec443e1475f22fb5afdjvergarafi