6331N/A#!/bin/ksh93
6331N/A
6331N/A# $Id: setup 554 2013-04-22 09:12:58Z elkner $
84N/A#
6331N/A# License: CDDL 1.0 (see http://opensource.org/licenses/cddl-1.0)
6331N/A# Copyright 2013 Jens Elkner
84N/A
6331N/A[[ ${FNTRACE} == 'ALL' || ${FNTRACE} == 'main' ]] && set -x
6331N/AINSTALL_ROOT="${.sh.file%/*}" SCRIPT_NAME='setup'
84N/A
6331N/A# Set env vars
6331N/A. "${INSTALL_ROOT}"/lib/_script-util.sh
6331N/AcheckEnv 'set-full-environment-and-test-java'
2650N/A
6331N/Ainteger INFO=0
6331N/AisVersionOrHelp "$@" && INFO=1
2650N/A
6331N/A# If running as ldapd it is assumed, that the target is a system instance
6331N/Aif (( ! INFO )) && [[ ${ uname -s ; } == 'SunOs' && ${ id -un ; } == 'ldapd' ]]
84N/Athen
6331N/A X=${ svcs -H -o state ${SMF_FMRI} 2>/dev/null ; }
6331N/A if [[ -z $X ]]; then
6331N/A print -u2 'The system does not know anything about the service' \
6331N/A "'${SMF_FMRI}'"
6331N/A exit 1
6331N/A fi
6331N/A if [[ $X != 'disabled' ]]; then
6331N/A # The script runs as the instance owner (default: ldapd), which should
6331N/A # not have solaris.smf.manage.opendj authorization. So trying to
6331N/A # disable it would yield an error anyway.
6331N/A #print -u2 "Trying to disable service '${SMF_FMRI}' ..."
6331N/A #/usr/sbin/svcadm disable -s "${SMF_FMRI}" || exit 1
6331N/A #print -u2 "Done."
6331N/A print -u2 "Service '${SMF_FMRI}' is not disabled." '
6331N/AUse the following command to disable it before starting setup again:
6331N/A\t' "svcadm disable ${SMF_FMRI}"
6331N/A exit 1
6331N/A fi
84N/Afi
84N/A
6331N/ARM_FILES="keystore.pin truststore keystore"
6331N/AEXISTING_FILES=' '
6331N/Afor F in ${RM_FILES} ; do
6331N/A [[ -f ${INSTANCE_ROOT}/config/$F ]] && EXISTING_FILES+="${F} "
6331N/Adone
6331N/A# Launch the setup
6331N/A# MaintainConfigArchive is needed, otherwise if the cli gets invoked, it writes
6331N/A# an archived config unconditionally _on startup_, which would prevent runnning
6331N/A# setup again, even if it did not succeed/was aborted in a previous run.
6331N/A"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
6331N/A -Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
6331N/A -Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
6331N/A -Dorg.opends.server.MaintainConfigArchive=false \
6331N/A org.opends.quicksetup.installer.SetupLauncher "$@"
6331N/ARC=$?
6331N/A(( ${INFO} )) && exit ${RC}
6331N/Aif (( ${RC} != 50 )); then
6331N/A # remove the files, which would people driving nuts, because a 2nd run
6331N/A # of setup would re-use them ...
6331N/A for F in ${RM_FILES} ; do
6331N/A FILE="${INSTANCE_ROOT}/config/$F"
6331N/A [[ ! -f ${FILE} ]] && continue
6331N/A [[ ${EXISTING_FILES// $F /} == ${EXISTING_FILES} ]] && rm -f "${FILE}"
6331N/A done
6331N/A exit ${RC}
3233N/Afi
6331N/Aexit 0