configure revision d3ce44d37110c284dad15122841fd97ee41d9ac5
335N/A#!/bin/sh
335N/A#
335N/A# CDDL HEADER START
335N/A#
335N/A# The contents of this file are subject to the terms of the
335N/A# Common Development and Distribution License, Version 1.0 only
335N/A# (the "License"). You may not use this file except in compliance
335N/A# with the License.
335N/A#
335N/A# You can obtain a copy of the license at
335N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE
335N/A# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
335N/A# See the License for the specific language governing permissions
335N/A# and limitations under the License.
335N/A#
335N/A# When distributing Covered Code, include this CDDL HEADER in each
335N/A# file and include the License file at
335N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
335N/A# add the following below this CDDL HEADER, with the fields enclosed
335N/A# by brackets "[]" replaced with your own identifying information:
3996N/A# Portions Copyright [yyyy] [name of copyright owner]
335N/A#
335N/A# CDDL HEADER END
335N/A#
335N/A#
335N/A# Copyright 2006-2008 Sun Microsystems, Inc.
335N/A# Portions Copyright 2011 ForgeRock AS
335N/A
844N/A
844N/A# Capture the current working directory so that we can change to it later.
335N/A# Then capture the location of this script and the Directory Server instance
618N/A# root so that we can use them to create appropriate paths.
1273N/AWORKING_DIR=`pwd`
335N/A
3661N/Acd "`dirname "${0}"`"
3661N/ASCRIPT_DIR=`pwd`
3996N/A
3996N/AINSTALL_ROOT=${SCRIPT_DIR}
3996N/Aexport INSTALL_ROOT
335N/A
335N/ASCRIPT_NAME=configure
335N/Aexport SCRIPT_NAME
335N/A
335N/Acd "${WORKING_DIR}"
335N/A
335N/A# Set environment variables
335N/ASCRIPT_UTIL_CMD=set-full-environment-and-test-java
335N/Aexport SCRIPT_UTIL_CMD
335N/A. "${INSTALL_ROOT}/lib/_script-util.sh"
335N/ARETURN_CODE=$?
335N/Aif test ${RETURN_CODE} -ne 0
335N/Athen
335N/A exit ${RETURN_CODE}
335N/Afi
335N/A
335N/A# Launch the configure process.
335N/A"${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} -DINSTALL_ROOT=${INSTALL_ROOT} org.opends.server.tools.configurator.Configurator "${@}"
335N/A
335N/A# return part
335N/ARETURN_CODE=$?
335N/Aif test ${RETURN_CODE} -eq 50 -o ${RETURN_CODE} -eq 51
335N/Athen
335N/A # Version or help info was on requested
335N/A exit 0
335N/Aelse
335N/Aif test ${RETURN_CODE} -eq 10
335N/Athen
335N/A # Syntax error
335N/A exit 1
335N/Aelse
335N/A if test ${RETURN_CODE} -eq 0
335N/A then
3996N/A # Retrieve INSTANCE_ROOT
3996N/A INSTANCE_ROOT=`cat /etc/opendj/instance.loc`
3996N/A # Now update SMF manifest, cp it to the right place and import it
3996N/A OWNER=`ls -ld ${INSTANCE_ROOT}`
CURRENT_IFS=${IFS}
IFS=" "
set -- ${OWNER}
USERNAME=`echo $3`
GROUPNAME=`echo $4`
IFS=${CURRENT_IFS}
if test "${USERNAME}" = "ldap" -a "$GROUPNAME" = "ldap"
then
cp ${INSTALL_ROOT}/resources/opendj-manifest.xml /var/svc/manifest/network/ldap/
else
cat ${INSTALL_ROOT}/resources/opendj-manifest.xml | sed -e "s/user='ldap/user='${USERNAME}/;s/group='ldap/group='${GROUPNAME}/" > /tmp/opendj-manifest.$$
cp /tmp/opendj-manifest.$$ /var/svc/manifest/network/ldap/opendj-manifest.xml
rm /tmp/opendj-manifest.$$
fi
/usr/sbin/svccfg import /var/svc/manifest/network/ldap/opendj-manifest.xml
fi
exit ${RETURN_CODE}
fi
fi