OpenGrok revision 9132ad6a7ba5525fd1a6ccd4f4bcb497385c8597
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#!/bin/sh
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# OpenGrok Wrapper (initial setup and cron job updating)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
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#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Supported Deployment Engines:
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - Tomcat 7
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - Tomcat 6
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - Glassfish
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
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#
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# directory
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# support (*)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# - OPENGROK_DERBY if set, then indexer tries to use derby as
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# historycache (see derby command of this
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# script)
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# view
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#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Notes:
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# (*) Any Non-Empty String will enable these options
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Print usage to stdout and exit.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffUsage()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff progname=`basename $0`
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff exec >&2
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo ""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " ${progname} index [<directory>]"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " ${progname} indexpart <src_root> <directory1> [..]"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " ${progname} clearHistory [<repository_name>]"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo ""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " Optional environment variables:"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " OPENGROK_CONFIGURATION - location of your configuration"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo ""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo " See the code for more information on configuration options /" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff "variables"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo ""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff exit 1
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Runtime Configuration
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graffif [ -x "/bin/uname" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OS_NAME="`/bin/uname -s`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OS_VERSION="`/bin/uname -r`"
b9c829dc8fb7339d929ac12c6d768b3ab86bcd13Mark Andrewselif [ -x "/usr/bin/uname" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OS_NAME="`/usr/bin/uname -s`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OS_VERSION="`/usr/bin/uname -r`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graffelse
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "Cannot determine operating system version"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff exit 1
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Grafffi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# TODO: Handle symlinks correctly (especially in ${0})
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffSCRIPT_DIRECTORY="`dirname ${0}`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffSCRIPT_DIRECTORY="`cd ${SCRIPT_DIRECTORY}; pwd`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Default Instance Configuration
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffDefaultInstanceConfiguration()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
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
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
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
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONFIG_FILE="logging.properties"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -d "${SCRIPT_DIRECTORY}/dist" -a \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff -f "${SCRIPT_DIRECTORY}/dist/opengrok.jar" -a \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff -f "${SCRIPT_DIRECTORY}/dist/source.war" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Handle Developer Build Environments
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff else
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Handle Binary Distributions
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 fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: Source Code/Repository Root
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (your source code or the root of all repositories)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SRC_ROOT="${OPENGROK_INSTANCE_BASE}/src"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: OpenGrok Generate Data Root
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (for Lucene index and hypertext cross-references)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # This area is rebuilt by "update" / "updateQuietly"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff DATA_ROOT="${OPENGROK_INSTANCE_BASE}/data"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: User Provided Source Path to Description Mapping
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (Tab Separated Value)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (The user maintained source of the generated EftarFile file)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: XML Configuration
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (the configuration used by Web/GUI interfaces)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: read only XML config, if it exists, it will be read
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -f "${READ_XML_CONFIGURATION}" ] ; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff READ_XML_CONF="-R ${READ_XML_CONFIGURATION}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: Logger 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 exit 1
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONFIG_PATH=${OPENGROK_LOGGER_CONFIG_PATH}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff else
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: Java Archive of OpenGrok (Installation Location)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
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
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: Exuberant CTags (http://ctags.sf.net)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
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 fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: Java Home
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff JAVA_HOME="${JAVA_HOME:-`FindJavaHome`}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff export JAVA_HOME
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # REQUIRED: Java Virtual Machine
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff JAVA="${JAVA:-$JAVA_HOME/bin/java}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # port 8010 until a debugger connects
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Ignore these patterns as names of files or directories
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #IGNORE_PATTERNS="-i dummy"
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
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Enable Projects
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (Every directory in SRC_ROOT is considered a separate project)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ENABLE_PROJECTS="-P"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Scanning Options (for Mercurial repositories)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SCAN_FOR_REPOSITORY="-S"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_SCAN_REPOS}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SCAN_FOR_REPOSITORY=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff REMOTE_REPOSITORIES="-r on"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_REMOTE_REPOS}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff REMOTE_REPOSITORIES="-r ${OPENGROK_REMOTE_REPOS}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: override depth of scanning for repositories
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_SCAN_DEPTH}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SCAN_DEPTH="-z${OPENGROK_SCAN_DEPTH}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Allow Leading Wildcard Searches
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (default: on)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LEADING_WILDCARD="-a on"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_WPREFIX}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff LEADING_WILDCARD=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Web Site Look & Feel
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (Options: default, offwhite and polished.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Note the quoting requirements)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #SKIN='-L default'
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Configuration Address (host:port)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (conf/web.xml default is localhost:2424)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff WEBAPP_CONFIG=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_WEBAPP_CFGADDR}" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff WEBAPP_CONFIG_ADDRESS=${OPENGROK_WEBAPP_CFGADDR}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff WEBAPP_CONFIG_ADDRESS=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff else
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff WEBAPP_CONFIG_ADDRESS="localhost:2424"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${WEBAPP_CONFIG_ADDRESS}" ]; then
d3646bfc0ec587c8e8d1161c0336efbec1795b2fBob Halley WEBAPP_CONFIG="-U ${WEBAPP_CONFIG_ADDRESS}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Context URL of the OpenGrok webapp
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # (default is /source)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff WEBAPP_CONTEXT=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_WEBAPP_CONTEXT}" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff WEBAPP_CONTEXT="-w ${OPENGROK_WEBAPP_CONTEXT}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: JVM Options
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff JAVA_OPTS="${JAVA_OPTS:--Xmx2048m}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Full Path to History Utilities
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff HG="`Which hg`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff CVS="`Which cvs`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SVN="`Which svn`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SCCS="`Which sccs`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff CLEARCASE="`Which cleartool`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff GIT="`Which git`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff P4="`Which p4`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff MTN="`Which mtn`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff BZR="`Which bzr`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # OPTIONAL: Override Built-in Properties
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Assumption: We should not set properties to the empty string
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff PROPERTIES="\
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} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
d3646bfc0ec587c8e8d1161c0336efbec1795b2fBob Halley # OPTIONAL: Store The History Cache in Java DB (derby),
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # instead of file system (in gzipped xml files).
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Requirements:
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # - derbyclient.jar - See README.txt for more details
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # - Running Derby Server - Defaults to localhost:1527
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_DERBY}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff DERBY_OPTIONS="-D"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_DERBY_URL}" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff DERBY_OPTIONS="${DERBY_OPTIONS} -u ${OPENGROK_DERBY_URL}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
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 # (default: off)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_TAG}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff HISTORY_TAGS="-G"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # DELIVERED: An update program for EftarFile
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
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # HARDCODED: Generated EftarFile (See web/*.jsp)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Be Quiet? (set indirectly by command line arguments in the main program)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #QUIET=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # or alternatively, Be Verbose!
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #VERBOSE="-v"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_VERBOSE}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff VERBOSE="-v"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff QUIET=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_PROGRESS}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff PROGRESS="-C"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
8f16e457f722681f67ee6af9c1cd39553f6dcc9aAndreas Gustafsson#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Helper Functions - Logging
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
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#
f93d33e24fdf76eb2558168f018b8992bcfc5681Andreas Gustafsson
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffProgress()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -z "${OPENGROK_NON_INTERACTIVE}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${@}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffWarning()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -z "${OPENGROK_NON_INTERACTIVE}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "WARNING: ${@}" 1>&2
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffError()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "ERROR: ${@}" 1>&2
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffFatalError()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff exec >&2
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo ""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "FATAL ERROR: ${@} - Aborting!"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo ""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ${DO} exit 2
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Helper Functions - Autodetection of Runtime Environment
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffWhich()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff path="`which ${1} 2>/dev/null`"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -x "${path}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${path}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffLocateBinary() {
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff for f in $@
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff do
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff file=`which "$f" 2>/dev/null | grep -v '^no '`
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if test -n "$file" -a -x "$file"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo $file
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return 0
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff done
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo ""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return 1
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffFindExuberantCTags()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Search for Exuberant ctags intelligently, skipping
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # over other ctags implementations.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff binary=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff found=0
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff for program in ctags-exuberant exctags ctags; do
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff for path in `echo $PATH | tr ':' '\n'`; do
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -x "$path/$program" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff binary="$path/$program"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Verify that this really is Exuberant Ctags.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff $binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ $? -eq 0 ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff found=1
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff break
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff done
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ $found -eq 1 ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff break;
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff done
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ $found -ne 1 ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Error "Unable to determine Exuberant CTags command name" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff "for ${OS_NAME} ${OS_VERSION}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo ${binary}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffFindJavaHome()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff javaHome=""
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff case "${OS_NAME}:${OS_VERSION}" in
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SunOS:5.10) javaHome="/usr/jdk/instances/jdk1.7.0" ;;
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SunOS:5.11) javaHome="/usr/jdk/latest" ;;
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff SunOS:5.12) javaHome="/usr/jdk/latest" ;;
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Darwin:*) javaHome=`/usr/libexec/java_home` ;;
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Linux:*)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -f /etc/alternatives/java ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff javaHome=`ls -l /etc/alternatives/java | cut -f 2 -d \> `
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff javaHome=`dirname $javaHome`
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff javaHome=`dirname $javaHome`
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ;;
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff esac
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -z "${javaHome}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
8f16e457f722681f67ee6af9c1cd39553f6dcc9aAndreas Gustafsson Error "Unable to determine Java 7 Home" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff "for ${OS_NAME} ${OS_VERSION}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ ! -d "${javaHome}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Error "Missing Java Home ${javaHome}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${javaHome}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffFindApplicationServerType()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
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
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Either use the environment variable OPENGROK_APP_SERVER or
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # reimplement this function in your configuration file (as
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # specified by OPENGROK_CONFIGURATION)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_APP_SERVER}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${OPENGROK_APP_SERVER}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
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 # of SMF (Service Management Facility)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Maybe a better implementation would be to call Application
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Server specific WAR Directory and see if they exist.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -d "/var/tomcat6/webapps" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff -o -d "/var/lib/tomcat6/webapps" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff -o -d "/var/lib/tomcat7/webapps" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "Tomcat"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -x "/etc/init.d/appserv" -a -d "/var/appserver/domains" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "Glassfish"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Assume Tomcat
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "Tomcat"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffDetermineWarDirectoryTomcat()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_WAR_TARGET_TOMCAT}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${OPENGROK_WAR_TARGET_TOMCAT}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
89ab7f672f83506098635c9c2e01d12ed32bb354Mark Andrews elif [ -n "${OPENGROK_WAR_TARGET}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${OPENGROK_WAR_TARGET}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson for prefix in \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ${OPENGROK_TOMCAT_BASE} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff /var/tomcat6 \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff /var/lib/tomcat6 \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff /var/lib/tomcat7
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff do
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -d "${prefix}/webapps" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${prefix}/webapps"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff done
483a5a91ada151e7edba90b98ce376b06b0013e3Mark Andrews}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffDetermineWarDirectoryGlassfish()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_WAR_TARGET_GLASSFISH}" ]
89ab7f672f83506098635c9c2e01d12ed32bb354Mark Andrews then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${OPENGROK_WAR_TARGET_GLASSFISH}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff elif [ -n "${OPENGROK_WAR_TARGET}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${OPENGROK_WAR_TARGET}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff for prefix in \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ${OPENGROK_GLASSFISH_BASE} \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff /var/appserver
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff do
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -d "${prefix}/domains" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -z "${domainDirectory}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff domainDirectory="${prefix}/domains"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff done
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -z "${domainDirectory}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # User Specified Domain
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_GLASSFISH_DOMAIN}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ ! -d "${directory}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
483a5a91ada151e7edba90b98ce376b06b0013e3Mark Andrews FatalError "Missing Specified Glassfish Domain " \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff "${OPENGROK_GLASSFISH_DOMAIN}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${directory}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff return
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Arbitrary Domain Selection
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff firstDomain=`ls -1 ${domainDirectory} | head -1`
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -z "${firstDomain}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff FatalError "Failed to dynamically determine Glassfish Domain from " \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff "${domainDirectory}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff echo "${domainDirectory}/${firstDomain}/autodeploy"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Implementation
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# The variable "DO" can usefully be set to "echo" to aid in script debugging
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
89ab7f672f83506098635c9c2e01d12ed32bb354Mark Andrews
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffLoadStandardEnvironment()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Setup a standard execution environment (if required)
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
89ab7f672f83506098635c9c2e01d12ed32bb354Mark Andrews cronexec="/pkgs/sbin/CronExecutionEnvironment.sh"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-$cronexec}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -f "${OPENGROK_STANDARD_ENV}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Progress "Loading ${OPENGROK_STANDARD_ENV} ..."
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff . "${OPENGROK_STANDARD_ENV}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff# Load custom configuration and then fill remaining stuff with defaults.
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff#
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffLoadInstanceConfiguration()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff #
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.
89ab7f672f83506098635c9c2e01d12ed32bb354Mark Andrews #
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff # Load the Local OpenGrok Configuration Environment
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Progress "Loading ${OPENGROK_CONFIGURATION} ..."
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff . "${OPENGROK_CONFIGURATION}"
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff fi
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff Progress "Loading the default instance configuration ..."
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff DefaultInstanceConfiguration
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff}
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael GraffValidateConfiguration()
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ ! -x "${EXUBERANT_CTAGS}" ]
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff then
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff FatalError "Missing Dependent Application - Exuberant CTags"
9b1e4986e106aeaab78248f05d7d7bbee55d96b0Mark Andrews fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ ! -d "${SRC_ROOT}" ]
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -n "${QUIET}" -a -n "${VERBOSE}" ]
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff QUIET=""
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence VERBOSE="-v"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence if [ -n "${OPENGROK_DERBY}" ]
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence then
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence if [ `uname -s` == "SunOS" -a -d /opt/SUNWjavadb -a -d /usr/opengrok ];
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ -d "/var/tomcat6" -a \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ! -r "/var/tomcat6/webapps/source/WEB-INF/lib/derbyclient.jar" ];
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence FatalError "JavaDB on but no derbyclient.jar under" \
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence "/var/tomcat6/webapps/source/WEB-INF/lib"
b8bd3390849a02332e07befe6c0f300f86a2429eDavid Lawrence fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ ! -r "/usr/opengrok/lib/derbyclient.jar" ]; then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff FatalError "JavaDB on but no derbyclient.jar under" \
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff "/usr/opengrok/lib"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff else
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 "WEB-INF/lib !"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff}
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael GraffCreateRuntimeRequirements()
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff{
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff if [ ! -d "${DATA_ROOT}" ]
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff then
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff Progress " Attempting to create generated data directory ... "
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff ${DO} mkdir -p "${DATA_ROOT}"
5a0ffa97751ef1ff29d1bf9d7f332eeb9f8edc21Michael Graff fi
if [ ! -d "${DATA_ROOT}" ]
then
FatalError "OpenGrok data path ${DATA_ROOT} doesn't exist"
fi
if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ]
then
Warning "OpenGrok generated etc path ${OPENGROK_INSTANCE_BASE}/etc " \
"doesn't exist"
Progress " Attempting to create generated etc directory ... "
${DO} mkdir -p "${OPENGROK_INSTANCE_BASE}/etc"
fi
if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ]
then
FatalError "OpenGrok etc path ${OPENGROK_INSTANCE_BASE}/etc " \
"doesn't exist"
fi
if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ]
then
Progress " Creating default ${LOGGER_CONFIG_PATH} ... "
if [ ! -f "${LOGGER_CONF_SOURCE}" ]
then
Warning "Can't find distribution logging configuration" \
"(${LOGGER_CONF_SOURCE}) to install as default" \
"logging configuration (${LOGGER_CONFIG_PATH})"
else
filename="opengrok%g.%u.log"
fullpath="${OPENGROK_INSTANCE_BASE}/log/opengrok%g.%u.log"
${DO} grep -v java.util.logging.FileHandler.pattern \
"${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
${DO} grep java.util.logging.FileHandler.pattern \
"${LOGGER_CONF_SOURCE}" | \
sed "s|$filename|$fullpath|g" >> "${LOGGER_CONFIG_PATH}"
if [ ! -d ${OPENGROK_INSTANCE_BASE}/log ]
then
${DO} mkdir ${OPENGROK_INSTANCE_BASE}/log
fi
fi
fi
if [ -n "${OPENGROK_DERBY}" ]
then
if [ ! -d "${OPENGROK_INSTANCE_BASE}/derby" ]
then
Warning "OpenGrok generated derby path " \
"${OPENGROK_INSTANCE_BASE}/derby doesn't exist"
Progress " Attempting to create generated derby directory ... "
${DO} mkdir -p ${OPENGROK_INSTANCE_BASE}/derby
fi
fi
}
CommonInvocation()
{
${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
${LOGGER_PROPERTIES} \
${JAVA_DEBUG} \
-jar ${OPENGROK_JAR} \
${IGNORE_PATTERNS} \
${DERBY_OPTIONS} \
${HISTORY_TAGS} \
${REMOTE_REPOSITORIES} \
${SCAN_DEPTH} \
${VERBOSE} ${QUIET} \
${PROGRESS} \
${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
${CTAGS_OPTIONS_FILE:+-o} ${CTAGS_OPTIONS_FILE} \
${OPENGROK_FLUSH_RAM_BUFFER_SIZE} ${SKIN} ${LEADING_WILDCARD} \
${READ_XML_CONF} \
"${@}"
}
StdInvocation()
{
CommonInvocation \
-W ${XML_CONFIGURATION} \
${SCAN_FOR_REPOSITORY} \
${ENABLE_PROJECTS} \
${WEBAPP_CONFIG} \
${WEBAPP_CONTEXT} \
-s ${SRC_ROOT} \
-d ${DATA_ROOT}
}
UpdateGeneratedData()
{
StdInvocation -H
}
UpdateDataPartial()
{
extra_args=""
for arg in "$@"; do
if [ -n "$extra_args" ]; then
extra_args="$extra_args -h $arg"
else
extra_args="-h $arg"
fi
done
CommonInvocation $extra_args "$@"
}
UpdateDescriptionCache()
{
# OPTIONAL : Update the EftarFile data
if [ -n "${PATH_DESC}" -a -s "${PATH_DESC}" ]
then
${DO} ${JAVA} -classpath ${OPENGROK_JAR} \
${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
fi
}
OpenGrokUsage()
{
echo "Options for opengrok.jar:" 1>&2
${DO} ${JAVA} ${JAVA_OPTS} -jar ${OPENGROK_JAR} '-?'
}
DeployWar()
{
applicationServer="`FindApplicationServerType`"
case "${applicationServer}" in
Tomcat) warTarget="`DetermineWarDirectoryTomcat`" ;;
Glassfish) warTarget="`DetermineWarDirectoryGlassfish`" ;;
*) FatalError "Unsupported Application Server ${applicationServer}" ;;
esac
if [ -z "${warTarget}" ]
then
FatalError "Unable to determine Deployment Directory for " \
"${applicationServer}"
fi
if [ ! -f "${OPENGROK_DIST_WAR}" ]
then
FatalError "Missing Web Application Archive ${OPENGROK_DIST_WAR}"
fi
if [ ! -d "${warTarget}" ]
then
FatalError "Missing Deployment Directory ${warTarget}"
fi
Progress "Installing ${OPENGROK_DIST_WAR} to ${warTarget} ..."
${DO} cp -p "${OPENGROK_DIST_WAR}" "${warTarget}/"
if [ $? != 0 ]
then
FatalError "Web Application Installation FAILED"
fi
Progress
Progress "Start your application server (${applicationServer}), " \
"if it is not already"
Progress "running, or wait until it loads the just installed web " \
"application."
Progress
Progress "OpenGrok should be available on <HOST>:<PORT>/source"
Progress " where HOST and PORT are configured in ${applicationServer}."
Progress
}
DerbyServer()
{
case "${OS_NAME}:${OS_VERSION}" in
SunOS:5.10) Error "unsupported OS" ;;
SunOS:5.11)
/sbin/svcadm enable javadb
;;
SunOS:5.12)
echo "Below might need your socket permission setup"
echo "see JDK1.7_51 release notes"
set -x
mkdir -p $DATA_ROOT/derby
java -Dderby.system.home=$DATA_ROOT/derby \
-jar /usr/jdk/instances/jdk1.7.0/db/lib/derbynet.jar start
;;
Linux:*)
mkdir -p $DATA_ROOT/derby
java -Dderby.system.home=$DATA_ROOT/derby \
-jar /usr/lib/jvm/java-6-sun/db/lib/derbynet.jar start
;;
*) Error "unsupported OS" ;;
esac
}
#
# Clear history index for given project.
#
ClearHistory()
{
Progress "Removing history index data for repository ${1}"
StdInvocation -k "${1}"
}
#
# Main Program
#
if [ $# -eq 0 ]
then
Usage
fi
LoadStandardEnvironment
LoadInstanceConfiguration
case "${1}" in
deploy)
DeployWar
;;
derby)
ValidateConfiguration
CreateRuntimeRequirements
DerbyServer
;;
update)
ValidateConfiguration
CreateRuntimeRequirements
UpdateGeneratedData
UpdateDescriptionCache
;;
updateQuietly)
ValidateConfiguration
CreateRuntimeRequirements
QUIET="-q"
VERBOSE=""
UpdateGeneratedData
UpdateDescriptionCache
;;
index)
if [ $# -gt 2 ]
then
Usage
fi
if [ -n "${2}" ]
then
SRC_ROOT="${2}"
fi
ValidateConfiguration
CreateRuntimeRequirements
UpdateGeneratedData
UpdateDescriptionCache
;;
indexpart)
if [ $# -ne 3 ]
then
Usage
fi
SRC_ROOT="${2}"
shift 2
ValidateConfiguration
CreateRuntimeRequirements
UpdateDataPartial $@
;;
clearHistory)
if [ -z "${2}" ]; then
Usage
fi
ClearHistory "${2}"
;;
usage|help)
OpenGrokUsage
Usage
;;
*)
Usage
;;
esac