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)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - 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
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal# - EXUBERANT_CTAGS Full Path to Exuberant CTags
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal# - OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal# options for CTags program (for its --options
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# switch), default is DATA_ROOT/etc/ctags.config
cd71fb134e037849c77364b50940b1870c4684ceVladimir Kotal# - JAVA_HOME Full Path to Java Installation Root
cd71fb134e037849c77364b50940b1870c4684ceVladimir Kotal# - 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)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# JAVA_OPTS=-Xmx2048m is the default!
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_APP_SERVER Application Server ("Tomcat", "Glassfish" or "Resin")
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_WAR_TARGET_RESIN Resin Specific WAR Target Directory
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# (contains domains)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_RESIN_BASE Base Directory for Resin (contains webapps)
b17cb0705d90907337b3528aa7b8ed1700806f26Vladimir Kotal# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_PROGRESS Shows progress in %(percentage) of working
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# through project, it's good to have Verbose
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# Mode enabled too, cost of this is one more
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# traversal of the project before indexing it(*)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_GENERATE_HISTORY Influence history cache generation
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# Following values are recognized:
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# on - enabled (default)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# off - disabled for indexing and UI
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# dirbased - indexing enabled only for repos
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# which can fetch history for
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# local - for local repos only
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# uionly - enabled for UI only
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# - OPENGROK_ENABLE_PROJECTS Enable projects (set it to true or false)
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# Every directory in SRC_ROOT is
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# considered a separate project
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# (by default 3 directories from SRC_ROOT)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# (use "none" to avoid sending it to web app)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - OPENGROK_WEBAPP_CONTEXT Context URL of the OpenGrok webapp
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal# (by default /source)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - FULL reindex is needed once this is used
cd348e325366620fe047edcc849e3c9424828599Peter Bray# (old already indexed files won't be refreshed)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# - OPENGROK_WPREFIX Disable wildcard prefix search query
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_DERBY if set, then indexer tries to use derby as
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal# historycache (see derby command of this
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# - OPENGROK_DERBY_URL Use specific URL to JavaDB, e.g.
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# "jdbc:derby://localhost:1528/cachedb;create=true"
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# (default port is 1527)
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# - OPENGROK_TAG Enable parsing of revision tags into the History
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# - READ_XML_CONFIGURATION file with read only configuration
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# - temporary workaround for bug # 327
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# - OPENGROK_FLUSH_RAM_BUFFER_SIZE="-m 16" - set RAM buffer size for flushing,
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# default is 16MB per thread, you might try to
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# increase it to 256MB, but do increase JVM to
cd348e325366620fe047edcc849e3c9424828599Peter Bray# 4/8/16GB ! Lucene defaults to 8 threads.
cd348e325366620fe047edcc849e3c9424828599Peter Bray# Increase JVM memory as noted using JAVA_OPTS
cd348e325366620fe047edcc849e3c9424828599Peter 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
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# fetching the history from subversion
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal# (*) Any Non-Empty String will enable these options
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray# Print usage to stdout and exit.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo " ${progname} indexpart <src_root> <directory1> [..]"
cd348e325366620fe047edcc849e3c9424828599Peter Bray echo " ${progname} clearHistory <src_root> <repository_name>"
cd348e325366620fe047edcc849e3c9424828599Peter Bray echo " OPENGROK_CONFIGURATION - location of your configuration"
cd348e325366620fe047edcc849e3c9424828599Peter Bray echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
cd348e325366620fe047edcc849e3c9424828599Peter Bray echo " See the code for more information on configuration options /" \
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# Runtime Configuration
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Koscoif [ -x "/bin/uname" ]; then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Brayelif [ -x "/usr/bin/uname" ]; then
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray echo "Cannot determine operating system version"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray# TODO: Handle symlinks correctly (especially in ${0})
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal# Default Instance Configuration
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Use the built-in defaults. This section can be copied to its own
cd348e325366620fe047edcc849e3c9424828599Peter Bray # file and tailored to your local requirements. Then simply set
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
cd348e325366620fe047edcc849e3c9424828599Peter Bray # this wrapper. It will save you hand editing in your settings
cd348e325366620fe047edcc849e3c9424828599Peter Bray # on each new release. A sample cron(1M) entry might look like:
cd348e325366620fe047edcc849e3c9424828599Peter 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
cd348e325366620fe047edcc849e3c9424828599Peter Bray # these values which will run in every UNIX-like environment.
cd348e325366620fe047edcc849e3c9424828599Peter 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
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # operating systems, if you have any reasonably generic
cd348e325366620fe047edcc849e3c9424828599Peter Bray # improvements please feel free to submit a patch.
cd348e325366620fe047edcc849e3c9424828599Peter Bray OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
cd348e325366620fe047edcc849e3c9424828599Peter Bray LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal # (your source code or the root of all repositories)
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal # (for Lucene index and hypertext cross-references)
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal # This area is rebuilt by "update" / "updateQuietly"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: User Provided Source Path to Description Mapping
cd348e325366620fe047edcc849e3c9424828599Peter Bray # (The user maintained source of the generated EftarFile file)
cd348e325366620fe047edcc849e3c9424828599Peter Bray PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal # (the configuration used by Web/GUI interfaces)
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
4f3c0816485669143aa54f1c6461fcb47cf5bc5cVladimir Kotal # OPTIONAL: read only XML config, if it exists, it will be read
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco if [ -n "${OPENGROK_LOGGER_CONFIG_PATH}" ]; then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ ! -f "${OPENGROK_LOGGER_CONFIG_PATH}" ]; then
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco echo "File ${OPENGROK_LOGGER_CONFIG_PATH} does not exist"
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco LOGGER_CONFIG_PATH=${OPENGROK_LOGGER_CONFIG_PATH}
cd348e325366620fe047edcc849e3c9424828599Peter Bray LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
8f8c3f4555e5aa3160f03f2e9c55ddbd3381357bLubos Kosco # REQUIRED: Java Archive of OpenGrok (Installation Location)
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco # (user building from source code will find this and other key
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco # files in the "dist" directory after the build is completed)
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco # REQUIRED: Exuberant CTags (http://ctags.sf.net)
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco # OPTIONAL: supply extra command line options to CTags program
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco if [ -n "${OPENGROK_CTAGS_OPTIONS_FILE}" ]; then
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco CTAGS_OPTIONS_FILE="${OPENGROK_CTAGS_OPTIONS_FILE}"
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco elif [ -r "${OPENGROK_INSTANCE_BASE}/etc/ctags.config" ]; then
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco CTAGS_OPTIONS_FILE="${OPENGROK_INSTANCE_BASE}/etc/ctags.config"
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Ignore these patterns as names of files or directories
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # To ignore skipping just the history cache creation for a particular
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # directory and all of it's subdirectories, touch an empty
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # .opengrok_skip_history file at the root of that directory
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # (Every directory in SRC_ROOT is considered a separate project)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal OPENGROK_ENABLE_PROJECTS="${OPENGROK_ENABLE_PROJECTS:-true}"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Scanning Options (for Mercurial repositories)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco GENERATE_HISTORY="-r ${OPENGROK_GENERATE_HISTORY}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: override depth of scanning for repositories
cd348e325366620fe047edcc849e3c9424828599Peter Bray if [ "${OPENGROK_WEBAPP_CFGADDR}" = "none" ]; then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Assumption: We should not set properties to the empty string
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray${CVS:+-Dorg.opensolaris.opengrok.history.cvs=$CVS} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray${SVN:+-Dorg.opensolaris.opengrok.history.Subversion=$SVN} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: Store The History Cache in Java DB (derby),
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # - derbyclient.jar - See README.txt for more details
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # - Running Derby Server - Defaults to localhost:1527
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal DERBY_OPTIONS="${DERBY_OPTIONS} -u ${OPENGROK_DERBY_URL}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # 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"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Be Quiet? (set indirectly by command line arguments in the main program)
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye# 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.
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye# 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
340e2c0d70fade14c720931c87652727b941c167Vladimir Kotal 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" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray FatalError "Missing Specified Glassfish Domain " \
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco firstDomain=`ls -1 ${domainDirectory} | head -1`
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Failed to dynamically determine Glassfish Domain from " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${domainDirectory}/${firstDomain}/autodeploy"
70a0fa770eb06713d8ebf91093102044bc5799e0Lubos Kosco# Implementation
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal# The variable "DO" can usefully be set to "echo" to aid in script debugging
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal # Setup a standard execution environment (if required)
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal cronexec="/pkgs/sbin/CronExecutionEnvironment.sh"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-$cronexec}"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal# Load custom configuration and then fill remaining stuff with defaults.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Note: As all functions have been defined by the time this routine
cd348e325366620fe047edcc849e3c9424828599Peter Bray # is called, your configuration can, if desired, override functions
cd348e325366620fe047edcc849e3c9424828599Peter Bray # in addition to setting the variables mentioned in the function
cd348e325366620fe047edcc849e3c9424828599Peter Bray # DefaultInstanceConfiguration(), this maybe useful to override
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # functionality used to determine the default deployment environment
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # find dependencies or validate the configuration, for example.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # Load the Local OpenGrok Configuration Environment
3a5046f0538ba9fb3a9429199544a9f4b93d9a4dLubos Kosco Progress "Loading the default instance configuration ..."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Missing Dependent Application - Exuberant CTags"
cd348e325366620fe047edcc849e3c9424828599Peter Bray FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
cd348e325366620fe047edcc849e3c9424828599Peter Bray Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
cd348e325366620fe047edcc849e3c9424828599Peter Bray if [ "`uname -s`" = "SunOS" -a -d /opt/SUNWjavadb -a -d /usr/opengrok ];
cd348e325366620fe047edcc849e3c9424828599Peter Bray ! -r "/var/tomcat8/webapps/source/WEB-INF/lib/derbyclient.jar" ];
cd348e325366620fe047edcc849e3c9424828599Peter Bray FatalError "JavaDB on but no derbyclient.jar under" \
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco if [ ! -r "/usr/opengrok/lib/derbyclient.jar" ]; then
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco FatalError "JavaDB on but no derbyclient.jar under" \
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco Warning "CHECK: derbyclient.jar needs to be in where the rest of " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray "opengrok used jars are and in unpacked source.war in " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress " Attempting to create generated data directory ... "
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "OpenGrok data path ${DATA_ROOT} doesn't exist"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Warning "OpenGrok generated etc path ${OPENGROK_INSTANCE_BASE}/etc " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress " Attempting to create generated etc directory ... "
561ec0545f30e44833b6def5168abbd3ab5cf65aVladimir Kotal ${DO} mkdir -p "${OPENGROK_INSTANCE_BASE}/etc"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "OpenGrok etc path ${OPENGROK_INSTANCE_BASE}/etc " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ]
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal Progress " Creating default ${LOGGER_CONFIG_PATH} ... "
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Warning "Can't find distribution logging configuration" \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray "(${LOGGER_CONF_SOURCE}) to install as default" \
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco fullpath="${OPENGROK_INSTANCE_BASE}/log/opengrok%g.%u.log"
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco ${DO} grep -v java.util.logging.FileHandler.pattern \
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye ${DO} grep java.util.logging.FileHandler.pattern \
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco sed "s|$filename|$fullpath|g" >> "${LOGGER_CONFIG_PATH}"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco Progress " Attempting to create generated derby directory ... "
cd348e325366620fe047edcc849e3c9424828599Peter Bray ${CTAGS_OPTIONS_FILE:+-o} ${CTAGS_OPTIONS_FILE} \
cd348e325366620fe047edcc849e3c9424828599Peter Bray ${OPENGROK_FLUSH_RAM_BUFFER_SIZE} ${SKIN} ${LEADING_WILDCARD} \
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