OpenGrok revision 1278
38dc768d53401362cfab01623c04f5787f4b79a2dugan# OpenGrok Wrapper (initial setup and cron job updating)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# Supported Operating Systems:
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - Solaris 10 (SunOS 5.10)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OpenSolaris (SunOS 5.11)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - Debian (Linux)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# Supported Deployment Engines:
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - Tomcat 6
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - Tomcat 5.5
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - Glassfish
38dc768d53401362cfab01623c04f5787f4b79a2dugan# Supported Environment Variables:
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# Supported Environment Variables for configuring the default setup:
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - EXUBERANT_CTAGS Full Path to Exuberant CTags
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - JAVA_HOME Full Path to Java Installation Root
8fdce8873fa061957e8c3a440ec7ec5d15a41263matthew_swift# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish (contains domains)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_PROGRESS Shows progress in %(percentage) of working through project, it's good to have Verbose Mode enabled too, cost of this is one more traversal of the project before indexing it (*)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_REMOTE_REPOS Disable History Cache for (remote) Repositories (*)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)_
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go (by default 3 directories from SRC_ROOT)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_WPREFIX Disable wildcard prefix search query support (*)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - OPENGROK_DERBY if set, then indexer tries to use derby as historycache (see derby command of this script)
38dc768d53401362cfab01623c04f5787f4b79a2dugan# - READ_XML_CONFIGURATION file with read only configuration - a temp workaround for bug # 327
38dc768d53401362cfab01623c04f5787f4b79a2dugan# (*) Any Non-Empty String will enable these options
38dc768d53401362cfab01623c04f5787f4b79a2dugan echo "Usage: ${0} <deploy|derby|update|updateQuietly|usage>" 1>&2
d25372dc8e65a9ed019a88fdf659ca61313f1b31jcduff echo " OPENGROK_CONFIGURATION - location of your configuration" 1>&2
38dc768d53401362cfab01623c04f5787f4b79a2dugan echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... " 1>&2
38dc768d53401362cfab01623c04f5787f4b79a2dugan echo " See the code for more information on configuration options / variables" 1>&2
38dc768d53401362cfab01623c04f5787f4b79a2dugan# Runtime Configuration
d25372dc8e65a9ed019a88fdf659ca61313f1b31jcduffif [ -f "/bin/uname" ]
38dc768d53401362cfab01623c04f5787f4b79a2dugan# TODO: Handle symlinks correctly (especially in ${0})
38dc768d53401362cfab01623c04f5787f4b79a2dugan# Default Instance Configuration
38dc768d53401362cfab01623c04f5787f4b79a2dugan # Use the built-in defaults. This section can be copied to its own
38dc768d53401362cfab01623c04f5787f4b79a2dugan # file and tailored to your local requirements. Then simply set
38dc768d53401362cfab01623c04f5787f4b79a2dugan # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
38dc768d53401362cfab01623c04f5787f4b79a2dugan # this wrapper. It will save you hand editing in your settings
38dc768d53401362cfab01623c04f5787f4b79a2dugan # on each new release. A sample cron(1M) entry might look like:
38dc768d53401362cfab01623c04f5787f4b79a2dugan # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
38dc768d53401362cfab01623c04f5787f4b79a2dugan # Note: It is not really possible to ever provided defaults for
38dc768d53401362cfab01623c04f5787f4b79a2dugan # these values which will run in every UNIX-like environment.
38dc768d53401362cfab01623c04f5787f4b79a2dugan # So I have provided a set which are functional for a given
38dc768d53401362cfab01623c04f5787f4b79a2dugan # environment on which you can based you own configuration.
38dc768d53401362cfab01623c04f5787f4b79a2dugan # This has been updated to support more environment variables and
38dc768d53401362cfab01623c04f5787f4b79a2dugan # operating systems, if you have any reasonably generic
38dc768d53401362cfab01623c04f5787f4b79a2dugan OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
38dc768d53401362cfab01623c04f5787f4b79a2dugan LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
38dc768d53401362cfab01623c04f5787f4b79a2dugan OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
38dc768d53401362cfab01623c04f5787f4b79a2dugan LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/${LOGGER_CONFIG_FILE}"
38dc768d53401362cfab01623c04f5787f4b79a2dugan # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
38dc768d53401362cfab01623c04f5787f4b79a2dugan # (The user maintained source of the generated EftarFile file)
38dc768d53401362cfab01623c04f5787f4b79a2dugan XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
38dc768d53401362cfab01623c04f5787f4b79a2dugan # OPTIONAL: read only XML config, if it exists, it will be read
38dc768d53401362cfab01623c04f5787f4b79a2dugan LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
38dc768d53401362cfab01623c04f5787f4b79a2dugan LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
38dc768d53401362cfab01623c04f5787f4b79a2dugan # REQUIRED: Java Archive of OpenGrok (Installation Location)
38dc768d53401362cfab01623c04f5787f4b79a2dugan OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
38dc768d53401362cfab01623c04f5787f4b79a2dugan # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
38dc768d53401362cfab01623c04f5787f4b79a2dugan # (user building from source code will find this and other key
38dc768d53401362cfab01623c04f5787f4b79a2dugan # files in the "dist" directory after the build is completed)
38dc768d53401362cfab01623c04f5787f4b79a2dugan OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
38dc768d53401362cfab01623c04f5787f4b79a2dugan EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
export JAVA_HOME
# DEVELOPMENT: Debug option, if enabled current indexer will listen on the port 8010 until a debugger connects
${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} \
Warning "CHECK: derbyclient.jar needs to be in where the rest of opengrok used jars are and in unpacked source.war in WEB-INF/lib !!!"
${DO} grep -v java.util.logging.FileHandler.pattern "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
${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}"
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} \
${DO} ${JAVA} -classpath ${OPENGROK_JAR} \
${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
SunOS:5.11)
Linux:*)
mkdir -p $DATA_ROOT/derby