OpenGrok revision 9132ad6a7ba5525fd1a6ccd4f4bcb497385c8597
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# OpenGrok Wrapper (initial setup and cron job updating)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Supported Operating Systems:
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - Solaris 11 (SunOS 5.11)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - Solaris 12 (SunOS 5.12)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - Debian (Linux)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Supported Deployment Engines:
a55d0a9080c8ef4117d2fc27f63220a56afb2434Andreas Gustafsson# Supported Environment Variables:
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Supported Environment Variables for configuring the default setup:
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - EXUBERANT_CTAGS Full Path to Exuberant CTags
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# options for CTags program (for its --options
a55d0a9080c8ef4117d2fc27f63220a56afb2434Andreas Gustafsson# switch), default is DATA_ROOT/etc/ctags.config
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - JAVA_HOME Full Path to Java Installation Root
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - JAVA Full Path to java binary (to enable 64bit JDK)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - JAVA_OPTS Java options (e.g. for JVM memory increase
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# or enabling server JDK)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# JAVA_OPTS=-Xmx2048m is the default!
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# (contains domains)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_PROGRESS Shows progress in %(percentage) of working
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# through project, it's good to have Verbose
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Mode enabled too, cost of this is one more
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# traversal of the project before indexing it(*)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_REMOTE_REPOS Influence history cache generation for remote
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# repositories. Following values are recognized:
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# on - enabled (default)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# off - disabled for indexing and UI
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# dirbased - indexing enabled only for repos
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# which can fetch history for
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# uionly - enabled for UI only
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# (by default 3 directories from SRC_ROOT)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# (use "none" to avoid sending it to web app)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_WEBAPP_CONTEXT Context URL of the OpenGrok webapp
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# (by default /source)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - FULL reindex is needed once this is used
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# (old already indexed files won't be refreshed)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_WPREFIX Disable wildcard prefix search query
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_DERBY if set, then indexer tries to use derby as
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# historycache (see derby command of this
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_DERBY_URL Use specific URL to JavaDB, e.g.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# "jdbc:derby://localhost:1528/cachedb;create=true"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# (default port is 1527)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_TAG Enable parsing of revision tags into the History
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - READ_XML_CONFIGURATION file with read only configuration
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - temporary workaround for bug # 327
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_FLUSH_RAM_BUFFER_SIZE="-m 16" - set RAM buffer size for flushing,
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# default is 16MB per thread, you might try to
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# increase it to 256MB, but do increase JVM to
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# 4/8/16GB ! Lucene defaults to 8 threads.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Increase JVM memory as noted using JAVA_OPTS
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_LOGGER_CONFIG_PATH Set path to custom logging.properties file.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_SUBVERSION_USERNAME name of the user that should be used for
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# fetching the history from subversion
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_SUBVERSION_PASSWORD password of the user that should be used for
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# fetching the history from subversion
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# (*) Any Non-Empty String will enable these options
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Print usage to stdout and exit.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " ${progname} indexpart <src_root> <directory1> [..]"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " ${progname} clearHistory [<repository_name>]"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " OPENGROK_CONFIGURATION - location of your configuration"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " See the code for more information on configuration options /" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Runtime Configuration
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graffif [ -x "/bin/uname" ]; then
b9c829dc8fb7339d929ac12c6d768b3ab86bcd13Mark Andrewselif [ -x "/usr/bin/uname" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "Cannot determine operating system version"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# TODO: Handle symlinks correctly (especially in ${0})
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffSCRIPT_DIRECTORY="`cd ${SCRIPT_DIRECTORY}; pwd`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Default Instance Configuration
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Use the built-in defaults. This section can be copied to its own
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # file and tailored to your local requirements. Then simply set
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # this wrapper. It will save you hand editing in your settings
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # on each new release. A sample cron(1M) entry might look like:
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Note: It is not really possible to ever provided defaults for
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # these values which will run in every UNIX-like environment.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # So I have provided a set which are functional for a given
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # environment on which you can based you own configuration.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # This has been updated to support more environment variables and
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # operating systems, if you have any reasonably generic
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # improvements please feel free to submit a patch.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff -f "${SCRIPT_DIRECTORY}/dist/opengrok.jar" -a \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (your source code or the root of all repositories)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (for Lucene index and hypertext cross-references)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # This area is rebuilt by "update" / "updateQuietly"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: User Provided Source Path to Description Mapping
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (The user maintained source of the generated EftarFile file)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (the configuration used by Web/GUI interfaces)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: read only XML config, if it exists, it will be read
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_LOGGER_CONFIG_PATH}" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ ! -f "${OPENGROK_LOGGER_CONFIG_PATH}" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "File ${OPENGROK_LOGGER_CONFIG_PATH} does not exist"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONFIG_PATH=${OPENGROK_LOGGER_CONFIG_PATH}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: Java Archive of OpenGrok (Installation Location)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (user building from source code will find this and other key
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # files in the "dist" directory after the build is completed)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: Exuberant CTags (http://ctags.sf.net)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: supply extra command line options to CTags program
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_CTAGS_OPTIONS_FILE}" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff CTAGS_OPTIONS_FILE="${OPENGROK_CTAGS_OPTIONS_FILE}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff elif [ -r "${OPENGROK_INSTANCE_BASE}/etc/ctags.config" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff CTAGS_OPTIONS_FILE="${OPENGROK_INSTANCE_BASE}/etc/ctags.config"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Ignore these patterns as names of files or directories
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # To ignore skipping just the history cache creation for a particular
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # directory and all of it's subdirectories, touch an empty
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # .opengrok_skip_history file at the root of that directory
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (Every directory in SRC_ROOT is considered a separate project)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Scanning Options (for Mercurial repositories)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff REMOTE_REPOSITORIES="-r ${OPENGROK_REMOTE_REPOS}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: override depth of scanning for repositories
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff WEBAPP_CONFIG_ADDRESS=${OPENGROK_WEBAPP_CFGADDR}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Context URL of the OpenGrok webapp
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff WEBAPP_CONTEXT="-w ${OPENGROK_WEBAPP_CONTEXT}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Assumption: We should not set properties to the empty string
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${CVS:+-Dorg.opensolaris.opengrok.history.cvs=$CVS} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${SVN:+-Dorg.opensolaris.opengrok.history.Subversion=$SVN} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
d3646bfc0ec587c8e8d1161c0336efbec1795b2fBob Halley # OPTIONAL: Store The History Cache in Java DB (derby),
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # instead of file system (in gzipped xml files).
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # - derbyclient.jar - See README.txt for more details
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # - Running Derby Server - Defaults to localhost:1527
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff DERBY_OPTIONS="${DERBY_OPTIONS} -u ${OPENGROK_DERBY_URL}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Show revision tags in History view.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Turn this off if you want to increase indexing performance a bit
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Usage: <class> inputFile [inputFile ...] outputFile
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # HARDCODED: Generated EftarFile (See web/*.jsp)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Be Quiet? (set indirectly by command line arguments in the main program)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Helper Functions - Logging
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# In general, non-interactive use like cron jobs and automated
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# installation environments should not generate unnecessary
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# progress information or warnings, as usage and configuration
f93d33e24fdf76eb2558168f018b8992bcfc5681Andreas Gustafsson# will have generally been debugged prior to automation.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Helper Functions - Autodetection of Runtime Environment
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff file=`which "$f" 2>/dev/null | grep -v '^no '`
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Search for Exuberant ctags intelligently, skipping
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff for program in ctags-exuberant exctags ctags; do
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff $binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ $? -eq 0 ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ $found -eq 1 ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ $found -ne 1 ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Error "Unable to determine Exuberant CTags command name" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SunOS:5.10) javaHome="/usr/jdk/instances/jdk1.7.0" ;;
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Darwin:*) javaHome=`/usr/libexec/java_home` ;;
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff javaHome=`ls -l /etc/alternatives/java | cut -f 2 -d \> `
8f16e457f722681f67ee6af9c1cd39553f6dcc9aAndreas Gustafsson Error "Unable to determine Java 7 Home" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Use this function to determine which environment the deploy the
f93d33e24fdf76eb2558168f018b8992bcfc5681Andreas Gustafsson # web application function into. Some users (especially
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # developers) will have many deployment environments or will wish
f93d33e24fdf76eb2558168f018b8992bcfc5681Andreas Gustafsson # to specify directly the application server to deploy to.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Either use the environment variable OPENGROK_APP_SERVER or
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # reimplement this function in your configuration file (as
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # This implementation favours Tomcat, but needs a lot of work,
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # especially if Glassfish is perferrerd or it is under the control
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Maybe a better implementation would be to call Application
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Server specific WAR Directory and see if they exist.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -x "/etc/init.d/appserv" -a -d "/var/appserver/domains" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
483a5a91ada151e7edba90b98ce376b06b0013e3Mark Andrews FatalError "Missing Specified Glassfish Domain " \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff firstDomain=`ls -1 ${domainDirectory} | head -1`
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff FatalError "Failed to dynamically determine Glassfish Domain from " \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${domainDirectory}/${firstDomain}/autodeploy"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Implementation
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# The variable "DO" can usefully be set to "echo" to aid in script debugging
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Setup a standard execution environment (if required)
89ab7f672f83506098635c9c2e01d12ed32bb354Mark Andrews cronexec="/pkgs/sbin/CronExecutionEnvironment.sh"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-$cronexec}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Progress "Loading ${OPENGROK_STANDARD_ENV} ..."
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Load custom configuration and then fill remaining stuff with defaults.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Note: As all functions have been defined by the time this routine
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # is called, your configuration can, if desired, override functions
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # in addition to setting the variables mentioned in the function
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # DefaultInstanceConfiguration(), this maybe useful to override
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # functionality used to determine the default deployment environment
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # find dependencies or validate the configuration, for example.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Load the Local OpenGrok Configuration Environment
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Progress "Loading ${OPENGROK_CONFIGURATION} ..."
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff Progress "Loading the default instance configuration ..."
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff FatalError "Missing Dependent Application - Exuberant CTags"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence if [ `uname -s` == "SunOS" -a -d /opt/SUNWjavadb -a -d /usr/opengrok ];
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ! -r "/var/tomcat6/webapps/source/WEB-INF/lib/derbyclient.jar" ];
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence FatalError "JavaDB on but no derbyclient.jar under" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ ! -r "/usr/opengrok/lib/derbyclient.jar" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff FatalError "JavaDB on but no derbyclient.jar under" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Warning "CHECK: derbyclient.jar needs to be in where the rest of " \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff "opengrok used jars are and in unpacked source.war in " \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Progress " Attempting to create generated data directory ... "
if [ ! -d ${OPENGROK_INSTANCE_BASE}/log ]
${DO} mkdir ${OPENGROK_INSTANCE_BASE}/log
${DO} mkdir -p ${OPENGROK_INSTANCE_BASE}/derby
${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
${LOGGER_PROPERTIES} \
${JAVA_DEBUG} \
-jar ${OPENGROK_JAR} \
${IGNORE_PATTERNS} \
${DERBY_OPTIONS} \
${HISTORY_TAGS} \
${REMOTE_REPOSITORIES} \
${SCAN_DEPTH} \
${PROGRESS} \
${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
${CTAGS_OPTIONS_FILE:+-o} ${CTAGS_OPTIONS_FILE} \
${OPENGROK_FLUSH_RAM_BUFFER_SIZE} ${SKIN} ${LEADING_WILDCARD} \
${READ_XML_CONF} \
-W ${XML_CONFIGURATION} \
${SCAN_FOR_REPOSITORY} \
${ENABLE_PROJECTS} \
${WEBAPP_CONFIG} \
${WEBAPP_CONTEXT} \
-s ${SRC_ROOT} \
-d ${DATA_ROOT}
${DO} ${JAVA} -classpath ${OPENGROK_JAR} \
${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
SunOS:5.11)
SunOS:5.12)
mkdir -p $DATA_ROOT/derby
Linux:*)
mkdir -p $DATA_ROOT/derby