OpenGrok revision 294
294N/A#!/bin/sh
294N/A#
294N/A# OpenGrok Wrapper (Interactive GUI, Initial Generation and Cron Job Updating)
294N/A#
294N/A
294N/A#
294N/A# Usage
294N/A#
294N/A
294N/AUsage()
294N/A{
294N/A echo 1>&2
294N/A echo "Usage: ${0} <update|updateQuietly|updateConfiguration|usage|gui>" 1>&2
294N/A echo 1>&2
294N/A exit 1
294N/A}
294N/A
294N/A#
294N/A# Configuration
294N/A#
294N/Aif [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
294N/Athen
294N/A # Load the Local OpenGrok Configuration Environment
294N/A . "${OPENGROK_CONFIGURATION}"
294N/Aelse
294N/A # Use the built-in defaults. This section can be copied to its own
294N/A # file and tailored to your local requirements. Then simply set
294N/A # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
294N/A # this wrapper. It will save you hand editing in your settings
294N/A # on each new release. A sample Cron Entry might look like:
294N/A # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
294N/A
294N/A # Note: It is not really possible to ever provided defaults for
294N/A # these values which will run in every UNIX-like environment.
294N/A # So I have provided a set which are functional for a given
294N/A # environment on which you can based you own configuration.
294N/A
294N/A # Setup a standard execution environment
294N/A if [ -f /pkgs/sbin/CronExecutionEnvironment.sh ]
294N/A then
294N/A . /pkgs/sbin/CronExecutionEnvironment.sh
294N/A fi
294N/A
294N/A # REQUIRED: Source Code/Repository Root
294N/A # (your source code or the root of all repositories)
294N/A SRC_ROOT="/data/opengrok/src"
294N/A
294N/A # REQUIRED: OpenGrok Generate Data Root
294N/A # (for Lucene index and hypertext cross-references)
294N/A # This area is rebuilt by "update" / "updateQuietly"
294N/A DATA_ROOT="/data/opengrok/data"
294N/A
294N/A # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
294N/A # (The user maintained source of the generated EftarFile file)
294N/A PATH_DESC="/data/opengrok/etc/paths.tsv"
294N/A
294N/A # REQUIRED: XML Configuration
294N/A # (the configuration used by Web/GUI interfaces)
294N/A XML_CONFIGURATION="/data/opengrok/configuration.xml"
294N/A
294N/A # REQUIRED: Java Archive of OpenGrok
294N/A # (user building from source code will find this other key
294N/A # files in the "dist" directory after the build is completed)
294N/A OPENGROK_JAR="/data/opengrok/opengrok.jar"
294N/A
294N/A # REQUIRED: Exuberant CTags (http://ctags.sf.net)
294N/A EXUBERANT_CTAGS="/pkgs/64-bit/release/ctags-5.7/bin/ctags"
294N/A
294N/A # REQUIRED: Java Home
294N/A JAVA_HOME="/usr/jdk/instances/jdk1.6.0"
294N/A export JAVA_HOME
294N/A
294N/A # REQUIRED: Java Virtual Machine
294N/A JAVA="${JAVA_HOME}/bin/java"
294N/A
294N/A # OPTIONAL: Uncomment the following line if your source contains Mercurial repositories.
294N/A SCAN_FOR_REPOSITORY="-S"
294N/A
294N/A # OPTIONAL: Override Built-in Properties
294N/A PROPERTIES="-Dorg.opensolaris.opengrok.history.Mercurial=/pkgs/bin/hg"
294N/A
294N/A # OPTIONAL: JVM Options
294N/A #JAVA_OPTS="-server -Xmx1024m"
294N/A
294N/A # DELIVERED: An update program for EftarFile
294N/A # Usage: <class> inputFile [inputFile ...] outputFile
294N/A # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
294N/A EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
294N/A
294N/A # HARDCODED: Generated EftarFile (See web/*.jsp)
294N/A EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
294N/A
294N/A # Be Quiet? (set indirectly by command line arguments in the main program)
294N/A QUIET=
294N/A
294N/A # or alternatively, Be Verbose!
294N/A #VERBOSE="-v"
294N/Afi
294N/A
294N/A#
294N/A# Implementation
294N/A#
294N/A
294N/A# The variable "DO" can usefully be set to "echo" to aid in script debugging
294N/A
294N/AStdInvocation()
294N/A{
294N/A ${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
294N/A -jar ${OPENGROK_JAR} \
294N/A ${SCAN_FOR_REPOSITORY} ${VERBOSE} ${QUIET} \
294N/A ${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
294N/A -s ${SRC_ROOT} -d ${DATA_ROOT} \
294N/A "${@}"
294N/A}
294N/A
294N/AUpdateGeneratedConfiguration()
294N/A{
294N/A StdInvocation -W ${XML_CONFIGURATION}
294N/A}
294N/A
294N/AUpdateGeneratedData()
294N/A{
294N/A StdInvocation -H
294N/A}
294N/A
294N/AUpdateDescriptionCache()
294N/A{
294N/A # OPTIONAL : Update the EftarFile data
294N/A
294N/A if [ -n "${PATH_DESC}" -o -s "${PATH_DESC}" ]
294N/A then
294N/A ${DO} ${JAVA} -classpath ${OPENGROK_JAR} \
294N/A ${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
294N/A fi
294N/A}
294N/A
294N/AInvokeGUI()
294N/A{
294N/A ${DO} ${JAVA} ${JAVA_OPTS} -jar ${OPENGROK_JAR} &
294N/A}
294N/A
294N/AOpenGrokUsage()
294N/A{
294N/A ${DO} ${JAVA} ${JAVA_OPTS} -jar ${OPENGROK_JAR} '-?'
294N/A}
294N/A
294N/A#
294N/A# Main Program
294N/A#
294N/A
294N/Aif [ $# -ne 1 ]
294N/Athen
294N/A Usage
294N/Afi
294N/A
294N/Acase "${1}" in
294N/A
294N/A update)
294N/A UpdateGeneratedData
294N/A UpdateDescriptionCache
294N/A ;;
294N/A
294N/A updateQuietly)
294N/A QUIET="-q"
294N/A VERBOSE=""
294N/A UpdateGeneratedData
294N/A UpdateDescriptionCache
294N/A ;;
294N/A
294N/A updateConfiguration)
294N/A UpdateGeneratedConfiguration
294N/A ;;
294N/A
294N/A usage)
294N/A OpenGrokUsage
294N/A ;;
294N/A
294N/A gui)
294N/A InvokeGUI
294N/A ;;
294N/A
294N/A *)
294N/A Usage
294N/A ;;
294N/A
294N/Aesac
294N/A
294N/A#
294N/A# End of File
294N/A#