OpenGrok revision 25d3d16c420712ddaa22503d2b9d1135b7c5eed2
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# OpenGrok Wrapper (initial setup and cron job updating)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Supported Operating Systems:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Solaris 11 (SunOS 5.11)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Solaris 12 (SunOS 5.12)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Debian (Linux)
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# Supported Deployment Engines:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Glassfish
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# Supported Environment Variables:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Supported Environment Variables for configuring the default setup:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - EXUBERANT_CTAGS Full Path to Exuberant CTags
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# options for CTags program (for its --options
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# switch), default is DATA_ROOT/etc/ctags.config
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - JAVA_HOME Full Path to Java Installation Root
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - JAVA Full Path to java binary (to enable 64bit JDK)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - JAVA_OPTS Java options (e.g. for JVM memory increase
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# or enabling server JDK)
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# JAVA_OPTS=-Xmx2048m is the default!
3a5046f0538ba9fb3a9429199544a9f4b93d9a4dLubos Kosco# - OPENGROK_APP_SERVER Application Server ("Tomcat", "Glassfish" or "Resin")
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco# - OPENGROK_WAR_TARGET_RESIN Resin Specific WAR Target Directory
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco# (contains domains)
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# - OPENGROK_RESIN_BASE Base Directory for Resin (contains webapps)
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_PROGRESS Shows progress in %(percentage) of working
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# through project, it's good to have Verbose
cd348e325366620fe047edcc849e3c9424828599Peter Bray# Mode enabled too, cost of this is one more
cd348e325366620fe047edcc849e3c9424828599Peter Bray# traversal of the project before indexing it(*)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - OPENGROK_GENERATE_HISTORY Influence history cache generation
cd348e325366620fe047edcc849e3c9424828599Peter Bray# Following values are recognized:
cd348e325366620fe047edcc849e3c9424828599Peter Bray# on - enabled (default)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# off - disabled for indexing and UI
cd348e325366620fe047edcc849e3c9424828599Peter Bray# dirbased - indexing enabled only for repos
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco# which can fetch history for
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# local - for local repos only
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# uionly - enabled for UI only
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco# - OPENGROK_ENABLE_PROJECTS Enable projects (set it to true or false)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Every directory in SRC_ROOT is
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# considered a separate project
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go
cd348e325366620fe047edcc849e3c9424828599Peter Bray# (by default 3 directories from SRC_ROOT)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
cd348e325366620fe047edcc849e3c9424828599Peter Bray# (use "none" to avoid sending it to web app)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - OPENGROK_WEBAPP_CONTEXT Context URL of the OpenGrok webapp
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# (by default /source)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - FULL reindex is needed once this is used
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# (old already indexed files won't be refreshed)
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# - OPENGROK_WPREFIX Disable wildcard prefix search query
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# support (*)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_DERBY if set, then indexer tries to use derby as
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# historycache (see derby command of this
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# - OPENGROK_DERBY_URL Use specific URL to JavaDB, e.g.
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# "jdbc:derby://localhost:1528/cachedb;create=true"
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# (default port is 1527)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray# - OPENGROK_TAG Enable parsing of revision tags into the History
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray# - READ_XML_CONFIGURATION file with read only configuration
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray# - temporary workaround for bug # 327
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_FLUSH_RAM_BUFFER_SIZE="-m 16" - set RAM buffer size for flushing,
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# default is 16MB per thread, you might try to
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# increase it to 256MB, but do increase JVM to
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# 4/8/16GB ! Lucene defaults to 8 threads.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Increase JVM memory as noted using JAVA_OPTS
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_LOGGER_CONFIG_PATH Set path to custom logging.properties file.
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - OPENGROK_SUBVERSION_USERNAME name of the user that should be used for
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# fetching the history from subversion
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - OPENGROK_SUBVERSION_PASSWORD password of the user that should be used for
cd348e325366620fe047edcc849e3c9424828599Peter Bray# fetching the history from subversion
cd348e325366620fe047edcc849e3c9424828599Peter Bray# (*) Any Non-Empty String will enable these options
cd348e325366620fe047edcc849e3c9424828599Peter Bray# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Print usage to stdout and exit.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray echo " ${progname} indexpart <src_root> <directory1> [..]"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray echo " ${progname} clearHistory <src_root> <repository_name>"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo " OPENGROK_CONFIGURATION - location of your configuration"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo " See the code for more information on configuration options /" \
cd348e325366620fe047edcc849e3c9424828599Peter Bray# Runtime Configuration
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Brayif [ -x "/bin/uname" ]; then
cd348e325366620fe047edcc849e3c9424828599Peter Brayelif [ -x "/usr/bin/uname" ]; then
cd348e325366620fe047edcc849e3c9424828599Peter Bray echo "Cannot determine operating system version"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# TODO: Handle symlinks correctly (especially in ${0})
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco# Default Instance Configuration
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco # Use the built-in defaults. This section can be copied to its own
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # file and tailored to your local requirements. Then simply set
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # this wrapper. It will save you hand editing in your settings
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # on each new release. A sample cron(1M) entry might look like:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Note: It is not really possible to ever provided defaults for
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # these values which will run in every UNIX-like environment.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # So I have provided a set which are functional for a given
cd348e325366620fe047edcc849e3c9424828599Peter Bray # environment on which you can based you own configuration.
cd348e325366620fe047edcc849e3c9424828599Peter Bray # This has been updated to support more environment variables and
cd348e325366620fe047edcc849e3c9424828599Peter Bray # operating systems, if you have any reasonably generic
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # improvements please feel free to submit a patch.
cd348e325366620fe047edcc849e3c9424828599Peter Bray OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray # (your source code or the root of all repositories)
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco # (for Lucene index and hypertext cross-references)
8f8c3f4555e5aa3160f03f2e9c55ddbd3381357bLubos Kosco # This area is rebuilt by "update" / "updateQuietly"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: User Provided Source Path to Description Mapping
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco # (The user maintained source of the generated EftarFile file)
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco # (the configuration used by Web/GUI interfaces)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco # OPTIONAL: read only XML config, if it exists, it will be read
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray if [ ! -f "${OPENGROK_LOGGER_CONFIG_PATH}" ]; then
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco echo "File ${OPENGROK_LOGGER_CONFIG_PATH} does not exist"
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco LOGGER_CONFIG_PATH=${OPENGROK_LOGGER_CONFIG_PATH}
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # REQUIRED: Java Archive of OpenGrok (Installation Location)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
ba2e31d47682cf0d28fe7a33f5c0d226a21aee17Lubos Kosco # (user building from source code will find this and other key
ba2e31d47682cf0d28fe7a33f5c0d226a21aee17Lubos Kosco # files in the "dist" directory after the build is completed)
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # REQUIRED: Exuberant CTags (http://ctags.sf.net)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: supply extra command line options to CTags program
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco if [ -n "${OPENGROK_CTAGS_OPTIONS_FILE}" ]; then
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco CTAGS_OPTIONS_FILE="${OPENGROK_CTAGS_OPTIONS_FILE}"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco elif [ -r "${OPENGROK_INSTANCE_BASE}/etc/ctags.config" ]; then
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco CTAGS_OPTIONS_FILE="${OPENGROK_INSTANCE_BASE}/etc/ctags.config"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: Ignore these patterns as names of files or directories
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # To ignore skipping just the history cache creation for a particular
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # directory and all of it's subdirectories, touch an empty
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye # .opengrok_skip_history file at the root of that directory
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # (Every directory in SRC_ROOT is considered a separate project)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray OPENGROK_ENABLE_PROJECTS="${OPENGROK_ENABLE_PROJECTS:-true}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray # OPTIONAL: Scanning Options (for Mercurial repositories)
cd348e325366620fe047edcc849e3c9424828599Peter Bray # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray GENERATE_HISTORY="-r ${OPENGROK_GENERATE_HISTORY}"
3a5046f0538ba9fb3a9429199544a9f4b93d9a4dLubos Kosco # OPTIONAL: override depth of scanning for repositories
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ "${OPENGROK_WEBAPP_CFGADDR}" = "none" ]; then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Assumption: We should not set properties to the empty string
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${CVS:+-Dorg.opensolaris.opengrok.history.cvs=$CVS} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${SVN:+-Dorg.opensolaris.opengrok.history.Subversion=$SVN} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye # OPTIONAL: Store The History Cache in Java DB (derby),
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye # instead of file system (in gzipped xml files).
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # - derbyclient.jar - See README.txt for more details
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye # - Running Derby Server - Defaults to localhost:1527
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray DERBY_OPTIONS="${DERBY_OPTIONS} -u ${OPENGROK_DERBY_URL}"
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye # OPTIONAL: Show revision tags in History view.
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye # Turn this off if you want to increase indexing performance a bit
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Usage: <class> inputFile [inputFile ...] outputFile
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye # Be Quiet? (set indirectly by command line arguments in the main program)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Helper Functions - Logging
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# In general, non-interactive use like cron jobs and automated
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# installation environments should not generate unnecessary
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# progress information or warnings, as usage and configuration
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# will have generally been debugged prior to automation.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Helper Functions - Autodetection of Runtime Environment
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Search for Exuberant ctags intelligently, skipping
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray $binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ $? -eq 0 ]; then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ $found -eq 1 ]; then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ $found -ne 1 ]; then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Error "Unable to determine Exuberant CTags command name" \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray SunOS:5.10) javaHome="/usr/jdk/instances/jdk1.7.0" ;;
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray javaHome=`ls -l /etc/alternatives/java | cut -f 2 -d \> `
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Use this function to determine which environment the deploy the
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # web application function into. Some users (especially
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # developers) will have many deployment environments or will wish
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # to specify directly the application server to deploy to.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Either use the environment variable OPENGROK_APP_SERVER or
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # reimplement this function in your configuration file (as
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # This implementation favours Tomcat, but needs a lot of work,
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # especially if Glassfish is perferrerd or it is under the control
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Maybe a better implementation would be to call Application
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Server specific WAR Directory and see if they exist.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -x "/etc/init.d/appserv" -a -d "/var/appserver/domains" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -d "/etc/resin" -o -d "/usr/local/share/resin" ]
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
70a0fa770eb06713d8ebf91093102044bc5799e0Lubos Kosco FatalError "Missing Specified Glassfish Domain " \
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco firstDomain=`ls -1 ${domainDirectory} | head -1`
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco FatalError "Failed to dynamically determine Glassfish Domain from " \
cd348e325366620fe047edcc849e3c9424828599Peter Bray echo "${domainDirectory}/${firstDomain}/autodeploy"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Implementation
cd348e325366620fe047edcc849e3c9424828599Peter Bray# The variable "DO" can usefully be set to "echo" to aid in script debugging
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Setup a standard execution environment (if required)
cd348e325366620fe047edcc849e3c9424828599Peter Bray cronexec="/pkgs/sbin/CronExecutionEnvironment.sh"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-$cronexec}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Load custom configuration and then fill remaining stuff with defaults.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Note: As all functions have been defined by the time this routine
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco # is called, your configuration can, if desired, override functions
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # in addition to setting the variables mentioned in the function
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # DefaultInstanceConfiguration(), this maybe useful to override
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # functionality used to determine the default deployment environment
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # find dependencies or validate the configuration, for example.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Load the Local OpenGrok Configuration Environment
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress "Loading the default instance configuration ..."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Missing Dependent Application - Exuberant CTags"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco if [ "`uname -s`" = "SunOS" -a -d /opt/SUNWjavadb -a -d /usr/opengrok ];
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco ! -r "/var/tomcat8/webapps/source/WEB-INF/lib/derbyclient.jar" ];
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco FatalError "JavaDB on but no derbyclient.jar under" \
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco if [ ! -r "/usr/opengrok/lib/derbyclient.jar" ]; then
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco FatalError "JavaDB on but no derbyclient.jar under" \
cd348e325366620fe047edcc849e3c9424828599Peter Bray Warning "CHECK: derbyclient.jar needs to be in where the rest of " \
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco "opengrok used jars are and in unpacked source.war in " \
cd348e325366620fe047edcc849e3c9424828599Peter Bray Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist"
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco Progress " Attempting to create generated data directory ... "
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco FatalError "OpenGrok data path ${DATA_ROOT} doesn't exist"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco Warning "OpenGrok generated etc path ${OPENGROK_INSTANCE_BASE}/etc " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress " Attempting to create generated etc directory ... "
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco FatalError "OpenGrok etc path ${OPENGROK_INSTANCE_BASE}/etc " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ]
cd348e325366620fe047edcc849e3c9424828599Peter Bray Progress " Creating default ${LOGGER_CONFIG_PATH} ... "
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray Warning "Can't find distribution logging configuration" \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray "(${LOGGER_CONF_SOURCE}) to install as default" \
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco fullpath="${OPENGROK_INSTANCE_BASE}/log/opengrok%g.%u.log"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco ${DO} grep -v java.util.logging.FileHandler.pattern \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray ${DO} grep java.util.logging.FileHandler.pattern \
cd348e325366620fe047edcc849e3c9424828599Peter Bray sed "s|$filename|$fullpath|g" >> "${LOGGER_CONFIG_PATH}"
${DO} mkdir -p ${OPENGROK_INSTANCE_BASE}/derby
${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
${JAVA_DEBUG} \
${LOGGER_PROPERTIES} \
${IGNORE_PATTERNS} \
${DERBY_OPTIONS} \
${HISTORY_TAGS} \
${GENERATE_HISTORY} \
${SCAN_DEPTH} \
${PROGRESS} \
${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
${CTAGS_OPTIONS_FILE:+-o} ${CTAGS_OPTIONS_FILE} \
${OPENGROK_FLUSH_RAM_BUFFER_SIZE} ${SKIN} ${LEADING_WILDCARD} \
${READ_XML_CONF} \
-W ${XML_CONFIGURATION} \
${SCAN_FOR_REPOSITORY} \
${ENABLE_PROJECTS} \
${WEBAPP_CONFIG} \
${WEBAPP_CONTEXT} \
if [ "${OPENGROK_INSTANCE_BASE}" != '/var/opengrok' ] || [ "${WEBAPP_CONFIG_ADDRESS}" != 'localhost:2424' ]
sed -i -e 's:/var/opengrok/etc/configuration.xml:'"$XML_CONFIGURATION"':g' "${warTarget}/WEB-INF/web.xml"
SunOS:5.11)
SunOS:5.12)
mkdir -p $DATA_ROOT/derby
Linux:*)
mkdir -p $DATA_ROOT/derby