OpenGrok revision b17cb0705d90907337b3528aa7b8ed1700806f26
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#!/bin/sh
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# OpenGrok Wrapper (initial setup and cron job updating)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Supported Operating Systems:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Solaris 10 (SunOS 5.10)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Solaris 11 (SunOS 5.11)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Debian (Linux)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Supported Deployment Engines:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Tomcat 6
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Tomcat 5.5
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Glassfish
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
0662ed52e814f8f08ef0e09956413a792584eddffuankg# Supported Environment Variables:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Supported Environment Variables for configuring the default setup:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - EXUBERANT_CTAGS Full Path to Exuberant CTags
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - JAVA_HOME Full Path to Java Installation Root
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - JAVA Full Path to java binary
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - JAVA_OPTS Java options
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
16b55a35cff91315d261d1baa776138af465c4e4fuankg# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
16b55a35cff91315d261d1baa776138af465c4e4fuankg# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# (contains domains)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
16b55a35cff91315d261d1baa776138af465c4e4fuankg# - OPENGROK_PROGRESS Shows progress in %(percentage) of working
16b55a35cff91315d261d1baa776138af465c4e4fuankg# through project, it's good to have Verbose
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Mode enabled too, cost of this is one more
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# traversal of the project before indexing it(*)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_REMOTE_REPOS_OFF Disable History Cache for (remote)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Repositories (*)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# (by default 3 directories from SRC_ROOT)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# (use "none" to avoid sending it to web app)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_WPREFIX Disable wildcard prefix search query
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# support (*)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - OPENGROK_DERBY if set, then indexer tries to use derby as
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# historycache (see derby command of this
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# script)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - READ_XML_CONFIGURATION file with read only configuration
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - temporary workaround for bug # 327
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Notes:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# (*) Any Non-Empty String will enable these options
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Print usage to stderr and exit.
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgUsage()
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg{
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg progname=`basename $0`
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg exec >&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage>" 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo " ${progname} index [<directory>]" 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo " Optional environment variables:" 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo " OPENGROK_CONFIGURATION - location of your configuration" 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... " 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo " See the code for more information on configuration options /" \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg "variables" 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo 1>&2
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg exit 1
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg}
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Runtime Configuration
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgif [ -f "/bin/uname" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgthen
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OS_NAME="`/bin/uname -s`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OS_VERSION="`/bin/uname -r`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgelse
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OS_NAME="`/usr/bin/uname -s`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OS_VERSION="`/usr/bin/uname -r`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgfi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# TODO: Handle symlinks correctly (especially in ${0})
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgSCRIPT_DIRECTORY="`dirname ${0}`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgSCRIPT_DIRECTORY="`cd ${SCRIPT_DIRECTORY}; pwd`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Default Instance Configuration
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg#
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgDefaultInstanceConfiguration()
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg{
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Use the built-in defaults. This section can be copied to its own
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # file and tailored to your local requirements. Then simply set
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # this wrapper. It will save you hand editing in your settings
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # on each new release. A sample cron(1M) entry might look like:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Note: It is not really possible to ever provided defaults for
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # these values which will run in every UNIX-like environment.
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # So I have provided a set which are functional for a given
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # environment on which you can based you own configuration.
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # This has been updated to support more environment variables and
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # operating systems, if you have any reasonably generic
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # improvements please feel free to submit a patch.
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_CONFIG_FILE="logging.properties"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -d "${SCRIPT_DIRECTORY}/dist" -a \
0662ed52e814f8f08ef0e09956413a792584eddffuankg -f "${SCRIPT_DIRECTORY}/dist/opengrok.jar" -a \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg -f "${SCRIPT_DIRECTORY}/dist/source.war" \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Handle Developer Build Environments
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg else
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Handle Binary Distributions
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
0662ed52e814f8f08ef0e09956413a792584eddffuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED: Source Code/Repository Root
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (your source code or the root of all repositories)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg SRC_ROOT="${OPENGROK_INSTANCE_BASE}/src"
0662ed52e814f8f08ef0e09956413a792584eddffuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED: OpenGrok Generate Data Root
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (for Lucene index and hypertext cross-references)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # This area is rebuilt by "update" / "updateQuietly"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg DATA_ROOT="${OPENGROK_INSTANCE_BASE}/data"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (The user maintained source of the generated EftarFile file)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
0662ed52e814f8f08ef0e09956413a792584eddffuankg # REQUIRED: XML Configuration
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (the configuration used by Web/GUI interfaces)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: read only XML config, if it exists, it will be read
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -f "${READ_XML_CONFIGURATION}" ] ; then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg READ_XML_CONF="-R ${READ_XML_CONFIGURATION}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED: Logger Configuration
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED: Java Archive of OpenGrok (Installation Location)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (user building from source code will find this and other key
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # files in the "dist" directory after the build is completed)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED: Exuberant CTags (http://ctags.sf.net)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED: Java Home
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg JAVA_HOME="${JAVA_HOME:-`FindJavaHome`}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg export JAVA_HOME
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED: Java Virtual Machine
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg JAVA="${JAVA:-$JAVA_HOME/bin/java}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # port 8010 until a debugger connects
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Ignore these patterns as names of files or directories
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #IGNORE_PATTERNS="-i dummy"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Enable Projects
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (Every directory in SRC_ROOT is considered a separate project)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg ENABLE_PROJECTS="-P"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Scanning Options (for Mercurial repositories)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg SCAN_FOR_REPOSITORY="-S"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${OPENGROK_SCAN_REPOS}" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg SCAN_FOR_REPOSITORY=""
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg REMOTE_REPOSITORIES="-r on"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${OPENGROK_REMOTE_REPOS_OFF}" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg REMOTE_REPOSITORIES=""
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: override depth of scanning for repositories
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${OPENGROK_SCAN_DEPTH}" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg SCAN_DEPTH="-z${OPENGROK_SCAN_DEPTH}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Allow Leading Wildcard Searches
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (default: on)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LEADING_WILDCARD="-a on"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${OPENGROK_WPREFIX}" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LEADING_WILDCARD=""
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Web Site Look & Feel
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (Options: default, offwhite and polished.
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Note the quoting requirements)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #SKIN='-L "default"'
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
cf7ca2f9eaa6523fefcccba4287b91637391fb51fuankg # OPTIONAL: Set Maximum Indexed Words Per File
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Note, that you might run out of memory, then either increase JVM memory
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # indexing the rest of the file, once the limit is reached)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (default: unlimited)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #MAX_INDEXED_WORDS="-m 100000"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Configuration Address (host:port)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (conf/web.xml default is localhost:2424)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg WEBAPP_CONFIG=""
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${OPENGROK_WEBAPP_CFGADDR}" ]; then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg WEBAPP_CONFIG_ADDRESS=${OPENGROK_WEBAPP_CFGADDR}
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg WEBAPP_CONFIG_ADDRESS=""
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg else
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg WEBAPP_CONFIG_ADDRESS="localhost:2424"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${WEBAPP_CONFIG_ADDRESS}" ]; then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg WEBAPP_CONFIG="-U ${WEBAPP_CONFIG_ADDRESS}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: JVM Options
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg JAVA_OPTS="${JAVA_OPTS:--Xmx2048m}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Full Path to History Utilities
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg HG="`Which hg`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg CVS="`Which cvs`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg SVN="`Which svn`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg SCCS="`Which sccs`"
8ffac2c334103c0336602aaede650cb578611151fuankg CLEARCASE="`Which cleartool`"
8ffac2c334103c0336602aaede650cb578611151fuankg GIT="`Which git`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg P4="`Which p4`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg MTN="`Which mtn`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg BZR="`Which bzr`"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Override Built-in Properties
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Assumption: We should not set properties to the empty string
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg PROPERTIES="\
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${CVS:+-Dorg.opensolaris.opengrok.history.cvs=$CVS} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${SVN:+-Dorg.opensolaris.opengrok.history.Subversion=$SVN} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Store The History Cache in Java DB (derby),
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # instead of file system (in gzipped xml files).
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Requirements:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # - derbyclient.jar - See README.txt for more details
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # - Running Derby Server - Defaults to localhost:1527
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${OPENGROK_DERBY}" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg DERBY_HISTORY_CACHE="-D"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # DELIVERED: An update program for EftarFile
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Usage: <class> inputFile [inputFile ...] outputFile
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # HARDCODED: Generated EftarFile (See web/*.jsp)
0662ed52e814f8f08ef0e09956413a792584eddffuankg EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # Be Quiet? (set indirectly by command line arguments in the main program)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #QUIET=""
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # or alternatively, Be Verbose!
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #VERBOSE="-v"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${OPENGROK_VERBOSE}" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg VERBOSE="-v"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg QUIET=""
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg if [ -n "${OPENGROK_PROGRESS}" ]
0662ed52e814f8f08ef0e09956413a792584eddffuankg then
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg PROGRESS="-C"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg fi
}
#
# Helper Functions - Logging
#
# In general, non-interactive use like cron jobs and automated
# installation environments should not generate unnecessary
# progress information or warnings, as usage and configuration
# will have generally been debugged prior to automation.
#
Progress()
{
if [ -z "${OPENGROK_NON_INTERACTIVE}" ]
then
echo "${@}"
fi
}
Warning()
{
if [ -z "${OPENGROK_NON_INTERACTIVE}" ]
then
echo "WARNING: ${@}" 1>&2
fi
}
Error()
{
echo "ERROR: ${@}" 1>&2
}
FatalError()
{
exec >&2
echo ""
echo "FATAL ERROR: ${@} - Aborting!"
echo ""
${DO} exit 2
}
#
# Helper Functions - Autodetection of Runtime Environment
#
Which()
{
path="`which ${1} 2>/dev/null`"
if [ -x "${path}" ]
then
echo "${path}"
fi
}
LocateBinary() {
for f in $@
do
file=`which "$f" 2>/dev/null | grep -v '^no '`
if test -n "$file" -a -x "$file"
then
echo $file
return 0
fi
done
echo ""
return 1
}
FindExuberantCTags()
{
binary=`LocateBinary ctags-exuberant exctags ctags`
if test $? -eq 1
then
Error "Unable to determine Exuberant CTags command name" \
"for ${OS_NAME} ${OS_VERSION}"
return
fi
# Verify that this really is Exuberant Ctags
$binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
if test $? -ne 0
then
Error "Unable to determine Exuberant CTags command name" \
"for ${OS_NAME} ${OS_VERSION}\n(${binary} is not Exuberant CTags)"
return
fi
echo ${binary}
}
FindJavaHome()
{
javaHome=""
case "${OS_NAME}:${OS_VERSION}" in
SunOS:5.10) javaHome="/usr/jdk/instances/jdk1.6.0" ;;
SunOS:5.11) javaHome="/usr/jdk/latest" ;;
Linux:*)
if [ -f /etc/alternatives/java ]
then
javaHome=`ls -l /etc/alternatives/java | cut -f 2 -d \> `
javaHome=`dirname $javaHome`
javaHome=`dirname $javaHome`
else
for dir in /usr/lib/jvm/sun-jdk-1.6 \
/usr/lib/jvm/sun-jre-1.6 \
/usr/lib/jvm/java-6-sun
do
if [ -f ${dir}/bin/java ]
then
javaHome=$dir
break;
fi
done
fi
;;
esac
if [ -z "${javaHome}" ]
then
Error "Unable to determine Java 6 Home" \
"for ${OS_NAME} ${OS_VERSION}"
return
fi
if [ ! -d "${javaHome}" ]
then
Error "Missing Java Home ${javaHome}"
return
fi
echo "${javaHome}"
}
FindApplicationServerType()
{
# Use this function to determine which environment the deploy the
# web application function into. Some users (especially
# developers) will have many deployment environments or will wish
# to specify directly the application server to deploy to.
# Either use the environment variable OPENGROK_APP_SERVER or
# reimplement this function in your configuration file (as
# specified by OPENGROK_CONFIGURATION)
if [ -n "${OPENGROK_APP_SERVER}" ]
then
echo "${OPENGROK_APP_SERVER}"
return
fi
# This implementation favours Tomcat, but needs a lot of work,
# especially if Glassfish is perferrerd or it is under the control
# of SMF (Service Management Facility)
# Maybe a better implementation would be to call Application
# Server specific WAR Directory and see if they exist.
if [ -d "/var/tomcat6/webapps" \
-o -d "/var/lib/tomcat6/webapps" \
-o -d "/var/lib/tomcat5/webapps" \
-o -d "/var/lib/tomcat5.5/webapps" \
]
then
echo "Tomcat"
return
fi
if [ -x "/etc/init.d/appserv" -a -d "/var/appserver/domains" ]
then
echo "Glassfish"
return
fi
# Assume Tomcat
echo "Tomcat"
}
DetermineWarDirectoryTomcat()
{
if [ -n "${OPENGROK_WAR_TARGET_TOMCAT}" ]
then
echo "${OPENGROK_WAR_TARGET_TOMCAT}"
return
elif [ -n "${OPENGROK_WAR_TARGET}" ]
then
echo "${OPENGROK_WAR_TARGET}"
return
fi
for prefix in \
${OPENGROK_TOMCAT_BASE} \
/var/tomcat6 \
/var/lib/tomcat6 \
/var/lib/tomcat5 \
/var/lib/tomcat5.5
do
if [ -d "${prefix}/webapps" ]
then
echo "${prefix}/webapps"
return
fi
done
}
DetermineWarDirectoryGlassfish()
{
if [ -n "${OPENGROK_WAR_TARGET_GLASSFISH}" ]
then
echo "${OPENGROK_WAR_TARGET_GLASSFISH}"
return
elif [ -n "${OPENGROK_WAR_TARGET}" ]
then
echo "${OPENGROK_WAR_TARGET}"
return
fi
for prefix in \
${OPENGROK_GLASSFISH_BASE} \
/var/appserver
do
if [ -d "${prefix}/domains" ]
then
if [ -z "${domainDirectory}" ]
then
domainDirectory="${prefix}/domains"
fi
fi
done
if [ -z "${domainDirectory}" ]
then
return
fi
# User Specified Domain
if [ -n "${OPENGROK_GLASSFISH_DOMAIN}" ]
then
directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
if [ ! -d "${directory}" ]
then
FatalError "Missing Specified Glassfish Domain " \
"${OPENGROK_GLASSFISH_DOMAIN}"
fi
echo "${directory}"
return
fi
# Arbitrary Domain Selection
firstDomain=`ls -1 ${domainDirectory} | head -1`
if [ -z "${firstDomain}" ]
then
FatalError "Failed to dynamically determine Glassfish Domain from " \
"${domainDirectory}"
fi
echo "${domainDirectory}/${firstDomain}/autodeploy"
}
#
# Implementation
#
# The variable "DO" can usefully be set to "echo" to aid in script debugging
#
LoadStandardEnvironment()
{
# Setup a standard execution environment (if required)
cronexec="/pkgs/sbin/CronExecutionEnvironment.sh"
OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-$cronexec}"
if [ -f "${OPENGROK_STANDARD_ENV}" ]
then
Progress "Loading ${OPENGROK_STANDARD_ENV} ..."
. "${OPENGROK_STANDARD_ENV}"
fi
}
#
# Load default configuration and then merge with user specified configuration.
#
LoadInstanceConfiguration()
{
# Note: As all functions have been defined by the time this routine
# is called, your configuration can, if desired, override functions
# in addition to setting the variables mentioned in the function
# DefaultInstanceConfiguration(), this maybe useful to override
# functionality used to determine the default deployment environment
# find dependencies or validate the configuration, for example.
Progress "Loading the default instance configuration ..."
DefaultInstanceConfiguration
if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
then
# Load the Local OpenGrok Configuration Environment
Progress "Loading ${OPENGROK_CONFIGURATION} ..."
. "${OPENGROK_CONFIGURATION}"
fi
}
ValidateConfiguration()
{
if [ ! -x "${EXUBERANT_CTAGS}" ]
then
FatalError "Missing Dependent Application - Exuberant CTags"
fi
if [ ! -d "${SRC_ROOT}" ]
then
FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
fi
if [ -n "${QUIET}" -a -n "${VERBOSE}" ]
then
Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
QUIET=""
VERBOSE="-v"
fi
if [ -n "${OPENGROK_DERBY}" ]
then
Warning "CHECK: derbyclient.jar needs to be in where the rest of " \
"opengrok used jars are and in unpacked source.war in WEB-INF/lib !"
fi
}
CreateRuntimeRequirements()
{
if [ ! -d "${DATA_ROOT}" ]
then
Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist"
Progress " Attempting to create generated data directory ... "
${DO} mkdir -p "${DATA_ROOT}"
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
}
StdInvocation()
{
${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
${LOGGER_PROPERTIES} \
${JAVA_DEBUG} \
-jar ${OPENGROK_JAR} \
${IGNORE_PATTERNS} ${ENABLE_PROJECTS} \
${DERBY_HISTORY_CACHE} \
${SCAN_FOR_REPOSITORY} ${REMOTE_REPOSITORIES} \
${SCAN_DEPTH} \
${VERBOSE} ${QUIET} \
${PROGRESS} \
${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
${MAX_INDEXED_WORDS} ${SKIN} ${LEADING_WILDCARD} \
${READ_XML_CONF} \
-W ${XML_CONFIGURATION} \
${WEBAPP_CONFIG} \
-s ${SRC_ROOT} -d ${DATA_ROOT} \
"${@}"
}
UpdateGeneratedData()
{
StdInvocation -H
}
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
;;
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
}
#
# Main Program
#
if [ $# -eq 0 -o $# -gt 2 ]
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 [ -n "${2}" ]
then
SRC_ROOT="${2}"
fi
ValidateConfiguration
CreateRuntimeRequirements
UpdateGeneratedData
UpdateDescriptionCache
;;
usage)
OpenGrokUsage
Usage
;;
*)
Usage
;;
esac