OpenGrok revision f9e7e93ed37cbcb0a111b6f997bb75d567c31c0b
4910N/A# OpenGrok Wrapper (initial setup and cron job updating) 4910N/A# Supported Operating Systems: 4910N/A# Supported Deployment Engines: 4910N/A# Supported Environment Variables: 4910N/A# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*) 4910N/A# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script) 4910N/A# - OPENGROK_CONFIGURATION User Configuration (Shell Script) 4910N/A# Supported Environment Variables for configuring the default setup: 4910N/A# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution 4910N/A# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area 4910N/A# - EXUBERANT_CTAGS Full Path to Exuberant CTags 4910N/A# - OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line 4910N/A# options for CTags program (for its --options 4910N/A# - JAVA_HOME Full Path to Java Installation Root 4910N/A# - JAVA Full Path to java binary (to enable 64bit JDK) 4910N/A# - JAVA_OPTS Java options (e.g. for JVM memory increase 4910N/A# JAVA_OPTS=-Xmx2048m is the default! 4910N/A# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish") 4910N/A# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory 4910N/A# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory 4910N/A# - OPENGROK_WAR_TARGET Fallback WAR Target Directory 4910N/A# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps) 4910N/A# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish 4910N/A# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name 4910N/A# - OPENGROK_PROGRESS Shows progress in %(percentage) of working 4910N/A# through project, it's good to have Verbose 4910N/A# Mode enabled too, cost of this is one more 4910N/A# traversal of the project before indexing it(*) 4910N/A# - OPENGROK_REMOTE_REPOS Influence history cache generation for remote 4910N/A# repositories. Following values are recognized: 4910N/A# off - disabled for indexing and UI 4910N/A# dirbased - indexing enabled only for repos 4910N/A# which can fetch history for 4910N/A# uionly - enabled for UI only 4910N/A# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*) 4910N/A# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go 4910N/A# (by default 3 directories from SRC_ROOT) 4910N/A# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to 4910N/A# (use "none" to avoid sending it to web app) 4910N/A# - OPENGROK_WEBAPP_CONTEXT Context URL of the OpenGrok webapp 4910N/A# - OPENGROK_WPREFIX Disable wildcard prefix search query 4910N/A# - OPENGROK_DERBY if set, then indexer tries to use derby as 4910N/A# historycache (see derby command of this 4910N/A# - OPENGROK_DERBY_URL Use specific URL to JavaDB, e.g. 4910N/A# "jdbc:derby://localhost:1528/cachedb;create=true" 4910N/A# - OPENGROK_TAG Enable parsing of revision tags into the History 4910N/A# - READ_XML_CONFIGURATION file with read only configuration 4910N/A# - temporary workaround for bug # 327 4910N/A# - OPENGROK_FLUSH_RAM_BUFFER_SIZE="-m 16" - set RAM buffer size for flushing, 4910N/A# default is 16MB per thread, you might try to 4910N/A# increase it to 256MB, but do increase JVM to 4910N/A# 4/8/16GB ! Lucene defaults to 8 threads. 4910N/A# Increase JVM memory as noted using JAVA_OPTS 4910N/A# (*) Any Non-Empty String will enable these options 4910N/A# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. 4910N/A# Print usage to stdout and exit. 4910N/A echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>" 4910N/A echo " ${progname} index [<directory>]" 4910N/A echo " ${progname} clearHistory [<repository_name>]" 4910N/A echo " Optional environment variables:" 4910N/A echo " OPENGROK_CONFIGURATION - location of your configuration" 4910N/A echo " See the code for more information on configuration options /" \ 4910N/A echo "Cannot determine operating system version" 4910N/A# TODO: Handle symlinks correctly (especially in ${0}) 4910N/A# Default Instance Configuration 4910N/A # Use the built-in defaults. This section can be copied to its own 4910N/A # file and tailored to your local requirements. Then simply set 4910N/A # this wrapper. It will save you hand editing in your settings 4910N/A # on each new release. A sample cron(1M) entry might look like: 4910N/A # Note: It is not really possible to ever provided defaults for 4910N/A # these values which will run in every UNIX-like environment. 4910N/A # So I have provided a set which are functional for a given 4910N/A # environment on which you can based you own configuration. 4910N/A # This has been updated to support more environment variables and 4910N/A # operating systems, if you have any reasonably generic 4910N/A # improvements please feel free to submit a patch. 4910N/A if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ] 4910N/A if [ -d "${SCRIPT_DIRECTORY}/dist" -a \ 4910N/A # Handle Developer Build Environments 4910N/A # Handle Binary Distributions 4910N/A # (your source code or the root of all repositories) 4910N/A # REQUIRED: OpenGrok Generate Data Root 4910N/A # (for Lucene index and hypertext cross-references) 4910N/A # This area is rebuilt by "update" / "updateQuietly" 4910N/A # OPTIONAL: User Provided Source Path to Description Mapping 4910N/A # (The user maintained source of the generated EftarFile file) 4910N/A # REQUIRED: XML Configuration 4910N/A # OPTIONAL: read only XML config, if it exists, it will be read 4910N/A if [ -f "${READ_XML_CONFIGURATION}" ] ; then 4910N/A # REQUIRED: Logger Configuration 4910N/A # REQUIRED: Java Archive of OpenGrok (Installation Location) 4910N/A # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location) 4910N/A # (user building from source code will find this and other key 4910N/A # files in the "dist" directory after the build is completed) 4910N/A # OPTIONAL: supply extra command line options to CTags program 4910N/A if [ -n "${OPENGROK_CTAGS_OPTIONS_FILE}" ]; then 4910N/A # REQUIRED: Java Virtual Machine 4910N/A # DEVELOPMENT: Debug option, if enabled current indexer will listen on the 4910N/A # port 8010 until a debugger connects 4910N/A #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket" 4910N/A #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y" 4910N/A # OPTIONAL: Ignore these patterns as names of files or directories 4910N/A #IGNORE_PATTERNS="-i dummy" 4910N/A # To ignore skipping just the history cache creation for a particular 4910N/A # directory and all of it's subdirectories, touch an empty 4910N/A # .opengrok_skip_history file at the root of that directory 4910N/A # OPTIONAL: Enable Projects 4910N/A # (Every directory in SRC_ROOT is considered a separate project) 4910N/A # OPTIONAL: Scanning Options (for Mercurial repositories) 4910N/A if [ -n "${OPENGROK_SCAN_REPOS}" ] 4910N/A # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default] 4910N/A if [ -n "${OPENGROK_REMOTE_REPOS}" ] 4910N/A # OPTIONAL: override depth of scanning for repositories 4910N/A if [ -n "${OPENGROK_SCAN_DEPTH}" ] 4910N/A # OPTIONAL: Allow Leading Wildcard Searches 4910N/A if [ -n "${OPENGROK_WPREFIX}" ] 4910N/A # OPTIONAL: Web Site Look & Feel 4910N/A # (Options: default, offwhite and polished. 4910N/A # Note the quoting requirements) 4910N/A # OPTIONAL: Configuration Address (host:port) 4910N/A if [ -n "${OPENGROK_WEBAPP_CFGADDR}" ]; then 4910N/A if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then 4910N/A if [ -n "${WEBAPP_CONFIG_ADDRESS}" ]; then 4910N/A # OPTIONAL: Context URL of the OpenGrok webapp 4910N/A if [ -n "${OPENGROK_WEBAPP_CONTEXT}" ]; then 4910N/A # OPTIONAL: Full Path to History Utilities 4910N/A # OPTIONAL: Override Built-in Properties 4910N/A # Assumption: We should not set properties to the empty string 4910N/A # OPTIONAL: Store The History Cache in Java DB (derby), 4910N/A # instead of file system (in gzipped xml files). 4910N/A # - Running Derby Server - Defaults to localhost:1527 4910N/A if [ -n "${OPENGROK_DERBY}" ] 4910N/A if [ -n "${OPENGROK_DERBY_URL}" ]; then 4910N/A # OPTIONAL: Show revision tags in History view. 4910N/A # Turn this off if you want to increase indexing performance a bit 4910N/A if [ -n "${OPENGROK_TAG}" ] 4910N/A # DELIVERED: An update program for EftarFile 4910N/A # Usage: <class> inputFile [inputFile ...] outputFile 4910N/A # EftarFile == An Extremely Fast Tagged Attribute Read-only File System 4910N/A # HARDCODED: Generated EftarFile (See web/*.jsp) 4910N/A # Be Quiet? (set indirectly by command line arguments in the main program) 4910N/A # or alternatively, Be Verbose! 4910N/A if [ -n "${OPENGROK_VERBOSE}" ] 4910N/A if [ -n "${OPENGROK_PROGRESS}" ] 4910N/A# Helper Functions - Logging 4910N/A# In general, non-interactive use like cron jobs and automated 4910N/A# installation environments should not generate unnecessary 4910N/A# progress information or warnings, as usage and configuration 4910N/A# will have generally been debugged prior to automation. 4910N/A if [ -z "${OPENGROK_NON_INTERACTIVE}" ] 4910N/A if [ -z "${OPENGROK_NON_INTERACTIVE}" ] 4910N/A echo "FATAL ERROR: ${@} - Aborting!" 4910N/A# Helper Functions - Autodetection of Runtime Environment 4910N/A # Search for Exuberant ctags intelligently, skipping 4910N/A # over other ctags implementations. 4910N/A # Verify that this really is Exuberant Ctags. 4910N/A Error "Unable to determine Exuberant CTags command name" \ 4910N/A "for ${OS_NAME} ${OS_VERSION}" 4910N/A "for ${OS_NAME} ${OS_VERSION}" 4910N/A # Use this function to determine which environment the deploy the 4910N/A # web application function into. Some users (especially 4910N/A # developers) will have many deployment environments or will wish 4910N/A # to specify directly the application server to deploy to. 4910N/A # Either use the environment variable OPENGROK_APP_SERVER or 4910N/A # reimplement this function in your configuration file (as 4910N/A # specified by OPENGROK_CONFIGURATION) 4910N/A if [ -n "${OPENGROK_APP_SERVER}" ] 4910N/A echo "${OPENGROK_APP_SERVER}" 4910N/A # This implementation favours Tomcat, but needs a lot of work, 4910N/A # especially if Glassfish is perferrerd or it is under the control 4910N/A # of SMF (Service Management Facility) 4910N/A # Maybe a better implementation would be to call Application 4910N/A # Server specific WAR Directory and see if they exist. 4910N/A if [ -n "${OPENGROK_WAR_TARGET_TOMCAT}" ] 4910N/A echo "${OPENGROK_WAR_TARGET_TOMCAT}" 4910N/A elif [ -n "${OPENGROK_WAR_TARGET}" ] 4910N/A echo "${OPENGROK_WAR_TARGET}" 4910N/A if [ -d "${prefix}/webapps" ] 4910N/A if [ -n "${OPENGROK_WAR_TARGET_GLASSFISH}" ] 4910N/A echo "${OPENGROK_WAR_TARGET_GLASSFISH}" 4910N/A elif [ -n "${OPENGROK_WAR_TARGET}" ] 4910N/A echo "${OPENGROK_WAR_TARGET}" 4910N/A if [ -d "${prefix}/domains" ] 4910N/A if [ -z "${domainDirectory}" ] 4910N/A if [ -z "${domainDirectory}" ] 4910N/A if [ -n "${OPENGROK_GLASSFISH_DOMAIN}" ] 4910N/A "${OPENGROK_GLASSFISH_DOMAIN}" 4910N/A # Arbitrary Domain Selection 4910N/A echo "${domainDirectory}/${firstDomain}/autodeploy" 4910N/A# The variable "DO" can usefully be set to "echo" to aid in script debugging 4910N/A # Setup a standard execution environment (if required) 4910N/A if [ -f "${OPENGROK_STANDARD_ENV}" ] 4910N/A . "${OPENGROK_STANDARD_ENV}" 4910N/A# Load custom configuration and then fill remaining stuff with defaults. 4910N/A # Note: As all functions have been defined by the time this routine 4910N/A # is called, your configuration can, if desired, override functions 4910N/A # in addition to setting the variables mentioned in the function 4910N/A # DefaultInstanceConfiguration(), this maybe useful to override 4910N/A # functionality used to determine the default deployment environment 4910N/A # find dependencies or validate the configuration, for example. 4910N/A if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ] 4910N/A # Load the Local OpenGrok Configuration Environment 4910N/A . "${OPENGROK_CONFIGURATION}" 4910N/A if [ ! -x "${EXUBERANT_CTAGS}" ] 4910N/A if [ -n "${QUIET}" -a -n "${VERBOSE}" ] 4910N/A Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose" 4910N/A if [ -n "${OPENGROK_DERBY}" ] 4910N/A Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist" 4910N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ] 4910N/A Warning "OpenGrok generated etc path ${OPENGROK_INSTANCE_BASE}/etc " \ 4910N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ] 4910N/A if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ] 4910N/A if [ ! -f "${LOGGER_CONF_SOURCE}" ] 4910N/A "(${LOGGER_CONF_SOURCE}) to install as default" \ 4910N/A "logging configuration (${LOGGER_CONFIG_PATH})" 4910N/A "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}" 4910N/A "${LOGGER_CONF_SOURCE}" | \ 4910N/A if [ -n "${OPENGROK_DERBY}" ] 4910N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/derby" ] 4910N/A "${OPENGROK_INSTANCE_BASE}/derby doesn't exist" 4910N/A # OPTIONAL : Update the EftarFile data 4910N/A if [ -n "${PATH_DESC}" -a -s "${PATH_DESC}" ] 4910N/A if [ ! -f "${OPENGROK_DIST_WAR}" ] 4910N/A ${DO} cp -p "${OPENGROK_DIST_WAR}" "${warTarget}/" 4910N/A Progress "Start your application server (${applicationServer}), " \ 4910N/A Progress "running, or wait until it loads the just installed web " \ 4910N/A Progress " where HOST and PORT are configured in ${applicationServer}." 4910N/A echo "Below might need your socket permission setup" 4910N/A echo "see JDK1.7_51 release notes" 4910N/A# Clear history index for given project.