#
# $Id$
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008-2010 Sun Microsystems, Inc.
# Portions Copyright 2010-2011 ForgeRock AS
# Portions Copyright 2013 Jens Elkner
# Fallback to use on non-SunOS
# Fallback to use on SunOS
#
# Display an error message
#
print -u2 '
Please set OPENDJ_JAVA_HOME to the root of a Java 6 update 10 (or higher)
installation or edit the java.properties file and then run the dsjavaproperties
script to specify the Java version to be used.'
}
# function that tests the JAVA_HOME env variable.
[[ -z ${JAVA_HOME} ]] && display_java_not_found_error && exit 999
export OPENDJ_JAVA_BIN="${JAVA_HOME}/bin/java"
[[ ! -x ${OPENDJ_JAVA_BIN} ]] && display_java_not_found_error && exit 999
}
# function that tests the JAVA_BIN env variable.
export OPENDJ_JAVA_BIN="${JAVA_BIN}"
return
fi
}
# function that tests the java executable in the PATH env variable.
[[ -n $OPENDJ_JAVA_BIN && -x ${OPENDJ_JAVA_BIN} ]] && return
}
# function that tests the OPENDJ_JAVA_HOME env variable.
if [[ -z ${OPENDJ_JAVA_HOME} ]]; then
return
fi
export OPENDJ_JAVA_BIN="${OPENDJ_JAVA_HOME}/bin/java"
[[ -x ${OPENDJ_JAVA_BIN} ]] || test_java_path
}
# function that tests the OPENDJ_JAVA_BIN env variable.
if [[ -z ${OPENDJ_JAVA_BIN} ]]; then
elif [[ -x ${OPENDJ_JAVA_BIN} ]]; then
export OPENDJ_JAVA_BIN
else
fi
}
# function that sets the java home
[[ -r ${INSTANCE_ROOT}/lib/set-java-home ]] && \
}
# Determine whether the detected Java environment is acceptable for use.
# this call just tests the java version compatibility (for now: If the
# JVM vendor is "Sun Microsystems Inc.", than JVM version string must be
# lexicographically greater or equal to 1.6.0_10. Otherwise it is
# assumed, that the JVM is compatible) and known args.
org.opends.server.tools.InstallDS --testOnly 2>&1 ; }
integer RC=$?
# This is a particular error code that means that the Java version
# is not supported. Let InstallDS to display the localized error msg
print -u2 "${ERRMSG}"
exit 999
fi
# the error message includes the "Usage info" - so strip off the bloat
ERRMSG="${ERRMSG%%$'\n\n'This utility*}"
print -u2 "Argument parse error(s):${ERRMSG##*arguments:}"
'environment variable (if explicitly set), check your' \
"'${INSTALL_ROOT}/bin/dsjavaproperties'."
exit 999
fi
print -u2 "${ERRMSG}"
exit 999
fi
# Since no other tests are done, this must be a JVM error.
[[ -n ${OPENDJ_JAVA_ARGS} ]] && \
print -u2 '
To fix the problem:
1. Delete the following file if it exists:
2. Check the Java properties file for correct *.java-home and *.java-args
settings. See:
3. Run the following command-line tool to persist the changes made:
4. When you run an OpenDJ tool, make sure, that OPENDJ_* environment
variables are not already set.'
exit 999
}
# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
# system environment variables for security and compatibility reasons.
# first unset everything we definitely do not need
typeset KEEP=' COLUMNS DBUS_SESSION_BUS_ADDRESS DEFAULT_INSTANCE_DIR DEFAULT_SMF_FMRI DISPLAY FNLIST FNTRACE HOME HOST INSTALL_ROOT INSTANCE_ROOT JAVA_BIN JAVA_HOME KSH_VERSION LANG LC_COLLATE LC_CTYPE LC_MESSAGES LC_TIME LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64 LINENO LINES LOGNAME MISC_ARGS NLSPATH OLD_SCRIPT_NAME OPENDJ_INVOKE_CLASS OPENDJ_JAVA_ARGS OPENDJ_JAVA_BIN OPENDJ_JAVA_HOME OPTIND ORIGINAL_JAVA_ARGS ORIGINAL_JAVA_BIN ORIGINAL_JAVA_HOME PATH PPID PS1 PS2 PS3 PS4 PWD RANDOM REMOTEHOST SCRIPT_ARGS SCRIPT_NAME SCRIPT_NAME_ARG SCRIPT_UTIL_CMD SECONDS SESSION_MANAGER SHELL SHLVL SMF_FMRI SSH_AGENT_PID SSH_AUTH_SOCK TERM TMOUT TMPDIR TZ USER USERNAME XAUTHORITY XDG_DATA_DIRS XDG_SESSION_COOKIE _AST_FEATURES _ VAR KEEP PWD '
set | while read LINE ; do
unset VAR
done
typeset -n VAR
for VAR in LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64 ; do
done
SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=${SCRIPT_NAME}"
# LD_LIBRARY_PATH='' LD_LIBRARY_PATH_32='' LD_LIBRARY_PATH_64='' \
# LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64
}
# Configure the appropriate CLASSPATH.
typeset JAR
CLASSPATH=''
done
if [[ ${INSTALL_ROOT} != ${INSTANCE_ROOT} ]]; then
done
fi
}
typeset opt
'-V'|'--version'|'-?'|'-H'|'--help'|'-F'|'--fullversion') return 0;;
esac
done
return 1
}
typeset PROPVAL=''
# remove space escaping backslashes
PROPVAL="${PROPVAL//\\ / }"
fi
# Actually this should never happen, however, sometimes people are
# really smart ;-)
print -u2 '
It should point to the OpenDJ data directory for this service instance.
Please set it and try again. E.g.:
svccfg -s '"${SMF_FMRI}"' refresh
'
exit 999
fi
fi
if [[ -z ${PROPVAL} ]]; then
&& PROPVAL=${DEFAULT_INSTANCE_ROOT} \
fi
print -- "${PROPVAL}"
}
# Try to give the user a hint. Actually this should be done by the
# application/utility and return an appropriate error code, but it doesn't :(
typeset EXT=''
# Or if one wants check for populated instances, only.
# if [[ ( -f ${INSTANCE_ROOT}/config/config.ldif ) \
# && -n ${ ls ${INSTANCE_ROOT}/config/archived-configs/*.gz 2>/dev/null; } \
# then
# return
# fi
print -u2 '
It seems, that the following service has not yet been initialized:
\t'"${SMF_FMRI}"'
Please run' "${INSTALL_ROOT}/setup" '.\n'
else
print -u2 '
seems to contain no valid data. If you want to use a different instance data
directory, set your INSTANCE_ROOT environment variable to the appropriate
path. Otherwise, to initialize the shown directory shown above, run
'"${INSTALL_ROOT}/setup"' .\n'
fi
exit 999
}
integer CHECK_INSTANCE=0
typeset SCRIPT_UTIL_CMD="$1"
# Capture the location of this script so that we can use them to create
# appropriate paths.
INSTALL_ROOT="${.sh.file%/*/*}"
print -u2 "\nWARNING: ${SCRIPT_NAME} should not be run as user 'root'!\n"
fi
# If no SMF_FMRI is set (interactive use), we choose the default instance.
'set-full-environment-and-test-java')
;;
'set-full-environment')
;;
'set-java-home-and-args')
;;
'set-environment-vars')
;;
'set-classpath')
;;
'test-java')
;;
esac
# No check for --version or --help option
}
# list all defined script functions known at this point
[[ -n ${FNLIST} ]] && typeset +f
# If set to 'ALL', trace all functions, otherwise trace only the functions whose
# name is in this comma or whitespace separated list
if [[ -n ${FNTRACE} ]]; then
fi