OpenGrok revision 70a0fa770eb06713d8ebf91093102044bc5799e0
10139N/A#!/bin/sh
10139N/A#
10139N/A# OpenGrok Wrapper (initial setup and cron job updating)
10139N/A#
10139N/A# Supported Operating Systems:
10139N/A# - Solaris 10 (SunOS 5.10)
10139N/A# - OpenSolaris (SunOS 5.11)
10139N/A# - Debian (Linux)
10139N/A#
10139N/A# Supported Deployment Engines:
10139N/A# - Tomcat 6
10139N/A# - Tomcat 5.5
10139N/A# - Glassfish
10139N/A#
10139N/A# Supported Environment Variables:
10139N/A# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
10139N/A# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
10139N/A# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
10139N/A#
10139N/A# Supported Environment Variables for configuring the default setup:
10139N/A# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
10139N/A# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
10139N/A# - EXUBERANT_CTAGS Full Path to Exuberant CTags
10139N/A# - JAVA_HOME Full Path to Java Installation Root
10139N/A# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
10139N/A# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
10139N/A# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
10139N/A# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
10139N/A# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
10139N/A# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish (contains domains)
10139N/A# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
10139N/A# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
10139N/A# - OPENGROK_REMOTE_REPOS Enable History Cache for Remote Repositories (*)
10139N/A# - OPENGROK_SCAN_REPOS Scan for repositories (*)_
10139N/A#
10139N/A# - READ_XML_CONFIGURATION file with read only configuration - a temp workaround for bug # 327
10139N/A#
10139N/A# Notes:
10139N/A# (*) Any Non-Empty String will enable these options
10139N/A#
10139N/A
10139N/A#
10139N/A# Usage
10139N/A#
10139N/A
10139N/AUsage()
10139N/A{
10139N/A echo 1>&2
10139N/A echo "Usage: ${0} <deploy|update|updateQuietly|usage>" 1>&2
10139N/A echo " ${0} index [<directory>]" 1>&2
10139N/A echo 1>&2
10139N/A echo " Optional environment variables:" 1>&2
10139N/A echo " OPENGROK_CONFIGURATION - location of your configuration" 1>&2
10139N/A echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... " 1>&2
10139N/A echo 1>&2
10139N/A echo " See the code for more information on configuration options / variables" 1>&2
10139N/A echo 1>&2
10139N/A exit 1
10139N/A}
13931N/A
10139N/A#
10139N/A# Runtime Configuration
10139N/A#
10139N/A
10139N/AOS_NAME="`/bin/uname -s`"
10139N/AOS_VERSION="`/bin/uname -r`"
10139N/A
10139N/A# TODO: Handle symlinks correctly (especially in ${0})
13570N/ASCRIPT_DIRECTORY="`dirname ${0}`"
10139N/ASCRIPT_DIRECTORY="`cd ${SCRIPT_DIRECTORY}; pwd`"
10139N/A
15942N/A#
10139N/A# Default Instance Configuration
15942N/A#
14177N/A
15942N/ADefaultInstanceConfiguration()
15942N/A{
15942N/A # Use the built-in defaults. This section can be copied to its own
15942N/A # file and tailored to your local requirements. Then simply set
15942N/A # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
11965N/A # this wrapper. It will save you hand editing in your settings
11965N/A # on each new release. A sample cron(1M) entry might look like:
15942N/A # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
15942N/A
15942N/A # Note: It is not really possible to ever provided defaults for
10139N/A # these values which will run in every UNIX-like environment.
10139N/A # So I have provided a set which are functional for a given
15942N/A # environment on which you can based you own configuration.
10139N/A
10139N/A # This has been updated to support more environment variables and
15942N/A # operating systems, if you have any reasonably generic
15942N/A # improvements please feel free to submit a patch.
15942N/A
15942N/A OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
11933N/A
10139N/A LOGGER_CONFIG_FILE="logging.properties"
10139N/A
15288N/A if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ]
10139N/A then
10139N/A if [ -d "${SCRIPT_DIRECTORY}/dist" -a \
13760N/A -f "${SCRIPT_DIRECTORY}/dist/opengrok.jar" -a \
10139N/A -f "${SCRIPT_DIRECTORY}/dist/source.war" \
10139N/A ]
10139N/A then
10139N/A # Handle Developer Build Environments
10139N/A OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
15942N/A LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/conf/${LOGGER_CONFIG_FILE}"
10139N/A else
10139N/A # Handle Binary Distributions
10139N/A OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}"
10139N/A LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/${LOGGER_CONFIG_FILE}"
10139N/A fi
10139N/A fi
10139N/A
10139N/A # REQUIRED: Source Code/Repository Root
10139N/A # (your source code or the root of all repositories)
15942N/A SRC_ROOT="${OPENGROK_INSTANCE_BASE}/src"
10139N/A
10139N/A # REQUIRED: OpenGrok Generate Data Root
10139N/A # (for Lucene index and hypertext cross-references)
15942N/A # This area is rebuilt by "update" / "updateQuietly"
10139N/A DATA_ROOT="${OPENGROK_INSTANCE_BASE}/data"
15942N/A
10139N/A # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
10139N/A # (The user maintained source of the generated EftarFile file)
10139N/A PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
10139N/A
10139N/A # REQUIRED: XML Configuration
10139N/A # (the configuration used by Web/GUI interfaces)
10139N/A XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
10139N/A
15942N/A # OPTIONAL: read only XML config, if it exists, it will be read
10139N/A READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
15942N/A
10139N/A if [ -f "${READ_XML_CONFIGURATION}" ] ; then
11925N/A READ_XML_CONF="-R ${READ_XML_CONFIGURATION}"
10139N/A fi
15942N/A
10139N/A # REQUIRED: Logger Configuration
10139N/A LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
10139N/A LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
10139N/A
15942N/A # REQUIRED: Java Archive of OpenGrok (Installation Location)
10139N/A OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
10139N/A
10139N/A # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
10139N/A # (user building from source code will find this and other key
10139N/A # files in the "dist" directory after the build is completed)
10139N/A OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
10139N/A
10139N/A # REQUIRED: Exuberant CTags (http://ctags.sf.net)
15942N/A EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
15942N/A
15942N/A # REQUIRED: Java Home
15942N/A JAVA_HOME="${JAVA_HOME:-`FindJavaHome`}"
10139N/A export JAVA_HOME
15944N/A
15942N/A # REQUIRED: Java Virtual Machine
13727N/A JAVA="${JAVA:-$JAVA_HOME/bin/java}"
15942N/A
15942N/A # DEVELOPMENT: Debug option, if enabled current indexer will listen on the port 8010 until a debugger connects
15942N/A #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,address=8010,suspend=y"
15942N/A
15942N/A # OPTIONAL: Ignore these patterns as names of files or directories
15942N/A #IGNORE_PATTERNS="-i dummy"
15942N/A
10139N/A # OPTIONAL: Enable Projects
15942N/A # (Every directory in SRC_ROOT is considered a separate project)
15942N/A ENABLE_PROJECTS="-P"
15942N/A
10139N/A # OPTIONAL: Scanning Options (for Mercurial repositories)
15942N/A if [ ! -z "${OPENGROK_REMOTE_REPOS}" ]
15942N/A then
10139N/A SCAN_FOR_REPOSITORY="-S"
15942N/A fi
10139N/A
15942N/A # OPTIONAL: Remote Repository Support (CVS or SVN)
15942N/A # (Can be very time demanding, uncomment if needed)
10139N/A #REMOTE_REPOSITORIES="-r on"
15942N/A if [ ! -z "${OPENGROK_REMOTE_REPOS}" ]
13092N/A then
15942N/A REMOTE_REPOSITORIES="-r on"
15942N/A fi
15974N/A
15982N/A # OPTIONAL: Allow Leading Wildcard Searches
15989N/A # (default: off)
15989N/A #LEADING_WILDCARD="-a on"
15982N/A
10139N/A # OPTIONAL: Web Site Look & Feel
10139N/A # (Options: default, offwhite and polished.
10139N/A # Note the quoting requirements)
10139N/A #SKIN='-L "default"'
10139N/A
10139N/A # OPTIONAL: Set Maximum Indexed Words Per File
10139N/A # Note, that you might run out of memory, then either increase JVM memory
10139N/A # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not
10139N/A # indexing the rest of the file, once the limit is reached)
10139N/A # (default: unlimited)
10139N/A #MAX_INDEXED_WORDS="-m 100000"
10139N/A
10139N/A # OPTIONAL: Configuration Address (host:port)
10139N/A # (conf/web.xml default is localhost:2424)
10139N/A WEBAPP_CONFIG_ADDRESS="-U localhost:2424"
10139N/A
10139N/A # OPTIONAL: JVM Options
10139N/A #JAVA_OPTS="-server -Xmx2048m"
10139N/A JAVA_OPTS="-Xmx2048m"
10139N/A
10139N/A # OPTIONAL: Full Path to History Utilities
10139N/A HG="`Which hg`"
10139N/A CVS="`Which cvs`"
10139N/A SVN="`Which svn`"
10139N/A SCCS="`Which sccs`"
10139N/A CLEARCASE="`Which cleartool`"
10139N/A GIT="`Which git`"
10139N/A P4="`Which p4`"
10139N/A MTN="`Which mtn`"
10139N/A BZR="`Which bzr`"
10139N/A
10139N/A # OPTIONAL: Override Built-in Properties
10139N/A # Assumption: We should not set properties to the empty string
10139N/A PROPERTIES="\
10139N/A${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
10139N/A${CVS:+-Dorg.opensolaris.opengrok.history.cvs=$CVS} \
10139N/A${SVN:+-Dorg.opensolaris.opengrok.history.Subversion=$SVN} \
10139N/A${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
10139N/A${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
10139N/A${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
10139N/A${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
10139N/A${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
10139N/A${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
10139N/A"
10139N/A
10139N/A # OPTIONAL: Store The History Cache in Java DB (derby),
10139N/A # instead of file system (in gzipped xml files).
10139N/A #
10139N/A # Requirements:
10139N/A # - derbyclient.jar - See README.txt for more details
10139N/A # - Running Derby Server - Defaults to localhost:1527
10139N/A #
10139N/A #DERBY_HISTORY_CACHE=-D
10139N/A
10139N/A # DELIVERED: An update program for EftarFile
10139N/A # Usage: <class> inputFile [inputFile ...] outputFile
10139N/A # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
10139N/A EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
10139N/A
10139N/A # HARDCODED: Generated EftarFile (See web/*.jsp)
10139N/A EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
10139N/A
10139N/A # Be Quiet? (set indirectly by command line arguments in the main program)
10139N/A #QUIET=""
10139N/A
10139N/A # or alternatively, Be Verbose!
10139N/A #VERBOSE="-v"
10139N/A
10139N/A if [ ! -z "${OPENGROK_VERBOSE}" ]
10139N/A then
10139N/A VERBOSE="-v"
10139N/A QUIET=""
10139N/A fi
10139N/A}
10139N/A
10139N/A#
10139N/A# Helper Functions - Logging
10139N/A#
10139N/A# In general, non-interactive use like cron jobs and automated
10139N/A# installation environments should not generate unnecessary
10139N/A# progress information or warnings, as usage and configuration
10139N/A# will have generally been debugged prior to automation.
10139N/A#
10139N/A
10139N/AProgress()
10139N/A{
10139N/A if [ -z "${OPENGROK_NON_INTERACTIVE}" ]
10139N/A then
10139N/A echo "${@}"
10139N/A fi
10139N/A}
10139N/A
10139N/AWarning()
10139N/A{
10139N/A if [ -z "${OPENGROK_NON_INTERACTIVE}" ]
10139N/A then
10139N/A echo "WARNING: ${@}" 1>&2
10139N/A fi
10139N/A}
10139N/A
10139N/AError()
10139N/A{
10139N/A echo "ERROR: ${@}" 1>&2
10139N/A}
10139N/A
10139N/AFatalError()
10139N/A{
10139N/A echo 1>&2
10139N/A echo "FATAL ERROR: ${@} - Aborting!" 1>&2
10139N/A echo 1>&2
10139N/A ${DO} exit 2
10139N/A}
10139N/A
10139N/A#
10139N/A# Helper Functions - Autodetection of Runtime Environment
10139N/A#
10139N/A
10139N/AWhich()
14177N/A{
14177N/A path="`which ${1} 2>/dev/null`"
14177N/A
14177N/A if [ -x "${path}" ]
11965N/A then
11965N/A echo "${path}"
13931N/A fi
11965N/A}
11965N/A
11965N/AFindExuberantCTags()
13931N/A{
11965N/A case "${OS_NAME}:${OS_VERSION}" in
11965N/A SunOS:5.10) commandName="" ;;
11965N/A SunOS:5.11) commandName="exctags" ;;
11965N/A Linux:*) commandName="ctags-exuberant" ;;
11965N/A *) commandName="" ;;
11965N/A esac
13678N/A
13678N/A if [ -z "${commandName}" ]
13678N/A then
13678N/A Error "Unable to determine Exuberant CTags command name" \
13678N/A "for ${OS_NAME} ${OS_VERSION}"
13678N/A return
10139N/A fi
10139N/A
10139N/A Which "${commandName}"
10139N/A}
10139N/A
10139N/AFindJavaHome()
10139N/A{
10139N/A case "${OS_NAME}:${OS_VERSION}" in
10139N/A SunOS:5.10) javaHome="/usr/jdk/instances/jdk1.6.0" ;;
10139N/A SunOS:5.11) javaHome="/usr/jdk/latest" ;;
10139N/A Linux:*) javaHome="/usr/lib/jvm/java-6-sun" ;;
10139N/A *) javaHome="" ;;
10139N/A esac
10139N/A
13726N/A if [ -z "${javaHome}" ]
13806N/A then
13806N/A Error "Unable to determine Java 6 Home" \
13806N/A "for ${OS_NAME} ${OS_VERSION}"
10139N/A return
10139N/A fi
13680N/A
13680N/A if [ ! -d "${javaHome}" ]
13680N/A then
13678N/A Error "Missing Java Home ${javaHome}"
10139N/A return
10139N/A fi
10139N/A
10139N/A echo "${javaHome}"
11933N/A}
11933N/A
11933N/AFindApplicationServerType()
11933N/A{
10139N/A # Use this function to determine which environment the deploy the
10139N/A # web application function into. Some users (especially
10139N/A # developers) will have many deployment environments or will wish
10139N/A # to specify directly the application server to deploy to.
10139N/A
10139N/A # Either use the environment variable OPENGROK_APP_SERVER or
13760N/A # reimplement this function in your configuration file (as
13760N/A # specified by OPENGROK_CONFIGURATION)
10139N/A
10139N/A if [ -n "${OPENGROK_APP_SERVER}" ]
13760N/A then
13760N/A echo "${OPENGROK_APP_SERVER}"
10139N/A return
10139N/A fi
10139N/A
15288N/A # This implementation favours Tomcat, but needs a lot of work,
15288N/A # especially if Glassfish is perferrerd or it is under the control
15288N/A # of SMF (Service Management Facility)
15288N/A
15288N/A # Maybe a better implementation would be to call Application
15288N/A # Server specific WAR Directory and see if they exist.
11161N/A
11161N/A if [ -d "/var/tomcat6/webapps" \
11161N/A -o -d "/var/lib/tomcat6/webapps" \
11161N/A -o -d "/var/lib/tomcat5.5/webapps" \
11161N/A ]
10139N/A then
10139N/A echo "Tomcat"
10139N/A return
10139N/A fi
15238N/A
15238N/A if [ -x "/etc/init.d/appserv" -a -d "/var/appserver/domains" ]
15238N/A then
15238N/A echo "Glassfish"
15238N/A return
13760N/A fi
13760N/A
13760N/A # Assume Tomcat
10139N/A echo "Tomcat"
11161N/A}
10139N/A
10139N/ADetermineWarDirectoryTomcat()
10139N/A{
10139N/A if [ -n "${OPENGROK_WAR_TARGET_TOMCAT}" ]
10139N/A then
10139N/A echo "${OPENGROK_WAR_TARGET_TOMCAT}"
10139N/A return
10139N/A elif [ -n "${OPENGROK_WAR_TARGET}" ]
10139N/A then
10139N/A echo "${OPENGROK_WAR_TARGET}"
10139N/A return
10139N/A fi
10139N/A
10139N/A for prefix in \
10139N/A ${OPENGROK_TOMCAT_BASE} \
10139N/A /var/tomcat6 \
10139N/A /var/lib/tomcat6 \
10139N/A /var/lib/tomcat5.5 \
10139N/A
10139N/A do
10139N/A if [ -d "${prefix}/webapps" ]
10139N/A then
10139N/A echo "${prefix}/webapps"
10139N/A return
10139N/A fi
10139N/A done
10139N/A}
10139N/A
11160N/ADetermineWarDirectoryGlassfish()
10139N/A{
10139N/A
10139N/A if [ -n "${OPENGROK_WAR_TARGET_GLASSFISH}" ]
10139N/A then
11193N/A echo "${OPENGROK_WAR_TARGET_GLASSFISH}"
13036N/A return
10139N/A elif [ -n "${OPENGROK_WAR_TARGET}" ]
10139N/A then
10139N/A echo "${OPENGROK_WAR_TARGET}"
10139N/A return
10139N/A fi
10139N/A
10139N/A for prefix in \
10139N/A ${OPENGROK_GLASSFISH_BASE} \
10139N/A /var/appserver \
10139N/A
10139N/A do
10139N/A if [ -d "${prefix}/domains" ]
10139N/A then
10139N/A if [ -z "${domainDirectory}" ]
10139N/A then
10139N/A domainDirectory="${prefix}/domains"
10139N/A fi
10139N/A fi
10139N/A done
10139N/A
10139N/A if [ -z "${domainDirectory}" ]
10139N/A then
10139N/A return
10139N/A fi
10139N/A
10139N/A # User Specified Domain
10139N/A if [ -n "${OPENGROK_GLASSFISH_DOMAIN}" ]
10139N/A then
10139N/A directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
10139N/A
10139N/A if [ ! -d "${directory}" ]
10139N/A then
10139N/A FatalError "Missing Specified Glassfish Domain ${OPENGROK_GLASSFISH_DOMAIN}"
10139N/A fi
15944N/A
10139N/A echo "${directory}"
10139N/A return
10139N/A fi
10139N/A
10139N/A # Arbitrary Domain Selection
10139N/A firstDomain=`ls -1 ${domainDirectory} | head -1`
10139N/A
10139N/A if [ -z "${firstDomain}" ]
10139N/A then
10139N/A FatalError "Failed to dynamically determine Glassfish Domain from ${domainDirectory}"
10139N/A fi
10139N/A
10139N/A echo "${domainDirectory}/${firstDomain}/autodeploy"
10139N/A}
10139N/A
10139N/A#
10139N/A# Implementation
10139N/A#
10139N/A# The variable "DO" can usefully be set to "echo" to aid in script debugging
10139N/A#
10139N/A
10139N/ALoadStandardEnvironment()
10139N/A{
10139N/A # Setup a standard execution environment (if required)
10139N/A
10139N/A OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-/pkgs/sbin/CronExecutionEnvironment.sh}"
10139N/A
10139N/A if [ -f "${OPENGROK_STANDARD_ENV}" ]
10139N/A then
10139N/A Progress "Loading ${OPENGROK_STANDARD_ENV} ..."
10139N/A . "${OPENGROK_STANDARD_ENV}"
10139N/A fi
10139N/A}
10139N/A
10139N/ALoadInstanceConfiguration()
10139N/A{
10139N/A # Note: As all functions have been defined by the time this routine
10139N/A # is called, your configuration can, if desired, override functions
10139N/A # in addition to setting the variables mentioned in the function
10139N/A # DefaultInstanceConfiguration(), this maybe useful to override
10139N/A # functionality used to determine the default deployment environment
10139N/A # find dependencies or validate the configuration, for example.
10139N/A
10139N/A if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
11904N/A then
10139N/A # Load the Local OpenGrok Configuration Environment
11904N/A Progress "Loading ${OPENGROK_CONFIGURATION} ..."
11904N/A . "${OPENGROK_CONFIGURATION}"
10139N/A else
10139N/A Progress "Loading the default instance configuration ..."
11904N/A DefaultInstanceConfiguration
10139N/A fi
10139N/A}
10139N/A
10139N/AValidateConfiguration()
10139N/A{
10139N/A if [ ! -x "${EXUBERANT_CTAGS}" ]
10139N/A then
10139N/A FatalError "Missing Dependent Application - Exuberant CTags"
10139N/A fi
10139N/A
10139N/A if [ ! -d "${SRC_ROOT}" ]
10139N/A then
10139N/A FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
10139N/A fi
10139N/A
10139N/A if [ -n "${QUIET}" -a -n "${VERBOSE}" ]
10139N/A then
10139N/A Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
10139N/A QUIET=""
10139N/A VERBOSE="-v"
10139N/A fi
10139N/A}
10139N/A
10139N/ACreateRuntimeRequirements()
10139N/A{
10139N/A if [ ! -d "${DATA_ROOT}" ]
10139N/A then
10139N/A Warning "OpenGrok Generated Data Path ${DATA_ROOT} doesn't exist"
10139N/A Progress " Attempting to create generated data directory ... "
10139N/A ${DO} mkdir -p "${DATA_ROOT}"
10139N/A fi
10139N/A if [ ! -d "${DATA_ROOT}" ]
10139N/A then
10139N/A FatalError "OpenGrok Data Path ${DATA_ROOT} doesn't exist"
10139N/A fi
13688N/A
13688N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ]
10139N/A then
10139N/A Warning "OpenGrok Generated Etc Path ${OPENGROK_INSTANCE_BASE}/etc doesn't exist"
12787N/A Progress " Attempting to create generated etc directory ... "
12787N/A ${DO} mkdir -p "${OPENGROK_INSTANCE_BASE}/etc"
12787N/A fi
12787N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ]
12787N/A then
12787N/A FatalError "OpenGrok Etc Path ${OPENGROK_INSTANCE_BASE}/etc doesn't exist"
12787N/A fi
12787N/A
12787N/A if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ]
12787N/A then
12787N/A Progress " Creating default ${LOGGER_CONFIG_PATH} ... "
13285N/A if [ ! -f "${LOGGER_CONF_SOURCE}" ]
12787N/A then
12787N/A Warning "Can't find distribution logging configuration" \
12787N/A "(${LOGGER_CONF_SOURCE}) to install as default" \
12787N/A "logging configuration (${LOGGER_CONFIG_PATH})"
12787N/A else
12787N/A ${DO} grep -v java.util.logging.FileHandler.pattern "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
12787N/A ${DO} grep java.util.logging.FileHandler.pattern "${LOGGER_CONF_SOURCE}" | sed "s|opengrok%g.%u.log|${OPENGROK_INSTANCE_BASE}/log/opengrok%g.%u.log|g" >> "${LOGGER_CONFIG_PATH}"
10139N/A ${DO} mkdir ${OPENGROK_INSTANCE_BASE}/log
10139N/A fi
10139N/A fi
10139N/A}
10139N/A
10139N/AStdInvocation()
10139N/A{
10139N/A ${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
10139N/A ${LOGGER_PROPERTIES} \
10139N/A ${JAVA_DEBUG} \
12741N/A -jar ${OPENGROK_JAR} \
12741N/A ${IGNORE_PATTERNS} ${ENABLE_PROJECTS} \
12741N/A ${DERBY_HISTORY_CACHE} \
12741N/A ${SCAN_FOR_REPOSITORY} ${REMOTE_REPOSITORIES} \
12741N/A ${VERBOSE} ${QUIET} \
12741N/A ${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
12741N/A ${MAX_INDEXED_WORDS} ${SKIN} ${LEADING_WILDCARD} \
12741N/A ${READ_XML_CONF} \
12741N/A -W ${XML_CONFIGURATION} \
12741N/A ${WEBAPP_CONFIG_ADDRESS} \
13691N/A -s ${SRC_ROOT} -d ${DATA_ROOT} \
13691N/A "${@}"
13691N/A
13691N/A}
11925N/A
10139N/AUpdateGeneratedData()
10139N/A{
11232N/A StdInvocation -H
11232N/A}
11232N/A
11232N/AUpdateDescriptionCache()
10139N/A{
10139N/A # OPTIONAL : Update the EftarFile data
10139N/A
10139N/A if [ -n "${PATH_DESC}" -a -s "${PATH_DESC}" ]
10139N/A then
10139N/A ${DO} ${JAVA} -classpath ${OPENGROK_JAR} \
10139N/A ${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
10139N/A fi
10139N/A}
10139N/A
10139N/AOpenGrokUsage()
10139N/A{
10139N/A echo "Options for opengrok.jar:" 1>&2
10139N/A ${DO} ${JAVA} ${JAVA_OPTS} -jar ${OPENGROK_JAR} '-?'
10139N/A}
10139N/A
10139N/ADeployWar()
10139N/A{
10139N/A applicationServer="`FindApplicationServerType`"
10139N/A
10139N/A case "${applicationServer}" in
10139N/A
13725N/A Tomcat) warTarget="`DetermineWarDirectoryTomcat`" ;;
10139N/A Glassfish) warTarget="`DetermineWarDirectoryGlassfish`" ;;
10139N/A
13725N/A *) FatalError "Unsupported Application Server ${applicationServer}" ;;
13725N/A
10139N/A esac
10139N/A
10139N/A if [ -z "${warTarget}" ]
10139N/A then
10139N/A FatalError "Unable to determine Deployment Directory for ${applicationServer}"
10139N/A fi
13319N/A
10139N/A if [ ! -f "${OPENGROK_DIST_WAR}" ]
10139N/A then
11904N/A FatalError "Missing Web Application Archive ${OPENGROK_DIST_WAR}"
11904N/A fi
12013N/A
11904N/A if [ ! -d "${warTarget}" ]
15981N/A then
15981N/A FatalError "Missing Deployment Directory ${warTarget}"
11904N/A fi
10139N/A
10139N/A Progress "Installing ${OPENGROK_DIST_WAR} to ${warTarget} ..."
10139N/A ${DO} cp "${OPENGROK_DIST_WAR}" "${warTarget}/"
10139N/A if [ $? != 0 ]
10139N/A then
10139N/A FatalError "Web Application Installation FAILED"
10139N/A fi
10139N/A
10139N/A Progress
10139N/A Progress "Start your application server (${applicationServer}), if it is not already"
10139N/A Progress "running, or wait until it loads the just installed web application."
10139N/A Progress
10139N/A Progress "OpenGrok should be available on <HOST>:<PORT>/source"
10139N/A Progress " where HOST and PORT are configured in ${applicationServer}."
10139N/A Progress
10139N/A}
10139N/A
10139N/A#
10139N/A# Main Program
10139N/A#
10139N/A
10139N/Aif [ $# -eq 0 -o $# -gt 2 ]
10363N/Athen
10139N/A Usage
10139N/Afi
10139N/A
13488N/ALoadStandardEnvironment
10139N/A
10139N/ALoadInstanceConfiguration
10139N/A
11925N/Acase "${1}" in
13738N/A
13738N/A deploy)
11925N/A DeployWar
11925N/A ;;
10139N/A
10139N/A update)
13732N/A ValidateConfiguration
13732N/A CreateRuntimeRequirements
13732N/A UpdateGeneratedData
13732N/A UpdateDescriptionCache
13732N/A ;;
10139N/A
10139N/A updateQuietly)
13732N/A ValidateConfiguration
13732N/A CreateRuntimeRequirements
13732N/A QUIET="-q"
13732N/A VERBOSE=""
13891N/A UpdateGeneratedData
10139N/A UpdateDescriptionCache
10139N/A ;;
13625N/A
13625N/A index)
10139N/A if [ -n "${2}" ]
10139N/A then
10139N/A SRC_ROOT="${2}"
10139N/A fi
10139N/A ValidateConfiguration
10139N/A CreateRuntimeRequirements
10139N/A UpdateGeneratedData
10139N/A UpdateDescriptionCache
13872N/A ;;
11850N/A
10139N/A usage)
10139N/A OpenGrokUsage
10139N/A Usage
10139N/A ;;
10139N/A
10139N/A *)
13623N/A Usage
10139N/A ;;
10139N/A
10139N/Aesac
10139N/A
10139N/A#
10139N/A# End of File
10139N/A#
10139N/A