OpenGrok revision 83dcb435c5eeeb8d0d0d906f5d25a1cb1db5c40b
cd348e325366620fe047edcc849e3c9424828599Peter Bray#!/bin/sh
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# OpenGrok Wrapper (initial setup and cron job updating)
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Supported Operating Systems:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Solaris 10 (SunOS 5.10)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - Solaris 11 (SunOS 5.11)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Debian (Linux)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# Supported Deployment Engines:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Tomcat 6
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco# - Tomcat 5.5
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Glassfish
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# Supported Environment Variables:
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter 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#
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter 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
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal# - OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal# options for CTags program (for its --options
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal# switch), default is DATA_ROOT/etc/ctags.config
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - JAVA_HOME Full Path to Java Installation Root
cd71fb134e037849c77364b50940b1870c4684ceVladimir Kotal# - JAVA Full Path to java binary
cd71fb134e037849c77364b50940b1870c4684ceVladimir Kotal# - JAVA_OPTS Java options
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# (contains domains)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# - 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(*)
b17cb0705d90907337b3528aa7b8ed1700806f26Vladimir Kotal# - OPENGROK_REMOTE_REPOS_OFF Disable History Cache for (remote)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# Repositories (*)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - 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)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_WPREFIX Disable wildcard prefix search query
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# support (*)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_DERBY if set, then indexer tries to use derby as
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# historycache (see derby command of this
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# script)
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina# - OPENGROK_TAG Enable parsing of revision tags into the History
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina# view
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - READ_XML_CONFIGURATION file with read only configuration
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - temporary workaround for bug # 327
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray#
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# Notes:
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# (*) Any Non-Empty String will enable these options
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal#
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal#
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
3b0448fdd830b8d04c6a71511e5d26a4fc3b5b80Lubos Kosco# Print usage to stdout and exit.
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
cd348e325366620fe047edcc849e3c9424828599Peter BrayUsage()
cd348e325366620fe047edcc849e3c9424828599Peter Bray{
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal progname=`basename $0`
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal exec >&2
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo ""
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>"
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo " ${progname} index [<directory>]"
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo ""
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo " Optional environment variables:"
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo " OPENGROK_CONFIGURATION - location of your configuration"
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo ""
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye echo " See the code for more information on configuration options /" \
3b0448fdd830b8d04c6a71511e5d26a4fc3b5b80Lubos Kosco "variables"
3b0448fdd830b8d04c6a71511e5d26a4fc3b5b80Lubos Kosco echo ""
cd348e325366620fe047edcc849e3c9424828599Peter Bray exit 1
cd348e325366620fe047edcc849e3c9424828599Peter Bray}
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Runtime Configuration
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Koscoif [ -f "/bin/uname" ]
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Koscothen
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal OS_NAME="`/bin/uname -s`"
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal OS_VERSION="`/bin/uname -r`"
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Koscoelse
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal OS_NAME="`/usr/bin/uname -s`"
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal OS_VERSION="`/usr/bin/uname -r`"
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Koscofi
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray# TODO: Handle symlinks correctly (especially in ${0})
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter BraySCRIPT_DIRECTORY="`dirname ${0}`"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter BraySCRIPT_DIRECTORY="`cd ${SCRIPT_DIRECTORY}; pwd`"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Default Instance Configuration
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayDefaultInstanceConfiguration()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Use the built-in defaults. This section can be copied to its own
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # file and tailored to your local requirements. Then simply set
cd348e325366620fe047edcc849e3c9424828599Peter Bray # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
cd348e325366620fe047edcc849e3c9424828599Peter Bray # this wrapper. It will save you hand editing in your settings
d2a02e104622a26dd90fa88f4f17188f2039809fPeter 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
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter 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
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # This has been updated to support more environment variables and
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # operating systems, if you have any reasonably generic
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # improvements please feel free to submit a patch.
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray LOGGER_CONFIG_FILE="logging.properties"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray if [ -d "${SCRIPT_DIRECTORY}/dist" -a \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray -f "${SCRIPT_DIRECTORY}/dist/opengrok.jar" -a \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray -f "${SCRIPT_DIRECTORY}/dist/source.war" \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Handle Developer Build Environments
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
b34561d2c3d92fac37dbced05ba6a8738e3d20e9Lubos Kosco LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray else
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Handle Binary Distributions
5e6c91d7e77062129cd0b6ac8aaa546dff216419Lubos Kosco OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
cd348e325366620fe047edcc849e3c9424828599Peter Bray fi
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray # REQUIRED: Source Code/Repository Root
cd348e325366620fe047edcc849e3c9424828599Peter Bray # (your source code or the root of all repositories)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray SRC_ROOT="${OPENGROK_INSTANCE_BASE}/src"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray # REQUIRED: OpenGrok Generate Data Root
cd348e325366620fe047edcc849e3c9424828599Peter Bray # (for Lucene index and hypertext cross-references)
cd348e325366620fe047edcc849e3c9424828599Peter Bray # This area is rebuilt by "update" / "updateQuietly"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray DATA_ROOT="${OPENGROK_INSTANCE_BASE}/data"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal # OPTIONAL: User Provided Source Path to Description Mapping
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal # (Tab Separated Value)
cd348e325366620fe047edcc849e3c9424828599Peter Bray # (The user maintained source of the generated EftarFile file)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # REQUIRED: XML Configuration
cd348e325366620fe047edcc849e3c9424828599Peter Bray # (the configuration used by Web/GUI interfaces)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco # OPTIONAL: read only XML config, if it exists, it will be read
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco
d7c1415de39f4b07c85828f49cd1ee7a2a19eb9eLubos Kosco if [ -f "${READ_XML_CONFIGURATION}" ] ; then
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco READ_XML_CONF="-R ${READ_XML_CONFIGURATION}"
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco fi
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # REQUIRED: Logger Configuration
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # REQUIRED: Java Archive of OpenGrok (Installation Location)
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # (user building from source code will find this and other key
cd348e325366620fe047edcc849e3c9424828599Peter Bray # files in the "dist" directory after the build is completed)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray # REQUIRED: Exuberant CTags (http://ctags.sf.net)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal # OPTIONAL: supply extra command line options to CTags program
e9dbb478e3339d96ce4f0af5c6ab7e1d35ebb86dVladimir Kotal if [ -n "${OPENGROK_CTAGS_OPTIONS_FILE}" ]; then
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal CTAGS_OPTIONS_FILE="${OPENGROK_CTAGS_OPTIONS_FILE}"
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal elif [ -r "${OPENGROK_INSTANCE_BASE}/etc/ctags.config" ]; then
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal CTAGS_OPTIONS_FILE="${OPENGROK_INSTANCE_BASE}/etc/ctags.config"
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal fi
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal
cd348e325366620fe047edcc849e3c9424828599Peter Bray # REQUIRED: Java Home
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray JAVA_HOME="${JAVA_HOME:-`FindJavaHome`}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray export JAVA_HOME
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray # REQUIRED: Java Virtual Machine
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray JAVA="${JAVA:-$JAVA_HOME/bin/java}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal # port 8010 until a debugger connects
4f3c0816485669143aa54f1c6461fcb47cf5bc5cVladimir Kotal #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket"
4f3c0816485669143aa54f1c6461fcb47cf5bc5cVladimir Kotal #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Ignore these patterns as names of files or directories
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray #IGNORE_PATTERNS="-i dummy"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Enable Projects
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # (Every directory in SRC_ROOT is considered a separate project)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ENABLE_PROJECTS="-P"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: Scanning Options (for Mercurial repositories)
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco SCAN_FOR_REPOSITORY="-S"
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco if [ -n "${OPENGROK_SCAN_REPOS}" ]
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco then
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco SCAN_FOR_REPOSITORY=""
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco fi
cd348e325366620fe047edcc849e3c9424828599Peter Bray
b17cb0705d90907337b3528aa7b8ed1700806f26Vladimir Kotal # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco REMOTE_REPOSITORIES="-r on"
b17cb0705d90907337b3528aa7b8ed1700806f26Vladimir Kotal if [ -n "${OPENGROK_REMOTE_REPOS_OFF}" ]
8f8c3f4555e5aa3160f03f2e9c55ddbd3381357bLubos Kosco then
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Kosco REMOTE_REPOSITORIES=""
8f8c3f4555e5aa3160f03f2e9c55ddbd3381357bLubos Kosco fi
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco # OPTIONAL: override depth of scanning for repositories
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco if [ -n "${OPENGROK_SCAN_DEPTH}" ]
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco then
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco SCAN_DEPTH="-z${OPENGROK_SCAN_DEPTH}"
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco fi
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Allow Leading Wildcard Searches
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco # (default: on)
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco LEADING_WILDCARD="-a on"
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco if [ -n "${OPENGROK_WPREFIX}" ]
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco then
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco LEADING_WILDCARD=""
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco fi
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Web Site Look & Feel
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # (Options: default, offwhite and polished.
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # Note the quoting requirements)
1a5c2ab40bd94d2b2c63afda767ce7bbf29ecc4bJan Friedel #SKIN='-L default'
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco # OPTIONAL: Set Maximum Indexed Words Per File
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco # Note, that you might run out of memory, then either increase JVM memory
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco # indexing the rest of the file, once the limit is reached)
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco # (default: unlimited)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray #MAX_INDEXED_WORDS="-m 100000"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Configuration Address (host:port)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # (conf/web.xml default is localhost:2424)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal WEBAPP_CONFIG=""
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal if [ -n "${OPENGROK_WEBAPP_CFGADDR}" ]; then
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal WEBAPP_CONFIG_ADDRESS=${OPENGROK_WEBAPP_CFGADDR}
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal WEBAPP_CONFIG_ADDRESS=""
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal fi
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal else
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal WEBAPP_CONFIG_ADDRESS="localhost:2424"
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal fi
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal if [ -n "${WEBAPP_CONFIG_ADDRESS}" ]; then
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal WEBAPP_CONFIG="-U ${WEBAPP_CONFIG_ADDRESS}"
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal fi
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: JVM Options
cd71fb134e037849c77364b50940b1870c4684ceVladimir Kotal JAVA_OPTS="${JAVA_OPTS:--Xmx2048m}"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: Full Path to History Utilities
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray HG="`Which hg`"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray CVS="`Which cvs`"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray SVN="`Which svn`"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray SCCS="`Which sccs`"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco CLEARCASE="`Which cleartool`"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco GIT="`Which git`"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco P4="`Which p4`"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco MTN="`Which mtn`"
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco BZR="`Which bzr`"
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
cd348e325366620fe047edcc849e3c9424828599Peter Bray # OPTIONAL: Override Built-in Properties
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Assumption: We should not set properties to the empty string
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray PROPERTIES="\
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} \
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Store The History Cache in Java DB (derby),
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # instead of file system (in gzipped xml files).
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye #
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # Requirements:
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # - derbyclient.jar - See README.txt for more details
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # - Running Derby Server - Defaults to localhost:1527
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray #
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco if [ -n "${OPENGROK_DERBY}" ]
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco then
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco DERBY_HISTORY_CACHE="-D"
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco fi
cd348e325366620fe047edcc849e3c9424828599Peter Bray
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina # OPTIONAL: Show revision tags in History view.
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina # Turn this off if you want to increase indexing performance a bit
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina # (default: off)
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina if [ -n "${OPENGROK_TAG}" ]
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina then
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina HISTORY_TAGS="-G"
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina fi
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina
cd348e325366620fe047edcc849e3c9424828599Peter Bray # DELIVERED: An update program for EftarFile
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Usage: <class> inputFile [inputFile ...] outputFile
cd348e325366620fe047edcc849e3c9424828599Peter Bray # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
cd348e325366620fe047edcc849e3c9424828599Peter Bray EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray # HARDCODED: Generated EftarFile (See web/*.jsp)
cd348e325366620fe047edcc849e3c9424828599Peter Bray EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Be Quiet? (set indirectly by command line arguments in the main program)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray #QUIET=""
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray # or alternatively, Be Verbose!
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray #VERBOSE="-v"
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco if [ -n "${OPENGROK_VERBOSE}" ]
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye then
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray VERBOSE="-v"
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray QUIET=""
8f8c3f4555e5aa3160f03f2e9c55ddbd3381357bLubos Kosco fi
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye
3a5046f0538ba9fb3a9429199544a9f4b93d9a4dLubos Kosco if [ -n "${OPENGROK_PROGRESS}" ]
3a5046f0538ba9fb3a9429199544a9f4b93d9a4dLubos Kosco then
3a5046f0538ba9fb3a9429199544a9f4b93d9a4dLubos Kosco PROGRESS="-C"
3a5046f0538ba9fb3a9429199544a9f4b93d9a4dLubos Kosco fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
cd348e325366620fe047edcc849e3c9424828599Peter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Helper Functions - Logging
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
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#
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayProgress()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -z "${OPENGROK_NON_INTERACTIVE}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${@}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayWarning()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -z "${OPENGROK_NON_INTERACTIVE}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "WARNING: ${@}" 1>&2
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayError()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "ERROR: ${@}" 1>&2
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayFatalError()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal exec >&2
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal echo ""
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal echo "FATAL ERROR: ${@} - Aborting!"
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal echo ""
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${DO} exit 2
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Helper Functions - Autodetection of Runtime Environment
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
cd348e325366620fe047edcc849e3c9424828599Peter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayWhich()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray path="`which ${1} 2>/dev/null`"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -x "${path}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${path}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond NorbyeLocateBinary() {
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye for f in $@
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye do
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal file=`which "$f" 2>/dev/null | grep -v '^no '`
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye if test -n "$file" -a -x "$file"
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye then
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye echo $file
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye return 0
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye fi
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye done
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye echo ""
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye return 1
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye}
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayFindExuberantCTags()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye binary=`LocateBinary ctags-exuberant exctags ctags`
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye if test $? -eq 1
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Error "Unable to determine Exuberant CTags command name" \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray "for ${OS_NAME} ${OS_VERSION}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye # Verify that this really is Exuberant Ctags
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye $binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye if test $? -ne 0
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye then
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye Error "Unable to determine Exuberant CTags command name" \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye "for ${OS_NAME} ${OS_VERSION}\n(${binary} is not Exuberant CTags)"
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye return
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye fi
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye echo ${binary}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayFindJavaHome()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye javaHome=""
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray case "${OS_NAME}:${OS_VERSION}" in
a3a5f5c0500064f4c6ac3658b1e3e4d838912329Lubos Kosco SunOS:5.10) javaHome="/usr/jdk/instances/jdk1.7.0" ;;
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray SunOS:5.11) javaHome="/usr/jdk/latest" ;;
83dcb435c5eeeb8d0d0d906f5d25a1cb1db5c40bLubos Kosco SunOS:5.12) javaHome="/usr/jdk/latest" ;;
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye Linux:*)
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye if [ -f /etc/alternatives/java ]
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye then
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye javaHome=`ls -l /etc/alternatives/java | cut -f 2 -d \> `
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye javaHome=`dirname $javaHome`
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye javaHome=`dirname $javaHome`
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye fi
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye ;;
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray esac
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -z "${javaHome}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
a3a5f5c0500064f4c6ac3658b1e3e4d838912329Lubos Kosco Error "Unable to determine Java 7 Home" \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray "for ${OS_NAME} ${OS_VERSION}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ ! -d "${javaHome}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Error "Missing Java Home ${javaHome}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${javaHome}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayFindApplicationServerType()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
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
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Either use the environment variable OPENGROK_APP_SERVER or
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # reimplement this function in your configuration file (as
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # specified by OPENGROK_CONFIGURATION)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${OPENGROK_APP_SERVER}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${OPENGROK_APP_SERVER}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
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 # of SMF (Service Management Facility)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Maybe a better implementation would be to call Application
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Server specific WAR Directory and see if they exist.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
340e2c0d70fade14c720931c87652727b941c167Vladimir Kotal if [ -d "/var/tomcat6/webapps" \
340e2c0d70fade14c720931c87652727b941c167Vladimir Kotal -o -d "/var/lib/tomcat6/webapps" \
83dcb435c5eeeb8d0d0d906f5d25a1cb1db5c40bLubos Kosco -o -d "/var/lib/tomcat7/webapps"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "Tomcat"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -x "/etc/init.d/appserv" -a -d "/var/appserver/domains" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "Glassfish"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Assume Tomcat
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "Tomcat"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayDetermineWarDirectoryTomcat()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${OPENGROK_WAR_TARGET_TOMCAT}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${OPENGROK_WAR_TARGET_TOMCAT}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray elif [ -n "${OPENGROK_WAR_TARGET}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${OPENGROK_WAR_TARGET}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray for prefix in \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${OPENGROK_TOMCAT_BASE} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray /var/tomcat6 \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray /var/lib/tomcat6 \
83dcb435c5eeeb8d0d0d906f5d25a1cb1db5c40bLubos Kosco /var/lib/tomcat7
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray do
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -d "${prefix}/webapps" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${prefix}/webapps"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray done
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayDetermineWarDirectoryGlassfish()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${OPENGROK_WAR_TARGET_GLASSFISH}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${OPENGROK_WAR_TARGET_GLASSFISH}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray elif [ -n "${OPENGROK_WAR_TARGET}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${OPENGROK_WAR_TARGET}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray for prefix in \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${OPENGROK_GLASSFISH_BASE} \
340e2c0d70fade14c720931c87652727b941c167Vladimir Kotal /var/appserver
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray do
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -d "${prefix}/domains" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -z "${domainDirectory}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray domainDirectory="${prefix}/domains"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray done
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -z "${domainDirectory}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # User Specified Domain
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${OPENGROK_GLASSFISH_DOMAIN}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ ! -d "${directory}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal FatalError "Missing Specified Glassfish Domain " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "${OPENGROK_GLASSFISH_DOMAIN}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${directory}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray return
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Arbitrary Domain Selection
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray firstDomain=`ls -1 ${domainDirectory} | head -1`
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -z "${firstDomain}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal FatalError "Failed to dynamically determine Glassfish Domain from " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "${domainDirectory}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${domainDirectory}/${firstDomain}/autodeploy"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Implementation
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
cd348e325366620fe047edcc849e3c9424828599Peter Bray# The variable "DO" can usefully be set to "echo" to aid in script debugging
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayLoadStandardEnvironment()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Setup a standard execution environment (if required)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal cronexec="/pkgs/sbin/CronExecutionEnvironment.sh"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-$cronexec}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -f "${OPENGROK_STANDARD_ENV}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress "Loading ${OPENGROK_STANDARD_ENV} ..."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray . "${OPENGROK_STANDARD_ENV}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
578be34fc3aceb9831553e8611f8d5d59b711c3cVladimir Kotal#
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal# Load custom configuration and then fill remaining stuff with defaults.
578be34fc3aceb9831553e8611f8d5d59b711c3cVladimir Kotal#
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayLoadInstanceConfiguration()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal #
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Note: As all functions have been defined by the time this routine
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # 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.
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal #
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Load the Local OpenGrok Configuration Environment
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress "Loading ${OPENGROK_CONFIGURATION} ..."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray . "${OPENGROK_CONFIGURATION}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal Progress "Loading the default instance configuration ..."
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal DefaultInstanceConfiguration
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayValidateConfiguration()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ ! -x "${EXUBERANT_CTAGS}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Missing Dependent Application - Exuberant CTags"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ ! -d "${SRC_ROOT}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray if [ -n "${QUIET}" -a -n "${VERBOSE}" ]
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray then
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray QUIET=""
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray VERBOSE="-v"
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray fi
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco if [ -n "${OPENGROK_DERBY}" ]
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal Warning "CHECK: derbyclient.jar needs to be in where the rest of " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "opengrok used jars are and in unpacked source.war in WEB-INF/lib !"
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayCreateRuntimeRequirements()
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ ! -d "${DATA_ROOT}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress " Attempting to create generated data directory ... "
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${DO} mkdir -p "${DATA_ROOT}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco if [ ! -d "${DATA_ROOT}" ]
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco then
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco FatalError "OpenGrok data path ${DATA_ROOT} doesn't exist"
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco fi
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ]
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal Warning "OpenGrok generated etc path ${OPENGROK_INSTANCE_BASE}/etc " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "doesn't exist"
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco Progress " Attempting to create generated etc directory ... "
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco ${DO} mkdir -p "${OPENGROK_INSTANCE_BASE}/etc"
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco fi
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ]
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal FatalError "OpenGrok etc path ${OPENGROK_INSTANCE_BASE}/etc " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "doesn't exist"
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco fi
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ]
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco then
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray Progress " Creating default ${LOGGER_CONFIG_PATH} ... "
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray if [ ! -f "${LOGGER_CONF_SOURCE}" ]
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray then
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco Warning "Can't find distribution logging configuration" \
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco "(${LOGGER_CONF_SOURCE}) to install as default" \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray "logging configuration (${LOGGER_CONFIG_PATH})"
70a0fa770eb06713d8ebf91093102044bc5799e0Lubos Kosco else
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal filename="opengrok%g.%u.log"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal fullpath="${OPENGROK_INSTANCE_BASE}/log/opengrok%g.%u.log"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal ${DO} grep -v java.util.logging.FileHandler.pattern \
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal ${DO} grep java.util.logging.FileHandler.pattern \
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal "${LOGGER_CONF_SOURCE}" | \
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal sed "s|$filename|$fullpath|g" >> "${LOGGER_CONFIG_PATH}"
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal if [ ! -d ${OPENGROK_INSTANCE_BASE}/log ]
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal ${DO} mkdir ${OPENGROK_INSTANCE_BASE}/log
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal fi
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray fi
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco fi
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco if [ -n "${OPENGROK_DERBY}" ]
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal if [ ! -d "${OPENGROK_INSTANCE_BASE}/derby" ]
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal Warning "OpenGrok generated derby path " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "${OPENGROK_INSTANCE_BASE}/derby doesn't exist"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal Progress " Attempting to create generated derby directory ... "
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal ${DO} mkdir -p ${OPENGROK_INSTANCE_BASE}/derby
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal fi
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray}
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter BrayStdInvocation()
cd348e325366620fe047edcc849e3c9424828599Peter Bray{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ${LOGGER_PROPERTIES} \
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco ${JAVA_DEBUG} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray -jar ${OPENGROK_JAR} \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ${IGNORE_PATTERNS} ${ENABLE_PROJECTS} \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ${DERBY_HISTORY_CACHE} \
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina ${HISTORY_TAGS} \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ${SCAN_FOR_REPOSITORY} ${REMOTE_REPOSITORIES} \
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco ${SCAN_DEPTH} \
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco ${VERBOSE} ${QUIET} \
3a5046f0538ba9fb3a9429199544a9f4b93d9a4dLubos Kosco ${PROGRESS} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal ${CTAGS_OPTIONS_FILE:+-o} ${CTAGS_OPTIONS_FILE} \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ${MAX_INDEXED_WORDS} ${SKIN} ${LEADING_WILDCARD} \
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco ${READ_XML_CONF} \
8f8c3f4555e5aa3160f03f2e9c55ddbd3381357bLubos Kosco -W ${XML_CONFIGURATION} \
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal ${WEBAPP_CONFIG} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray -s ${SRC_ROOT} -d ${DATA_ROOT} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray "${@}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray}
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter BrayUpdateGeneratedData()
cd348e325366620fe047edcc849e3c9424828599Peter Bray{
cd348e325366620fe047edcc849e3c9424828599Peter Bray StdInvocation -H
cd348e325366620fe047edcc849e3c9424828599Peter Bray}
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter BrayUpdateDescriptionCache()
cd348e325366620fe047edcc849e3c9424828599Peter Bray{
cd348e325366620fe047edcc849e3c9424828599Peter Bray # OPTIONAL : Update the EftarFile data
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco if [ -n "${PATH_DESC}" -a -s "${PATH_DESC}" ]
cd348e325366620fe047edcc849e3c9424828599Peter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${DO} ${JAVA} -classpath ${OPENGROK_JAR} \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
cd348e325366620fe047edcc849e3c9424828599Peter Bray fi
cd348e325366620fe047edcc849e3c9424828599Peter Bray}
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter BrayOpenGrokUsage()
cd348e325366620fe047edcc849e3c9424828599Peter Bray{
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray echo "Options for opengrok.jar:" 1>&2
cd348e325366620fe047edcc849e3c9424828599Peter Bray ${DO} ${JAVA} ${JAVA_OPTS} -jar ${OPENGROK_JAR} '-?'
cd348e325366620fe047edcc849e3c9424828599Peter Bray}
cd348e325366620fe047edcc849e3c9424828599Peter Bray
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos KoscoDeployWar()
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco{
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray applicationServer="`FindApplicationServerType`"
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray case "${applicationServer}" in
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Tomcat) warTarget="`DetermineWarDirectoryTomcat`" ;;
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Glassfish) warTarget="`DetermineWarDirectoryGlassfish`" ;;
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray *) FatalError "Unsupported Application Server ${applicationServer}" ;;
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray esac
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -z "${warTarget}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal FatalError "Unable to determine Deployment Directory for " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "${applicationServer}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ ! -f "${OPENGROK_DIST_WAR}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Missing Web Application Archive ${OPENGROK_DIST_WAR}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ ! -d "${warTarget}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Missing Deployment Directory ${warTarget}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress "Installing ${OPENGROK_DIST_WAR} to ${warTarget} ..."
561ec0545f30e44833b6def5168abbd3ab5cf65aVladimir Kotal ${DO} cp -p "${OPENGROK_DIST_WAR}" "${warTarget}/"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ $? != 0 ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Web Application Installation FAILED"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray fi
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal Progress "Start your application server (${applicationServer}), " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "if it is not already"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal Progress "running, or wait until it loads the just installed web " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal "application."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress "OpenGrok should be available on <HOST>:<PORT>/source"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress " where HOST and PORT are configured in ${applicationServer}."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco}
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos KoscoDerbyServer()
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco{
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco case "${OS_NAME}:${OS_VERSION}" in
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco SunOS:5.10) Error "unsupported OS" ;;
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye SunOS:5.11)
8e4e27126852837892d11016ca62f6b8f51997b8Lubos Kosco /sbin/svcadm enable javadb
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco ;;
4e854c69a0484765dcd27b0e837898c8b6969beaTrond Norbye Linux:*)
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco mkdir -p $DATA_ROOT/derby
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal java -Dderby.system.home=$DATA_ROOT/derby \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal -jar /usr/lib/jvm/java-6-sun/db/lib/derbynet.jar start
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco ;;
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco *) Error "unsupported OS" ;;
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco esac
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco}
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
cd348e325366620fe047edcc849e3c9424828599Peter Bray# Main Program
cd348e325366620fe047edcc849e3c9424828599Peter Bray#
cd348e325366620fe047edcc849e3c9424828599Peter Bray
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Koscoif [ $# -eq 0 -o $# -gt 2 ]
cd348e325366620fe047edcc849e3c9424828599Peter Braythen
cd348e325366620fe047edcc849e3c9424828599Peter Bray Usage
cd348e325366620fe047edcc849e3c9424828599Peter Brayfi
cd348e325366620fe047edcc849e3c9424828599Peter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayLoadStandardEnvironment
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
d2a02e104622a26dd90fa88f4f17188f2039809fPeter BrayLoadInstanceConfiguration
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Braycase "${1}" in
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco deploy)
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco DeployWar
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco ;;
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco derby)
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco ValidateConfiguration
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco CreateRuntimeRequirements
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco DerbyServer
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco ;;
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal
cd348e325366620fe047edcc849e3c9424828599Peter Bray update)
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco ValidateConfiguration
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco CreateRuntimeRequirements
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray UpdateGeneratedData
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray UpdateDescriptionCache
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ;;
cd348e325366620fe047edcc849e3c9424828599Peter Bray
cd348e325366620fe047edcc849e3c9424828599Peter Bray updateQuietly)
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco ValidateConfiguration
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco CreateRuntimeRequirements
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray QUIET="-q"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray VERBOSE=""
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray UpdateGeneratedData
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray UpdateDescriptionCache
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ;;
cd348e325366620fe047edcc849e3c9424828599Peter Bray
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco index)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray if [ -n "${2}" ]
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray then
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray SRC_ROOT="${2}"
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco fi
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco ValidateConfiguration
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco CreateRuntimeRequirements
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco UpdateGeneratedData
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco UpdateDescriptionCache
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ;;
cd348e325366620fe047edcc849e3c9424828599Peter Bray
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco usage|help)
cd348e325366620fe047edcc849e3c9424828599Peter Bray OpenGrokUsage
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco Usage
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ;;
cd348e325366620fe047edcc849e3c9424828599Peter Bray *)
cd348e325366620fe047edcc849e3c9424828599Peter Bray Usage
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ;;
cd348e325366620fe047edcc849e3c9424828599Peter Brayesac