OpenGrok revision cd71fb134e037849c77364b50940b1870c4684ce
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater# OpenGrok Wrapper (initial setup and cron job updating)
c7fd128f8ea8a527fe27c1b95ab46df7155bc8e4Tinderbox User# Supported Operating Systems:
1f9754245cbd5eec2d2a667bb292f62f72386d4bMark Andrews# - Solaris 10 (SunOS 5.10)
59663800d2ec04777dae2791dd92aa563faf94c8Evan Hunt# - Solaris 11 (SunOS 5.11)
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# - Debian (Linux)
59663800d2ec04777dae2791dd92aa563faf94c8Evan Hunt# Supported Deployment Engines:
0726d872f6f36901ea09321df57084614e5bb6faTinderbox User# - Tomcat 5.5
1ca2cf024391992fe14b2df7d3ae0f575d074452Evan Hunt# - Glassfish
8de3f14f1c300c3e1ed99084cc03485b42c92bf1Tinderbox User# Supported Environment Variables:
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Supported Environment Variables for configuring the default setup:
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
b91d11bfcc30b96f2c80f3a76d12e3dcc8597a68Mark Andrews# - EXUBERANT_CTAGS Full Path to Exuberant CTags
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# - JAVA_HOME Full Path to Java Installation Root
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# - JAVA Full Path to java binary
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# - JAVA_OPTS Java options
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
415d630b6309922caee8469384a6fab75cf05032Mark Andrews# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
415d630b6309922caee8469384a6fab75cf05032Mark Andrews# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews# (contains domains)
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
415d630b6309922caee8469384a6fab75cf05032Mark Andrews# - OPENGROK_PROGRESS Shows progress in %(percentage) of working
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# through project, it's good to have Verbose
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews# Mode enabled too, cost of this is one more
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User# traversal of the project before indexing it(*)
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# - OPENGROK_REMOTE_REPOS Disable History Cache for (remote)
415d630b6309922caee8469384a6fab75cf05032Mark Andrews# Repositories (*)
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
415d630b6309922caee8469384a6fab75cf05032Mark Andrews# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews# (by default 3 directories from SRC_ROOT)
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# (use "none" to avoid sending it to web app)
015055b6e23f5c08f6a5b34726f90b62597e9e45Tinderbox User# - OPENGROK_WPREFIX Disable wildcard prefix search query
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# support (*)
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt# - OPENGROK_DERBY if set, then indexer tries to use derby as
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# historycache (see derby command of this
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt# - READ_XML_CONFIGURATION file with read only configuration
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# - temporary workaround for bug # 327
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt# (*) Any Non-Empty String will enable these options
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# Print usage to stderr and exit.
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage>"
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews echo " OPENGROK_CONFIGURATION - location of your configuration"
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews echo " See the code for more information on configuration options /" \
fec6e13f2d1e69fe1c2b8fac36f732f124cf5398Mark Andrews# Runtime Configuration
551e6d2414c4f47d58a9bb0b37f206f915a4f5acTinderbox User# TODO: Handle symlinks correctly (especially in ${0})
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox UserSCRIPT_DIRECTORY="`cd ${SCRIPT_DIRECTORY}; pwd`"
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User# Default Instance Configuration
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User # Use the built-in defaults. This section can be copied to its own
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # file and tailored to your local requirements. Then simply set
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson # this wrapper. It will save you hand editing in your settings
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # on each new release. A sample cron(1M) entry might look like:
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # Note: It is not really possible to ever provided defaults for
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # these values which will run in every UNIX-like environment.
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews # So I have provided a set which are functional for a given
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews # environment on which you can based you own configuration.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # This has been updated to support more environment variables and
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # operating systems, if you have any reasonably generic
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson # improvements please feel free to submit a patch.
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ]
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User -f "${SCRIPT_DIRECTORY}/dist/opengrok.jar" -a \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/../lib"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/../doc/"
fec6e13f2d1e69fe1c2b8fac36f732f124cf5398Mark Andrews LOGGER_CONF_SOURCE="${LOGGER_CONF_SOURCE}${LOGGER_CONFIG_FILE}"
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # (your source code or the root of all repositories)
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews # (for Lucene index and hypertext cross-references)
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # This area is rebuilt by "update" / "updateQuietly"
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
7f9e2fff07b9c17e0d7a0ea7abc9304ce9d01b61Tinderbox User # (The user maintained source of the generated EftarFile file)
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews PATH_DESC="${OPENGROK_INSTANCE_BASE}/etc/paths.tsv"
549c517e2ecad52bb1d32f08920e29d4e8cda71eTinderbox User # (the configuration used by Web/GUI interfaces)
66317da170ed35b08f5847db2d48b225826327cbTinderbox User XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
fec6e13f2d1e69fe1c2b8fac36f732f124cf5398Mark Andrews # OPTIONAL: read only XML config, if it exists, it will be read
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews READ_XML_CONFIGURATION="${READ_XML_CONFIGURATION:-}"
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # REQUIRED: Java Archive of OpenGrok (Installation Location)
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updater OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User # (user building from source code will find this and other key
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # files in the "dist" directory after the build is completed)
415d630b6309922caee8469384a6fab75cf05032Mark Andrews OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # REQUIRED: Exuberant CTags (http://ctags.sf.net)
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # DEVELOPMENT: Debug option, if enabled current indexer will listen on the
415d630b6309922caee8469384a6fab75cf05032Mark Andrews #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket"
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y"
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # OPTIONAL: Ignore these patterns as names of files or directories
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews # (Every directory in SRC_ROOT is considered a separate project)
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # OPTIONAL: Scanning Options (for Mercurial repositories)
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson # OPTIONAL: Remote Repository Support (CVS or SVN)
415d630b6309922caee8469384a6fab75cf05032Mark Andrews # (Can be very time demanding, uncomment if needed)
e813f036c8251b6d9d2a72fa84f80c2c9d2795afMark Andrews # OPTIONAL: override depth of scanning for repositories
8927a982bde7e4b665966b55f0fa57c5cf21b9d8Mark Andrews # Note, that you might run out of memory, then either increase JVM memory
361967ea970ea8f0ef8875e769505ecdac74bfb0Tinderbox User # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # indexing the rest of the file, once the limit is reached)
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews WEBAPP_CONFIG_ADDRESS=${OPENGROK_WEBAPP_CFGADDR}
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # Assumption: We should not set properties to the empty string
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews${CVS:+-Dorg.opensolaris.opengrok.history.cvs=$CVS} \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews${SVN:+-Dorg.opensolaris.opengrok.history.Subversion=$SVN} \
a2c370ca12bb0360ff7e969474ead3f788c65fffTinderbox User${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews${GIT:+-Dorg.opensolaris.opengrok.history.git=$GIT} \
1f9754245cbd5eec2d2a667bb292f62f72386d4bMark Andrews${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
2ca9cf1582ae972f8edc2b03bd846973b05dee6bTinderbox User # OPTIONAL: Store The History Cache in Java DB (derby),
e1ebc476b08b4a498fcf3477e42c986eb1991360Tinderbox User # instead of file system (in gzipped xml files).
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # - derbyclient.jar - See README.txt for more details
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # - Running Derby Server - Defaults to localhost:1527
076e51f1ff9497ae61a99994189ed8bf5a0d3472Tinderbox User # Usage: <class> inputFile [inputFile ...] outputFile
5affecff6e148a8e124d03f5dbac0da11e30dcc5Tinderbox User # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
5affecff6e148a8e124d03f5dbac0da11e30dcc5Tinderbox User # HARDCODED: Generated EftarFile (See web/*.jsp)
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # Be Quiet? (set indirectly by command line arguments in the main program)
c1e2310a3725eeed45e5e7c86750c64c5a02e993Francis Dupont# Helper Functions - Logging
4b61b671f5de767ec1d1b8e6cf7b849bddf08e98Tinderbox User# In general, non-interactive use like cron jobs and automated
4b61b671f5de767ec1d1b8e6cf7b849bddf08e98Tinderbox User# installation environments should not generate unnecessary
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews# progress information or warnings, as usage and configuration
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont# will have generally been debugged prior to automation.
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# Helper Functions - Autodetection of Runtime Environment
3bd8b5a8fb126e45c67ff53b68183c889cc27918Tinderbox User file=`which "$f" 2>/dev/null | grep -v '^no '`
4840ef4581a577a29a18d180b6bc2e7355378ed7Mark Andrews binary=`LocateBinary ctags-exuberant exctags ctags`
4840ef4581a577a29a18d180b6bc2e7355378ed7Mark Andrews if test $? -eq 1
ab833877278ad5535eef57e4f62291becaea5bc5Mark Andrews Error "Unable to determine Exuberant CTags command name" \
ab833877278ad5535eef57e4f62291becaea5bc5Mark Andrews $binary --version 2>&1 | grep "Exuberant Ctags" > /dev/null
ab833877278ad5535eef57e4f62291becaea5bc5Mark Andrews if test $? -ne 0
ab833877278ad5535eef57e4f62291becaea5bc5Mark Andrews Error "Unable to determine Exuberant CTags command name" \
3bd8b5a8fb126e45c67ff53b68183c889cc27918Tinderbox User "for ${OS_NAME} ${OS_VERSION}\n(${binary} is not Exuberant CTags)"
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews SunOS:5.10) javaHome="/usr/jdk/instances/jdk1.6.0" ;;
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews javaHome=`ls -l /etc/alternatives/java | cut -f 2 -d \> `
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews if [ -f ${dir}/bin/java ]
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # Use this function to determine which environment the deploy the
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # web application function into. Some users (especially
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # developers) will have many deployment environments or will wish
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # to specify directly the application server to deploy to.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # Either use the environment variable OPENGROK_APP_SERVER or
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # reimplement this function in your configuration file (as
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # This implementation favours Tomcat, but needs a lot of work,
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # especially if Glassfish is perferrerd or it is under the control
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # Maybe a better implementation would be to call Application
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # Server specific WAR Directory and see if they exist.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington if [ -x "/etc/init.d/appserv" -a -d "/var/appserver/domains" ]
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy"
415d630b6309922caee8469384a6fab75cf05032Mark Andrews FatalError "Missing Specified Glassfish Domain " \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews firstDomain=`ls -1 ${domainDirectory} | head -1`
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews FatalError "Failed to dynamically determine Glassfish Domain from " \
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington echo "${domainDirectory}/${firstDomain}/autodeploy"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Implementation
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# The variable "DO" can usefully be set to "echo" to aid in script debugging
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington # Setup a standard execution environment (if required)
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington cronexec="/pkgs/sbin/CronExecutionEnvironment.sh"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington OPENGROK_STANDARD_ENV="${OPENGROK_STANDARD_ENV:-$cronexec}"
7adcb4de92bf4383a4c5624c4ed256736d02bc6dMark Andrews Progress "Loading ${OPENGROK_STANDARD_ENV} ..."
415d630b6309922caee8469384a6fab75cf05032Mark Andrews# Load default configuration and then merge with user specified configuration.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # Note: As all functions have been defined by the time this routine
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # is called, your configuration can, if desired, override functions
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # in addition to setting the variables mentioned in the function
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # DefaultInstanceConfiguration(), this maybe useful to override
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # functionality used to determine the default deployment environment
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # find dependencies or validate the configuration, for example.
9218b940febade3085fd6d95a15e67d5f94833f0Tinderbox User Progress "Loading the default instance configuration ..."
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews # Load the Local OpenGrok Configuration Environment
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Progress "Loading ${OPENGROK_CONFIGURATION} ..."
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington FatalError "Missing Dependent Application - Exuberant CTags"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose"
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews Warning "CHECK: derbyclient.jar needs to be in where the rest of " \
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews "opengrok used jars are and in unpacked source.war in WEB-INF/lib !"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington Progress " Attempting to create generated data directory ... "
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews FatalError "OpenGrok data path ${DATA_ROOT} doesn't exist"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Warning "OpenGrok generated etc path ${OPENGROK_INSTANCE_BASE}/etc " \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Progress " Attempting to create generated etc directory ... "
015055b6e23f5c08f6a5b34726f90b62597e9e45Tinderbox User ${DO} mkdir -p "${OPENGROK_INSTANCE_BASE}/etc"
872e1437295dce8162ac7374317d593320ac2dd6Tinderbox User FatalError "OpenGrok etc path ${OPENGROK_INSTANCE_BASE}/etc " \
872e1437295dce8162ac7374317d593320ac2dd6Tinderbox User if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ]
872e1437295dce8162ac7374317d593320ac2dd6Tinderbox User Progress " Creating default ${LOGGER_CONFIG_PATH} ... "
872e1437295dce8162ac7374317d593320ac2dd6Tinderbox User Warning "Can't find distribution logging configuration" \
872e1437295dce8162ac7374317d593320ac2dd6Tinderbox User "(${LOGGER_CONF_SOURCE}) to install as default" \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews "logging configuration (${LOGGER_CONFIG_PATH})"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews fullpath="${OPENGROK_INSTANCE_BASE}/log/opengrok%g.%u.log"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington ${DO} grep -v java.util.logging.FileHandler.pattern \
7adcb4de92bf4383a4c5624c4ed256736d02bc6dMark Andrews "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington ${DO} grep java.util.logging.FileHandler.pattern \
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington sed "s|$filename|$fullpath|g" >> "${LOGGER_CONFIG_PATH}"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington if [ ! -d "${OPENGROK_INSTANCE_BASE}/derby" ]
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington "${OPENGROK_INSTANCE_BASE}/derby doesn't exist"
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington Progress " Attempting to create generated derby directory ... "
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington ${DO} mkdir -p ${OPENGROK_INSTANCE_BASE}/derby
e1ebc476b08b4a498fcf3477e42c986eb1991360Tinderbox User ${SCAN_FOR_REPOSITORY} ${REMOTE_REPOSITORIES} \
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews ${MAX_INDEXED_WORDS} ${SKIN} ${LEADING_WILDCARD} \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews ${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews ${DO} ${JAVA} ${JAVA_OPTS} -jar ${OPENGROK_JAR} '-?'
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews applicationServer="`FindApplicationServerType`"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Tomcat) warTarget="`DetermineWarDirectoryTomcat`" ;;
dda78c0f84895c174ef7206dca6082939c030792Tinderbox User Glassfish) warTarget="`DetermineWarDirectoryGlassfish`" ;;
dde130e859339194eebd7184eaf440981838a7f0Mark Andrews *) FatalError "Unsupported Application Server ${applicationServer}" ;;
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews FatalError "Unable to determine Deployment Directory for " \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews FatalError "Missing Web Application Archive ${OPENGROK_DIST_WAR}"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews FatalError "Missing Deployment Directory ${warTarget}"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Progress "Installing ${OPENGROK_DIST_WAR} to ${warTarget} ..."
6d6ac268afc251ebaaa98f22590334dccbe1f0bcTinderbox User ${DO} cp -p "${OPENGROK_DIST_WAR}" "${warTarget}/"
f4ee48be3994797a8332b86c101db4d7b54799ceTinderbox User if [ $? != 0 ]
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews FatalError "Web Application Installation FAILED"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Progress "Start your application server (${applicationServer}), " \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Progress "running, or wait until it loads the just installed web " \
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Progress "OpenGrok should be available on <HOST>:<PORT>/source"
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews Progress " where HOST and PORT are configured in ${applicationServer}."
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews -jar /usr/lib/jvm/java-6-sun/db/lib/derbynet.jar start
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Main Program
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews if [ -n "${2}" ]