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