OpenGrok revision 0b2998be561e7bf5e3479d686a5af36f712b0d9a
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# OpenGrok Wrapper (initial setup and cron job updating)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Supported Operating Systems:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Solaris 10 (SunOS 5.10)
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - Solaris 11 (SunOS 5.11)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Debian (Linux)
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# Supported Deployment Engines:
2b024356b830395446c55f50f9f724a63612e578Lubos Kosco# - Tomcat 5.5
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# - Glassfish
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)
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)
6ce0623fa4ef95af9d77700a1c9c19ec1a919326Guillaume Smet# - OPENGROK_WPREFIX Disable wildcard prefix search query
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - OPENGROK_DERBY if set, then indexer tries to use derby as
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# historycache (see derby command of this
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - READ_XML_CONFIGURATION file with read only configuration
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# - temporary workaround for bug # 327
83439b4ed8fe40097dc3f2c05168d26bd7926159Vladimir Kotal# (*) Any Non-Empty String will enable these options
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray# Print usage to stderr and exit.
cd348e325366620fe047edcc849e3c9424828599Peter Bray echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>"
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal echo " OPENGROK_CONFIGURATION - location of your configuration"
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco echo " See the code for more information on configuration options /" \
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye# Runtime Configuration
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal# TODO: Handle symlinks correctly (especially in ${0})
2cf31ec93bd5d8a2efeab511ce051da51e69aedaLubos Kosco# Default Instance Configuration
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter 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
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
d2a02e104622a26dd90fa88f4f17188f2039809fPeter 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:
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Note: It is not really possible to ever provided defaults for
d2a02e104622a26dd90fa88f4f17188f2039809fPeter 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
cd348e325366620fe047edcc849e3c9424828599Peter 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"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
5e6c91d7e77062129cd0b6ac8aaa546dff216419Lubos Kosco # (your source code or the root of all repositories)
cd348e325366620fe047edcc849e3c9424828599Peter Bray # (for Lucene index and hypertext cross-references)
cd348e325366620fe047edcc849e3c9424828599Peter Bray # 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"
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
cd348e325366620fe047edcc849e3c9424828599Peter Bray # OPTIONAL: read only XML config, if it exists, it will be read
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco # REQUIRED: Java Archive of OpenGrok (Installation Location)
c842732324ee4c74ede17887ad1f0dcdc4364a2cLubos Kosco OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # (user building from source code will find this and other key
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # files in the "dist" directory after the build is completed)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco # REQUIRED: Exuberant CTags (http://ctags.sf.net)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: supply extra command line options to CTags program
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray CTAGS_OPTIONS_FILE="${OPENGROK_CTAGS_OPTIONS_FILE}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray elif [ -r "${OPENGROK_INSTANCE_BASE}/etc/ctags.config" ]; then
cd348e325366620fe047edcc849e3c9424828599Peter Bray CTAGS_OPTIONS_FILE="${OPENGROK_INSTANCE_BASE}/etc/ctags.config"
cd348e325366620fe047edcc849e3c9424828599Peter Bray # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
cd348e325366620fe047edcc849e3c9424828599Peter Bray #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: Ignore these patterns as names of files or directories
4f3c0816485669143aa54f1c6461fcb47cf5bc5cVladimir Kotal # (Every directory in SRC_ROOT is considered a separate project)
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Scanning Options (for Mercurial repositories)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default]
b17cb0705d90907337b3528aa7b8ed1700806f26Vladimir Kotal # OPTIONAL: override depth of scanning for repositories
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # Note, that you might run out of memory, then either increase JVM memory
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # indexing the rest of the file, once the limit is reached)
e87f836e908f8279021f79c8f7bcef98e99d126eLubos Kosco WEBAPP_CONFIG_ADDRESS=${OPENGROK_WEBAPP_CFGADDR}
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then
cd71fb134e037849c77364b50940b1870c4684ceVladimir Kotal # 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} \
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} \
cd348e325366620fe047edcc849e3c9424828599Peter 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
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Usage: <class> inputFile [inputFile ...] outputFile
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # Be Quiet? (set indirectly by command line arguments in the main program)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# Helper Functions - Logging
cd348e325366620fe047edcc849e3c9424828599Peter Bray# In general, non-interactive use like cron jobs and automated
cd348e325366620fe047edcc849e3c9424828599Peter Bray# installation environments should not generate unnecessary
cd348e325366620fe047edcc849e3c9424828599Peter Bray# progress information or warnings, as usage and configuration
cd348e325366620fe047edcc849e3c9424828599Peter Bray# will have generally been debugged prior to automation.
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# Helper Functions - Autodetection of Runtime Environment
c83dfde6b364917fa8ed28142d509a7c29a4da68Vladimir Kotal file=`which "$f" 2>/dev/null | grep -v '^no '`
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray binary=`LocateBinary ctags-exuberant exctags ctags`
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if test $? -eq 1
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Error "Unable to determine Exuberant CTags command name" \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye $binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye if test $? -ne 0
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye Error "Unable to determine Exuberant CTags command name" \
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye "for ${OS_NAME} ${OS_VERSION}\n(${binary} is not Exuberant CTags)"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray SunOS:5.10) javaHome="/usr/jdk/instances/jdk1.6.0" ;;
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray javaHome=`ls -l /etc/alternatives/java | cut -f 2 -d \> `
d0767114e1a949e4a42358f5aeaa08590b87cd80Trond Norbye if [ -f ${dir}/bin/java ]
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 directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Missing Specified Glassfish Domain " \
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal FatalError "Failed to dynamically determine Glassfish Domain from " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "${domainDirectory}/${firstDomain}/autodeploy"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Implementation
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# The variable "DO" can usefully be set to "echo" to aid in script debugging
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Setup a standard execution environment (if required)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray cronexec="/pkgs/sbin/CronExecutionEnvironment.sh"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-$cronexec}"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Load custom configuration and then fill remaining stuff with defaults.
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Note: As all functions have been defined by the time this routine
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.
578be34fc3aceb9831553e8611f8d5d59b711c3cVladimir Kotal if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
578be34fc3aceb9831553e8611f8d5d59b711c3cVladimir Kotal # Load the Local OpenGrok Configuration Environment
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress "Loading the default instance configuration ..."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray FatalError "Missing Dependent Application - Exuberant CTags"
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Warning "CHECK: derbyclient.jar needs to be in where the rest of " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray "opengrok used jars are and in unpacked source.war in WEB-INF/lib !"
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist"
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco Progress " Attempting to create generated data directory ... "
83439b4ed8fe40097dc3f2c05168d26bd7926159Vladimir Kotal FatalError "OpenGrok data path ${DATA_ROOT} doesn't exist"
83439b4ed8fe40097dc3f2c05168d26bd7926159Vladimir Kotal Warning "OpenGrok generated etc path ${OPENGROK_INSTANCE_BASE}/etc " \
83439b4ed8fe40097dc3f2c05168d26bd7926159Vladimir Kotal Progress " Attempting to create generated etc directory ... "
83439b4ed8fe40097dc3f2c05168d26bd7926159Vladimir Kotal ${DO} mkdir -p "${OPENGROK_INSTANCE_BASE}/etc"
83439b4ed8fe40097dc3f2c05168d26bd7926159Vladimir Kotal FatalError "OpenGrok etc path ${OPENGROK_INSTANCE_BASE}/etc " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress " Creating default ${LOGGER_CONFIG_PATH} ... "
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Warning "Can't find distribution logging configuration" \
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco "(${LOGGER_CONF_SOURCE}) to install as default" \
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco fullpath="${OPENGROK_INSTANCE_BASE}/log/opengrok%g.%u.log"
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco ${DO} grep -v java.util.logging.FileHandler.pattern \
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Kosco "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco ${DO} grep java.util.logging.FileHandler.pattern \
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco sed "s|$filename|$fullpath|g" >> "${LOGGER_CONFIG_PATH}"
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal if [ ! -d "${OPENGROK_INSTANCE_BASE}/derby" ]
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco Progress " Attempting to create generated derby directory ... "
0b2998be561e7bf5e3479d686a5af36f712b0d9aVladimir Kotal ${SCAN_FOR_REPOSITORY} ${REMOTE_REPOSITORIES} \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ${CTAGS_OPTIONS_FILE:+-o} ${CTAGS_OPTIONS_FILE} \
5762c9f28c2246777be0e9d49cb29d9c0f49146dLubos Kosco ${MAX_INDEXED_WORDS} ${SKIN} ${LEADING_WILDCARD} \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${DO} ${JAVA} ${JAVA_OPTS} -jar ${OPENGROK_JAR} '-?'
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal applicationServer="`FindApplicationServerType`"
cd348e325366620fe047edcc849e3c9424828599Peter Bray Tomcat) warTarget="`DetermineWarDirectoryTomcat`" ;;
cd348e325366620fe047edcc849e3c9424828599Peter Bray Glassfish) warTarget="`DetermineWarDirectoryGlassfish`" ;;
cd348e325366620fe047edcc849e3c9424828599Peter Bray *) FatalError "Unsupported Application Server ${applicationServer}" ;;
cd348e325366620fe047edcc849e3c9424828599Peter Bray FatalError "Unable to determine Deployment Directory for " \
cd348e325366620fe047edcc849e3c9424828599Peter Bray FatalError "Missing Web Application Archive ${OPENGROK_DIST_WAR}"
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray FatalError "Missing Deployment Directory ${warTarget}"
cd348e325366620fe047edcc849e3c9424828599Peter Bray Progress "Installing ${OPENGROK_DIST_WAR} to ${warTarget} ..."
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco ${DO} cp -p "${OPENGROK_DIST_WAR}" "${warTarget}/"
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco if [ $? != 0 ]
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco FatalError "Web Application Installation FAILED"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress "Start your application server (${applicationServer}), " \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress "running, or wait until it loads the just installed web " \
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco Progress "OpenGrok should be available on <HOST>:<PORT>/source"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray Progress " where HOST and PORT are configured in ${applicationServer}."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray -jar /usr/lib/jvm/java-6-sun/db/lib/derbynet.jar start
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Main Program
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray if [ -n "${2}" ]