6331N/A#!/bin/ksh93
6331N/A#
6331N/A# $Id$
479N/A#
479N/A# CDDL HEADER START
479N/A#
479N/A# The contents of this file are subject to the terms of the
479N/A# Common Development and Distribution License, Version 1.0 only
479N/A# (the "License"). You may not use this file except in compliance
479N/A# with the License.
479N/A#
479N/A# You can obtain a copy of the license at
479N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE
479N/A# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
479N/A# See the License for the specific language governing permissions
479N/A# and limitations under the License.
479N/A#
479N/A# When distributing Covered Code, include this CDDL HEADER in each
479N/A# file and include the License file at
479N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
479N/A# add the following below this CDDL HEADER, with the fields enclosed
873N/A# by brackets "[]" replaced with your own identifying information:
479N/A# Portions Copyright [yyyy] [name of copyright owner]
479N/A#
479N/A# CDDL HEADER END
479N/A#
479N/A#
5236N/A# Copyright 2006-2010 Sun Microsystems, Inc.
6331N/A# Portions Copyright 2011 ForgeRock AS
6331N/A# Portions Copyright 2013 Jens Elkner
479N/A
479N/A# This script is used to invoke various client-side processes. It should not
479N/A# be invoked directly by end users.
6331N/A
6331N/A[[ ${FNTRACE} == 'ALL' || ${FNTRACE} == 'main' ]] && set -x
6331N/AINSTALL_ROOT="${.sh.file%/*/*}"
6331N/ACHECK=''
6331N/A
6331N/Aif [[ -z ${OPENDJ_INVOKE_CLASS} || -z ${SCRIPT_NAME} ]]; then
6331N/A SCRIPT_NAME=${.sh.file##*/}
6331N/A OIC=''
6331N/A case "$SCRIPT_NAME" in
6331N/A base64) #link
6331N/A OIC='org.opends.server.util.Base64'
6331N/A ;;
6331N/A control-panel) #link
6331N/A # display the control panel
6331N/A OIC='org.opends.guitools.controlpanel.ControlPanelLauncher'
6331N/A ;;
6331N/A create-rc-script) #link
6331N/A OIC='org.opends.server.tools.CreateRCScript'
6331N/A CHECK='-i'
6331N/A ;;
6331N/A dsconfig) #link
6331N/A # perform configuration ops on the server
6331N/A OIC='org.opends.server.tools.dsconfig.DSConfig'
6331N/A ;;
6331N/A dsframework) #link
6331N/A # perform ops with the global admin framework
6331N/A OIC='org.opends.server.admin.client.cli.DsFrameworkCliMain'
6331N/A ;;
6331N/A dsjavaproperties) #link
6331N/A # Basically reads $INSTANCE_ROOT/config/java.properties and creates
6331N/A # $INSTANCE_ROOT/lib/set-java-home, which gets sourced by
6331N/A # $INSTALL_ROOT/lib/_script-util.sh ...
6331N/A OIC='org.opends.server.tools.JavaPropertiesTool'
6331N/A CHECK='-i'
6331N/A ;;
6331N/A ldapcompare) #link
6331N/A # perform LDAP compare ops
6331N/A OIC='org.opends.server.tools.LDAPCompare'
6331N/A ;;
6331N/A ldapdelete) #link
6331N/A # perform LDAP delete ops
6331N/A OIC='org.opends.server.tools.LDAPDelete'
6331N/A ;;
6331N/A ldapmodify) #link
6331N/A # perform LDAP add, delete, modify, and modify DN ops
6331N/A OIC='org.opends.server.tools.LDAPModify'
6331N/A ;;
6331N/A ldappasswordmodify) #link
6331N/A # perform LDAP password modify ops
6331N/A OIC='org.opends.server.tools.LDAPPasswordModify'
6331N/A ;;
6331N/A ldapsearch) #link
6331N/A # perform LDAP search ops
6331N/A OIC='org.opends.server.tools.LDAPSearch'
6331N/A ;;
6331N/A manage-account) #link
6331N/A OIC='org.opends.server.tools.ManageAccount'
6331N/A ;;
6331N/A manage-tasks) #link
6331N/A # manage tasks in the Directory Server
6331N/A OIC='org.opends.server.tools.ManageTasks'
6331N/A ;;
6331N/A status) #link
6331N/A # display the status panel
6331N/A OIC='org.opends.server.tools.status.StatusCli'
6331N/A ;;
6331N/A esac
6331N/A OPENDJ_INVOKE_CLASS=${OIC}
479N/Afi
479N/A
6331N/Aif [[ -z ${OPENDJ_INVOKE_CLASS} ]]; then
6331N/A print -u2 'ERROR: OPENDJ_INVOKE_CLASS environment variable is not set.'
6331N/A exit 1
6331N/Afi
619N/A
2976N/A# Set environment variables
6331N/A. "${INSTALL_ROOT}"/lib/_script-util.sh
6331N/AcheckEnv ${CHECK} 'set-full-environment' "$@"
6331N/Aif [[ ${SCRIPT_NAME} == 'dsjavaproperties' ]] && ! isVersionOrHelp "$@" ; then
6331N/A # special for src/quicksetup/org/opends/quicksetup/util/Utils.java
6331N/A if [[ ${SCRIPT_UTIL_CMD} == 'set-full-environment-and-test-java' ]]; then
6331N/A checkEnv 'test-java' # set-full-environment already done above
6331N/A return 0
6331N/A fi
6331N/A # "OpenDJ Admin" (ODA) profile support: let the ODA specify as an additional
6331N/A # argument, what file to use (because per default ODA has no permission to
6331N/A # modify files in ${INSTANCE_ROOT}).
6331N/A [[ $1 == '-Q' ]] && FILE="$2" || FILE="$1"
6331N/A if [[ -f "${FILE}" ]]; then
6331N/A cp "${FILE}" "${INSTANCE_ROOT}"/config/java.properties || exit 1
6331N/A if [[ $1 == '-Q' ]]; then
6331N/A shift 2
6331N/A set -- '-Q' "$@"
6331N/A else
6331N/A shift
6331N/A fi
6331N/A fi
479N/Afi
479N/A
2976N/A# Launch the appropriate client utility.
6331N/A"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_ARGS} ${SCRIPT_NAME_ARG} \
6331N/A -Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
6331N/A -Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
6331N/A ${OPENDJ_INVOKE_CLASS} "$@"