OpenGrok revision b17cb0705d90907337b3528aa7b8ed1700806f26
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# OpenGrok Wrapper (initial setup and cron job updating)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Supported Operating Systems:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Solaris 10 (SunOS 5.10)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Solaris 11 (SunOS 5.11)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Debian (Linux)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Supported Deployment Engines:
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Tomcat 6
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Tomcat 5.5
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - Glassfish
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# 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# - READ_XML_CONFIGURATION file with read only configuration
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# - temporary workaround for bug # 327
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# (*) Any Non-Empty String will enable these options
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Print usage to stderr and exit.
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage>" 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 " See the code for more information on configuration options /" \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Runtime Configuration
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankgif [ -f "/bin/uname" ]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# TODO: Handle symlinks correctly (especially in ${0})
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg# Default Instance Configuration
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 # 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 # This has been updated to support more environment variables and
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # operating systems, if you have any reasonably generic
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
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 # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (The user maintained source of the generated EftarFile file)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: read only XML config, if it exists, it will be read
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # REQUIRED: Java Archive of OpenGrok (Installation Location)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
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 EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Ignore these patterns as names of files or directories
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # (Every directory in SRC_ROOT is considered a separate project)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Scanning Options (for Mercurial repositories)
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: override depth of scanning for repositories
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 # Assumption: We should not set properties to the empty string
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
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${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # OPTIONAL: Store The History Cache in Java DB (derby),
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # - derbyclient.jar - See README.txt for more details
fc1365b60fa715841c959c6b91c7ed83884ba3fcfuankg # - Running Derby Server - Defaults to localhost:1527
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 # Be Quiet? (set indirectly by command line arguments in the main program)
${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