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