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