OpenGrok revision 70a0fa770eb06713d8ebf91093102044bc5799e0
10139N/A# OpenGrok Wrapper (initial setup and cron job updating) 10139N/A# Supported Environment Variables: 10139N/A# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*) 10139N/A# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script) 10139N/A# - OPENGROK_CONFIGURATION User Configuration (Shell Script) 10139N/A# Supported Environment Variables for configuring the default setup: 10139N/A# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution 10139N/A# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area 10139N/A# - EXUBERANT_CTAGS Full Path to Exuberant CTags 10139N/A# - JAVA_HOME Full Path to Java Installation Root 10139N/A# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish") 10139N/A# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory 10139N/A# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory 10139N/A# - OPENGROK_WAR_TARGET Fallback WAR Target Directory 10139N/A# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps) 10139N/A# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish (contains domains) 10139N/A# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name 10139N/A# - OPENGROK_REMOTE_REPOS Enable History Cache for Remote Repositories (*) 10139N/A# - OPENGROK_SCAN_REPOS Scan for repositories (*)_ 10139N/A# - READ_XML_CONFIGURATION file with read only configuration - a temp workaround for bug # 327 10139N/A# (*) Any Non-Empty String will enable these options 10139N/A echo "Usage: ${0} <deploy|update|updateQuietly|usage>" 1>&2 10139N/A echo " ${0} index [<directory>]" 1>&2 10139N/A echo " Optional environment variables:" 1>&2 10139N/A echo " OPENGROK_CONFIGURATION - location of your configuration" 1>&2 10139N/A echo " See the code for more information on configuration options / variables" 1>&2 10139N/A# TODO: Handle symlinks correctly (especially in ${0}) 10139N/A# Default Instance Configuration 15942N/A # Use the built-in defaults. This section can be copied to its own 15942N/A # file and tailored to your local requirements. Then simply set 11965N/A # this wrapper. It will save you hand editing in your settings 11965N/A # on each new release. A sample cron(1M) entry might look like: 15942N/A # Note: It is not really possible to ever provided defaults for 10139N/A # these values which will run in every UNIX-like environment. 10139N/A # So I have provided a set which are functional for a given 15942N/A # environment on which you can based you own configuration. 10139N/A # This has been updated to support more environment variables and 15942N/A # operating systems, if you have any reasonably generic 15942N/A # improvements please feel free to submit a patch. 15288N/A if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ] 10139N/A if [ -d "${SCRIPT_DIRECTORY}/dist" -a \ 10139N/A # Handle Developer Build Environments 10139N/A # (your source code or the root of all repositories) 10139N/A # REQUIRED: OpenGrok Generate Data Root 10139N/A # (for Lucene index and hypertext cross-references) 15942N/A # This area is rebuilt by "update" / "updateQuietly" 10139N/A # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value) 10139N/A # (The user maintained source of the generated EftarFile file) 15942N/A # OPTIONAL: read only XML config, if it exists, it will be read 10139N/A if [ -f "${READ_XML_CONFIGURATION}" ] ; then 10139N/A # REQUIRED: Logger Configuration 15942N/A # REQUIRED: Java Archive of OpenGrok (Installation Location) 10139N/A # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location) 10139N/A # (user building from source code will find this and other key 10139N/A # files in the "dist" directory after the build is completed) 15942N/A # REQUIRED: Java Virtual Machine 15942N/A # DEVELOPMENT: Debug option, if enabled current indexer will listen on the port 8010 until a debugger connects 15942N/A #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,address=8010,suspend=y" 15942N/A # OPTIONAL: Ignore these patterns as names of files or directories 15942N/A # (Every directory in SRC_ROOT is considered a separate project) 10139N/A # OPTIONAL: Scanning Options (for Mercurial repositories) 15942N/A if [ ! -z "${OPENGROK_REMOTE_REPOS}" ] 15942N/A # OPTIONAL: Remote Repository Support (CVS or SVN) 15942N/A # (Can be very time demanding, uncomment if needed) 15942N/A if [ ! -z "${OPENGROK_REMOTE_REPOS}" ] 15982N/A # OPTIONAL: Allow Leading Wildcard Searches 10139N/A # OPTIONAL: Web Site Look & Feel 10139N/A # (Options: default, offwhite and polished. 10139N/A # Note the quoting requirements) 10139N/A # OPTIONAL: Set Maximum Indexed Words Per File 10139N/A # Note, that you might run out of memory, then either increase JVM memory 10139N/A # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not 10139N/A # indexing the rest of the file, once the limit is reached) 10139N/A # OPTIONAL: Configuration Address (host:port) 10139N/A # OPTIONAL: Full Path to History Utilities 10139N/A # OPTIONAL: Override Built-in Properties 10139N/A # Assumption: We should not set properties to the empty string 10139N/A # OPTIONAL: Store The History Cache in Java DB (derby), 10139N/A # instead of file system (in gzipped xml files). 10139N/A # - Running Derby Server - Defaults to localhost:1527 10139N/A # DELIVERED: An update program for EftarFile 10139N/A # Usage: <class> inputFile [inputFile ...] outputFile 10139N/A # EftarFile == An Extremely Fast Tagged Attribute Read-only File System 10139N/A # HARDCODED: Generated EftarFile (See web/*.jsp) 10139N/A # Be Quiet? (set indirectly by command line arguments in the main program) 10139N/A # or alternatively, Be Verbose! 10139N/A if [ ! -z "${OPENGROK_VERBOSE}" ] 10139N/A# In general, non-interactive use like cron jobs and automated 10139N/A# installation environments should not generate unnecessary 10139N/A# progress information or warnings, as usage and configuration 10139N/A# will have generally been debugged prior to automation. 10139N/A if [ -z "${OPENGROK_NON_INTERACTIVE}" ] 10139N/A if [ -z "${OPENGROK_NON_INTERACTIVE}" ] 10139N/A echo "FATAL ERROR: ${@} - Aborting!" 1>&2 10139N/A# Helper Functions - Autodetection of Runtime Environment 13678N/A Error "Unable to determine Exuberant CTags command name" \ 10139N/A # Use this function to determine which environment the deploy the 10139N/A # web application function into. Some users (especially 10139N/A # developers) will have many deployment environments or will wish 10139N/A # to specify directly the application server to deploy to. 10139N/A # Either use the environment variable OPENGROK_APP_SERVER or 13760N/A # reimplement this function in your configuration file (as 13760N/A # specified by OPENGROK_CONFIGURATION) 10139N/A if [ -n "${OPENGROK_APP_SERVER}" ] 15288N/A # This implementation favours Tomcat, but needs a lot of work, 15288N/A # especially if Glassfish is perferrerd or it is under the control 15288N/A # of SMF (Service Management Facility) 15288N/A # Maybe a better implementation would be to call Application 15288N/A # Server specific WAR Directory and see if they exist. 10139N/A if [ -n "${OPENGROK_WAR_TARGET_TOMCAT}" ] 10139N/A echo "${OPENGROK_WAR_TARGET_TOMCAT}" 10139N/A elif [ -n "${OPENGROK_WAR_TARGET}" ] 10139N/A if [ -n "${OPENGROK_WAR_TARGET_GLASSFISH}" ] 11193N/A echo "${OPENGROK_WAR_TARGET_GLASSFISH}" 10139N/A elif [ -n "${OPENGROK_WAR_TARGET}" ] 10139N/A if [ -n "${OPENGROK_GLASSFISH_DOMAIN}" ] 10139N/A FatalError "Failed to dynamically determine Glassfish Domain from ${domainDirectory}" 10139N/A echo "${domainDirectory}/${firstDomain}/autodeploy" 10139N/A# The variable "DO" can usefully be set to "echo" to aid in script debugging 10139N/A # Setup a standard execution environment (if required) 10139N/A if [ -f "${OPENGROK_STANDARD_ENV}" ] 10139N/A # Note: As all functions have been defined by the time this routine 10139N/A # is called, your configuration can, if desired, override functions 10139N/A # in addition to setting the variables mentioned in the function 10139N/A # DefaultInstanceConfiguration(), this maybe useful to override 10139N/A # functionality used to determine the default deployment environment 10139N/A # find dependencies or validate the configuration, for example. 10139N/A if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ] 10139N/A # Load the Local OpenGrok Configuration Environment 10139N/A if [ ! -x "${EXUBERANT_CTAGS}" ] 10139N/A if [ -n "${QUIET}" -a -n "${VERBOSE}" ] 13688N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ] 10139N/A Warning "OpenGrok Generated Etc Path ${OPENGROK_INSTANCE_BASE}/etc doesn't exist" 12787N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ] 12787N/A if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ] 13285N/A if [ ! -f "${LOGGER_CONF_SOURCE}" ] 12787N/A "(${LOGGER_CONF_SOURCE}) to install as default" \ 12787N/A "logging configuration (${LOGGER_CONFIG_PATH})" 10139N/A # OPTIONAL : Update the EftarFile data 10139N/A if [ -n "${PATH_DESC}" -a -s "${PATH_DESC}" ] 10139N/A if [ ! -f "${OPENGROK_DIST_WAR}" ] 10139N/A Progress "Start your application server (${applicationServer}), if it is not already" 10139N/A Progress "running, or wait until it loads the just installed web application." 10139N/A Progress " where HOST and PORT are configured in ${applicationServer}."