OpenGrok revision fbf97ea1786d1e25add88bbfb91810170473bc9f
9b2bd54c98edb185a3985410367754ab33217362bnicholes# OpenGrok Wrapper (initial setup and cron job updating)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# Supported Operating Systems:
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - Solaris 10 (SunOS 5.10)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - Solaris 11 (SunOS 5.11)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - Debian (Linux)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# Supported Deployment Engines:
0662ed52e814f8f08ef0e09956413a792584eddffuankg# - Tomcat 6
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - Tomcat 5.5
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - Glassfish
9b2bd54c98edb185a3985410367754ab33217362bnicholes# Supported Environment Variables:
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
70953fb44a7140fe206c3a5f011e24209c8c5c6abnicholes# Supported Environment Variables for configuring the default setup:
16b55a35cff91315d261d1baa776138af465c4e4fuankg# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
16b55a35cff91315d261d1baa776138af465c4e4fuankg# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
16b55a35cff91315d261d1baa776138af465c4e4fuankg# - EXUBERANT_CTAGS Full Path to Exuberant CTags
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line
9b2bd54c98edb185a3985410367754ab33217362bnicholes# options for CTags program (for its --options
9b2bd54c98edb185a3985410367754ab33217362bnicholes# switch), default is DATA_ROOT/etc/ctags.config
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - JAVA_HOME Full Path to Java Installation Root
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - JAVA Full Path to java binary
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - JAVA_OPTS Java options
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
9b2bd54c98edb185a3985410367754ab33217362bnicholes# (contains domains)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_PROGRESS Shows progress in %(percentage) of working
9b2bd54c98edb185a3985410367754ab33217362bnicholes# through project, it's good to have Verbose
9b2bd54c98edb185a3985410367754ab33217362bnicholes# Mode enabled too, cost of this is one more
9b2bd54c98edb185a3985410367754ab33217362bnicholes# traversal of the project before indexing it(*)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_REMOTE_REPOS_OFF Disable History Cache for (remote)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# Repositories (*)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go
9b2bd54c98edb185a3985410367754ab33217362bnicholes# (by default 3 directories from SRC_ROOT)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
9b2bd54c98edb185a3985410367754ab33217362bnicholes# (use "none" to avoid sending it to web app)
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - OPENGROK_WPREFIX Disable wildcard prefix search query
9b2bd54c98edb185a3985410367754ab33217362bnicholes# support (*)
be06f010941d039a422f1bbd7e321a1a0e92e291bnicholes# - OPENGROK_DERBY if set, then indexer tries to use derby as
9b2bd54c98edb185a3985410367754ab33217362bnicholes# historycache (see derby command of this
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - READ_XML_CONFIGURATION file with read only configuration
9b2bd54c98edb185a3985410367754ab33217362bnicholes# - temporary workaround for bug # 327
be06f010941d039a422f1bbd7e321a1a0e92e291bnicholes# (*) Any Non-Empty String will enable these options
9b2bd54c98edb185a3985410367754ab33217362bnicholes# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
be06f010941d039a422f1bbd7e321a1a0e92e291bnicholes# Print usage to stderr and exit.
9b2bd54c98edb185a3985410367754ab33217362bnicholes echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>"
9b2bd54c98edb185a3985410367754ab33217362bnicholes echo " OPENGROK_CONFIGURATION - location of your configuration"
9b2bd54c98edb185a3985410367754ab33217362bnicholes echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
9b2bd54c98edb185a3985410367754ab33217362bnicholes echo " See the code for more information on configuration options /" \
9b2bd54c98edb185a3985410367754ab33217362bnicholes# Runtime Configuration
9b2bd54c98edb185a3985410367754ab33217362bnicholes# TODO: Handle symlinks correctly (especially in ${0})
9b2bd54c98edb185a3985410367754ab33217362bnicholes# Default Instance Configuration
9b2bd54c98edb185a3985410367754ab33217362bnicholes # Use the built-in defaults. This section can be copied to its own
9b2bd54c98edb185a3985410367754ab33217362bnicholes # file and tailored to your local requirements. Then simply set
0662ed52e814f8f08ef0e09956413a792584eddffuankg # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
9b2bd54c98edb185a3985410367754ab33217362bnicholes # this wrapper. It will save you hand editing in your settings
be06f010941d039a422f1bbd7e321a1a0e92e291bnicholes # on each new release. A sample cron(1M) entry might look like:
9b2bd54c98edb185a3985410367754ab33217362bnicholes # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
9b2bd54c98edb185a3985410367754ab33217362bnicholes # Note: It is not really possible to ever provided defaults for
9b2bd54c98edb185a3985410367754ab33217362bnicholes # these values which will run in every UNIX-like environment.
9b2bd54c98edb185a3985410367754ab33217362bnicholes # So I have provided a set which are functional for a given
9b2bd54c98edb185a3985410367754ab33217362bnicholes # environment on which you can based you own configuration.
9b2bd54c98edb185a3985410367754ab33217362bnicholes # This has been updated to support more environment variables and
9b2bd54c98edb185a3985410367754ab33217362bnicholes # operating systems, if you have any reasonably generic
9b2bd54c98edb185a3985410367754ab33217362bnicholes # improvements please feel free to submit a patch.
9b2bd54c98edb185a3985410367754ab33217362bnicholes OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
9b2bd54c98edb185a3985410367754ab33217362bnicholes OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
9b2bd54c98edb185a3985410367754ab33217362bnicholes LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
9b2bd54c98edb185a3985410367754ab33217362bnicholes OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
9b2bd54c98edb185a3985410367754ab33217362bnicholes LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
9b2bd54c98edb185a3985410367754ab33217362bnicholes LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
9b2bd54c98edb185a3985410367754ab33217362bnicholes # (your source code or the root of all repositories)
9b2bd54c98edb185a3985410367754ab33217362bnicholes # (for Lucene index and hypertext cross-references)
9b2bd54c98edb185a3985410367754ab33217362bnicholes # This area is rebuilt by "update" / "updateQuietly"
9b2bd54c98edb185a3985410367754ab33217362bnicholes # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
9b2bd54c98edb185a3985410367754ab33217362bnicholes # (The user maintained source of the generated EftarFile file)
9b2bd54c98edb185a3985410367754ab33217362bnicholes PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
9b2bd54c98edb185a3985410367754ab33217362bnicholes XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
9b2bd54c98edb185a3985410367754ab33217362bnicholes # OPTIONAL: read only XML config, if it exists, it will be read
9b2bd54c98edb185a3985410367754ab33217362bnicholes READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
9b2bd54c98edb185a3985410367754ab33217362bnicholes LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
9b2bd54c98edb185a3985410367754ab33217362bnicholes LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
9b2bd54c98edb185a3985410367754ab33217362bnicholes # REQUIRED: Java Archive of OpenGrok (Installation Location)
9b2bd54c98edb185a3985410367754ab33217362bnicholes OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
9b2bd54c98edb185a3985410367754ab33217362bnicholes # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
9b2bd54c98edb185a3985410367754ab33217362bnicholes # (user building from source code will find this and other key
be06f010941d039a422f1bbd7e321a1a0e92e291bnicholes # files in the "dist" directory after the build is completed)
9b2bd54c98edb185a3985410367754ab33217362bnicholes OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
9b2bd54c98edb185a3985410367754ab33217362bnicholes EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
9b2bd54c98edb185a3985410367754ab33217362bnicholes # OPTIONAL: supply extra command line options to CTags program
9b2bd54c98edb185a3985410367754ab33217362bnicholes if [ -n ${OPENGROK_CTAGS_OPTIONS_FILE} ]; then
9b2bd54c98edb185a3985410367754ab33217362bnicholes CTAGS_OPTIONS_FILE="${OPENGROK_CTAGS_OPTIONS_FILE}"
9b2bd54c98edb185a3985410367754ab33217362bnicholes elif [ -r "${OPENGROK_INSTANCE_BASE}/etc/ctags.config" ]; then
9b2bd54c98edb185a3985410367754ab33217362bnicholes CTAGS_OPTIONS_FILE="${OPENGROK_INSTANCE_BASE}/etc/ctags.config"
9b2bd54c98edb185a3985410367754ab33217362bnicholes # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
9b2bd54c98edb185a3985410367754ab33217362bnicholes #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
9b2bd54c98edb185a3985410367754ab33217362bnicholes # OPTIONAL: Ignore these patterns as names of files or directories
9b2bd54c98edb185a3985410367754ab33217362bnicholes # (Every directory in SRC_ROOT is considered a separate project)
9b2bd54c98edb185a3985410367754ab33217362bnicholes # OPTIONAL: Scanning Options (for Mercurial repositories)
609ef720afd62ca63391c9fdb415cd2faf29aa46bnicholes # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
9b2bd54c98edb185a3985410367754ab33217362bnicholes # OPTIONAL: override depth of scanning for repositories
9b2bd54c98edb185a3985410367754ab33217362bnicholes # Note, that you might run out of memory, then either increase JVM memory
9b2bd54c98edb185a3985410367754ab33217362bnicholes # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not
0662ed52e814f8f08ef0e09956413a792584eddffuankg # indexing the rest of the file, once the limit is reached)
9b2bd54c98edb185a3985410367754ab33217362bnicholes if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then
${CVS:+-Dorg.opensolaris.opengrok.history.cvs=$CVS} \
${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
${DO} exit 2
for f in $@
echo $file
if test $? -eq 1
if test $? -ne 0
echo ${binary}
Linux:*)
if [ -f /etc/alternatives/java ]
/usr/lib/jvm/sun-jre-1.6 \
${OPENGROK_TOMCAT_BASE} \
if [ ! -d ${OPENGROK_INSTANCE_BASE}/log ]
${DO} mkdir ${OPENGROK_INSTANCE_BASE}/log
${DO} mkdir -p ${OPENGROK_INSTANCE_BASE}/derby
${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
${LOGGER_PROPERTIES} \
${JAVA_DEBUG} \
-jar ${OPENGROK_JAR} \
${IGNORE_PATTERNS} ${ENABLE_PROJECTS} \
${DERBY_HISTORY_CACHE} \
${SCAN_DEPTH} \
${PROGRESS} \
${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
${CTAGS_OPTIONS_FILE:+-o} ${CTAGS_OPTIONS_FILE} \
${MAX_INDEXED_WORDS} ${SKIN} ${LEADING_WILDCARD} \
${READ_XML_CONF} \
-W ${XML_CONFIGURATION} \
${WEBAPP_CONFIG} \
${DO} ${JAVA} -classpath ${OPENGROK_JAR} \
${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
SunOS:5.11)
Linux:*)
mkdir -p $DATA_ROOT/derby