OpenGrok revision b17cb0705d90907337b3528aa7b8ed1700806f26
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# OpenGrok Wrapper (initial setup and cron job updating)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Supported Operating Systems:
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - Solaris 10 (SunOS 5.10)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - Solaris 11 (SunOS 5.11)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - Debian (Linux)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Supported Deployment Engines:
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - Tomcat 5.5
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Supported Environment Variables:
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Supported Environment Variables for configuring the default setup:
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - EXUBERANT_CTAGS Full Path to Exuberant CTags
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - JAVA_HOME Full Path to Java Installation Root
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - JAVA Full Path to java binary
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - JAVA_OPTS Java options
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# (contains domains)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger# - OPENGROK_PROGRESS Shows progress in %(percentage) of working
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger# through project, it's good to have Verbose
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Mode enabled too, cost of this is one more
4095b5839a2805b2313532c995ad3d444f596d03Kryštof Tulinger# traversal of the project before indexing it(*)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_REMOTE_REPOS_OFF Disable History Cache for (remote)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Repositories (*)
4095b5839a2805b2313532c995ad3d444f596d03Kryštof Tulinger# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# (by default 3 directories from SRC_ROOT)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# (use "none" to avoid sending it to web app)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_WPREFIX Disable wildcard prefix search query
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - OPENGROK_DERBY if set, then indexer tries to use derby as
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# historycache (see derby command of this
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - READ_XML_CONFIGURATION file with read only configuration
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# - temporary workaround for bug # 327
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# (*) Any Non-Empty String will enable these options
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Print usage to stderr and exit.
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage>" 1>&2
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger echo " ${progname} index [<directory>]" 1>&2
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger echo " Optional environment variables:" 1>&2
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger echo " OPENGROK_CONFIGURATION - location of your configuration" 1>&2
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... " 1>&2
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger echo " See the code for more information on configuration options /" \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Runtime Configuration
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# TODO: Handle symlinks correctly (especially in ${0})
838924562130977ca1a3d3839d146fcda39ea1afKryštof TulingerSCRIPT_DIRECTORY="`cd ${SCRIPT_DIRECTORY}; pwd`"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Default Instance Configuration
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # Use the built-in defaults. This section can be copied to its own
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # file and tailored to your local requirements. Then simply set
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # this wrapper. It will save you hand editing in your settings
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # on each new release. A sample cron(1M) entry might look like:
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # Note: It is not really possible to ever provided defaults for
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # these values which will run in every UNIX-like environment.
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # So I have provided a set which are functional for a given
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # environment on which you can based you own configuration.
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # This has been updated to support more environment variables and
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # operating systems, if you have any reasonably generic
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # improvements please feel free to submit a patch.
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger -f "${SCRIPT_DIRECTORY}/dist/opengrok.jar" -a \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # (your source code or the root of all repositories)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # (for Lucene index and hypertext cross-references)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # This area is rebuilt by "update" / "updateQuietly"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # (The user maintained source of the generated EftarFile file)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # (the configuration used by Web/GUI interfaces)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: read only XML config, if it exists, it will be read
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger if [ -f "${READ_XML_CONFIGURATION}" ] ; then
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger READ_XML_CONF="-R ${READ_XML_CONFIGURATION}"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # REQUIRED: Java Archive of OpenGrok (Installation Location)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # (user building from source code will find this and other key
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # files in the "dist" directory after the build is completed)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # REQUIRED: Exuberant CTags (http://ctags.sf.net)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: Ignore these patterns as names of files or directories
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # (Every directory in SRC_ROOT is considered a separate project)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: Scanning Options (for Mercurial repositories)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: override depth of scanning for repositories
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: Allow Leading Wildcard Searches
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # (Options: default, offwhite and polished.
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: Set Maximum Indexed Words Per File
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # Note, that you might run out of memory, then either increase JVM memory
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # indexing the rest of the file, once the limit is reached)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: Configuration Address (host:port)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger if [ -n "${OPENGROK_WEBAPP_CFGADDR}" ]; then
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger WEBAPP_CONFIG_ADDRESS=${OPENGROK_WEBAPP_CFGADDR}
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger WEBAPP_CONFIG="-U ${WEBAPP_CONFIG_ADDRESS}"
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger # Assumption: We should not set properties to the empty string
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger${CVS:+-Dorg.opensolaris.opengrok.history.cvs=$CVS} \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger${SVN:+-Dorg.opensolaris.opengrok.history.Subversion=$SVN} \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # OPTIONAL: Store The History Cache in Java DB (derby),
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # instead of file system (in gzipped xml files).
4ff40998447db64e675e85cda2bf3ae286b71529Kryštof Tulinger # - derbyclient.jar - See README.txt for more details
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # - Running Derby Server - Defaults to localhost:1527
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # DELIVERED: An update program for EftarFile
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # Usage: <class> inputFile [inputFile ...] outputFile
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # HARDCODED: Generated EftarFile (See web/*.jsp)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger # Be Quiet? (set indirectly by command line arguments in the main program)
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# Helper Functions - Logging
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# In general, non-interactive use like cron jobs and automated
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# installation environments should not generate unnecessary
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# progress information or warnings, as usage and configuration
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger# will have generally been debugged prior to automation.
${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} \
${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