787N/A# OpenGrok Wrapper (initial setup and cron job updating) 789N/A# Supported Operating Systems: 789N/A# - Solaris 10 (SunOS 5.10) 873N/A# Supported Deployment Engines: 873N/A# Supported Environment Variables: 873N/A# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*) 789N/A# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script) 789N/A# - OPENGROK_CONFIGURATION User Configuration (Shell Script) 873N/A# Supported Environment Variables for configuring the default setup: 789N/A# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution 789N/A# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area 789N/A# - EXUBERANT_CTAGS Full Path to Exuberant CTags 1393N/A# - OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line 1393N/A# options for CTags program (for its --options 789N/A# - JAVA_HOME Full Path to Java Installation Root 1342N/A# - JAVA Full Path to java binary 789N/A# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish") 789N/A# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory 789N/A# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory 789N/A# - OPENGROK_WAR_TARGET Fallback WAR Target Directory 789N/A# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps) 1336N/A# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish 789N/A# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name 1336N/A# - OPENGROK_PROGRESS Shows progress in %(percentage) of working 1336N/A# through project, it's good to have Verbose 1336N/A# Mode enabled too, cost of this is one more 1336N/A# traversal of the project before indexing it(*) 1392N/A# - OPENGROK_REMOTE_REPOS_OFF Disable History Cache for (remote) 1336N/A# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*) 1336N/A# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go 1336N/A# (by default 3 directories from SRC_ROOT) 1336N/A# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to 1336N/A# (use "none" to avoid sending it to web app) 1336N/A# - OPENGROK_WPREFIX Disable wildcard prefix search query 1336N/A# - OPENGROK_DERBY if set, then indexer tries to use derby as 1336N/A# historycache (see derby command of this 1336N/A# - READ_XML_CONFIGURATION file with read only configuration 1336N/A# - temporary workaround for bug # 327 873N/A# (*) Any Non-Empty String will enable these options 1336N/A# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 1337N/A# Print usage to stderr and exit. 1431N/A echo "Usage: ${progname} <deploy|derby|update|updateQuietly|usage|help>" 1337N/A echo " ${progname} index [<directory>]" 1337N/A echo " Optional environment variables:" 1337N/A echo " OPENGROK_CONFIGURATION - location of your configuration" 1336N/A echo " See the code for more information on configuration options /" \ 869N/A# TODO: Handle symlinks correctly (especially in ${0}) 789N/A# Default Instance Configuration 294N/A # Use the built-in defaults. This section can be copied to its own 789N/A # file and tailored to your local requirements. Then simply set 294N/A # this wrapper. It will save you hand editing in your settings 789N/A # on each new release. A sample cron(1M) entry might look like: 294N/A # Note: It is not really possible to ever provided defaults for 294N/A # these values which will run in every UNIX-like environment. 294N/A # So I have provided a set which are functional for a given 294N/A # environment on which you can based you own configuration. 789N/A # This has been updated to support more environment variables and 789N/A # operating systems, if you have any reasonably generic 789N/A # improvements please feel free to submit a patch. 789N/A if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ] 869N/A if [ -d "${SCRIPT_DIRECTORY}/dist" -a \ 789N/A # Handle Developer Build Environments 789N/A # Handle Binary Distributions 294N/A # (your source code or the root of all repositories) 294N/A # REQUIRED: OpenGrok Generate Data Root 294N/A # (for Lucene index and hypertext cross-references) 294N/A # This area is rebuilt by "update" / "updateQuietly" 294N/A # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value) 294N/A # (The user maintained source of the generated EftarFile file) 789N/A # REQUIRED: XML Configuration 911N/A # OPTIONAL: read only XML config, if it exists, it will be read 915N/A if [ -f "${READ_XML_CONFIGURATION}" ] ; then 869N/A # REQUIRED: Logger Configuration 789N/A # REQUIRED: Java Archive of OpenGrok (Installation Location) 789N/A # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location) 789N/A # (user building from source code will find this and other key 789N/A # files in the "dist" directory after the build is completed) 1393N/A # OPTIONAL: supply extra command line options to CTags program 294N/A # REQUIRED: Java Virtual Machine 1339N/A # DEVELOPMENT: Debug option, if enabled current indexer will listen on the 1339N/A # port 8010 until a debugger connects 1340N/A #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket" 1340N/A #JAVA_DEBUG="$JAVA_DEBUG,server=y,address=8010,suspend=y" 869N/A # OPTIONAL: Ignore these patterns as names of files or directories 869N/A #IGNORE_PATTERNS="-i dummy" 869N/A # OPTIONAL: Enable Projects 869N/A # (Every directory in SRC_ROOT is considered a separate project) 789N/A # OPTIONAL: Scanning Options (for Mercurial repositories) 1086N/A if [ -n "${OPENGROK_SCAN_REPOS}" ] 1392N/A # OPTIONAL: Disable remote repository support (CVS or SVN) [on by default] 1392N/A if [ -n "${OPENGROK_REMOTE_REPOS_OFF}" ] 994N/A # OPTIONAL: override depth of scanning for repositories 1086N/A if [ -n "${OPENGROK_SCAN_DEPTH}" ] 869N/A # OPTIONAL: Allow Leading Wildcard Searches 1109N/A if [ -n "${OPENGROK_WPREFIX}" ] 869N/A # OPTIONAL: Web Site Look & Feel 869N/A # Note the quoting requirements) 870N/A # OPTIONAL: Set Maximum Indexed Words Per File 870N/A # Note, that you might run out of memory, then either increase JVM memory 870N/A # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not 870N/A # indexing the rest of the file, once the limit is reached) 869N/A #MAX_INDEXED_WORDS="-m 100000" 869N/A # OPTIONAL: Configuration Address (host:port) 1336N/A if [ -n "${OPENGROK_WEBAPP_CFGADDR}" ]; then 1336N/A if [ "${OPENGROK_WEBAPP_CFGADDR}" == "none" ]; then 1336N/A if [ -n "${WEBAPP_CONFIG_ADDRESS}" ]; then 869N/A # OPTIONAL: JVM Options 789N/A # OPTIONAL: Full Path to History Utilities 294N/A # OPTIONAL: Override Built-in Properties 789N/A # Assumption: We should not set properties to the empty string 869N/A # OPTIONAL: Store The History Cache in Java DB (derby), 869N/A # instead of file system (in gzipped xml files). 869N/A # - Running Derby Server - Defaults to localhost:1527 1086N/A if [ -n "${OPENGROK_DERBY}" ] 294N/A # DELIVERED: An update program for EftarFile 294N/A # Usage: <class> inputFile [inputFile ...] outputFile 294N/A # EftarFile == An Extremely Fast Tagged Attribute Read-only File System 294N/A # HARDCODED: Generated EftarFile (See web/*.jsp) 294N/A # Be Quiet? (set indirectly by command line arguments in the main program) 294N/A # or alternatively, Be Verbose! 1086N/A if [ -n "${OPENGROK_VERBOSE}" ] 1114N/A if [ -n "${OPENGROK_PROGRESS}" ] 789N/A# Helper Functions - Logging 789N/A# In general, non-interactive use like cron jobs and automated 789N/A# installation environments should not generate unnecessary 789N/A# progress information or warnings, as usage and configuration 789N/A# will have generally been debugged prior to automation. 789N/A if [ -z "${OPENGROK_NON_INTERACTIVE}" ] 789N/A if [ -z "${OPENGROK_NON_INTERACTIVE}" ] 789N/A echo "WARNING: ${@}" 1>&2 789N/A echo "ERROR: ${@}" 1>&2 1340N/A echo "FATAL ERROR: ${@} - Aborting!" 789N/A# Helper Functions - Autodetection of Runtime Environment 789N/A Error "Unable to determine Exuberant CTags command name" \ 789N/A "for ${OS_NAME} ${OS_VERSION}" 1155N/A # Verify that this really is Exuberant Ctags 1155N/A Error "Unable to determine Exuberant CTags command name" \ 1155N/A "for ${OS_NAME} ${OS_VERSION}\n(${binary} is not Exuberant CTags)" 789N/A case "${OS_NAME}:${OS_VERSION}" in 789N/A if [ -z "${javaHome}" ] 789N/A "for ${OS_NAME} ${OS_VERSION}" 789N/A if [ ! -d "${javaHome}" ] 789N/A # Use this function to determine which environment the deploy the 789N/A # web application function into. Some users (especially 789N/A # developers) will have many deployment environments or will wish 789N/A # to specify directly the application server to deploy to. 789N/A # Either use the environment variable OPENGROK_APP_SERVER or 789N/A # reimplement this function in your configuration file (as 789N/A # specified by OPENGROK_CONFIGURATION) 789N/A if [ -n "${OPENGROK_APP_SERVER}" ] 789N/A echo "${OPENGROK_APP_SERVER}" 789N/A # This implementation favours Tomcat, but needs a lot of work, 789N/A # especially if Glassfish is perferrerd or it is under the control 789N/A # of SMF (Service Management Facility) 789N/A # Maybe a better implementation would be to call Application 789N/A # Server specific WAR Directory and see if they exist. 789N/A if [ -n "${OPENGROK_WAR_TARGET_TOMCAT}" ] 789N/A echo "${OPENGROK_WAR_TARGET_TOMCAT}" 789N/A elif [ -n "${OPENGROK_WAR_TARGET}" ] 789N/A echo "${OPENGROK_WAR_TARGET}" 789N/A if [ -d "${prefix}/webapps" ] 789N/A echo "${prefix}/webapps" 789N/A if [ -n "${OPENGROK_WAR_TARGET_GLASSFISH}" ] 789N/A echo "${OPENGROK_WAR_TARGET_GLASSFISH}" 789N/A elif [ -n "${OPENGROK_WAR_TARGET}" ] 789N/A echo "${OPENGROK_WAR_TARGET}" 789N/A if [ -d "${prefix}/domains" ] 789N/A if [ -z "${domainDirectory}" ] 789N/A if [ -z "${domainDirectory}" ] 789N/A # User Specified Domain 789N/A if [ -n "${OPENGROK_GLASSFISH_DOMAIN}" ] 789N/A directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy" 789N/A if [ ! -d "${directory}" ] 1339N/A "${OPENGROK_GLASSFISH_DOMAIN}" 789N/A # Arbitrary Domain Selection 789N/A if [ -z "${firstDomain}" ] 789N/A echo "${domainDirectory}/${firstDomain}/autodeploy" 789N/A# The variable "DO" can usefully be set to "echo" to aid in script debugging 789N/A # Setup a standard execution environment (if required) 789N/A if [ -f "${OPENGROK_STANDARD_ENV}" ] 789N/A . "${OPENGROK_STANDARD_ENV}" 1338N/A# Load default configuration and then merge with user specified configuration. 789N/A # Note: As all functions have been defined by the time this routine 789N/A # is called, your configuration can, if desired, override functions 789N/A # in addition to setting the variables mentioned in the function 789N/A # DefaultInstanceConfiguration(), this maybe useful to override 789N/A # functionality used to determine the default deployment environment 789N/A # find dependencies or validate the configuration, for example. 789N/A if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ] 789N/A # Load the Local OpenGrok Configuration Environment 789N/A . "${OPENGROK_CONFIGURATION}" 789N/A if [ ! -x "${EXUBERANT_CTAGS}" ] 789N/A if [ ! -d "${SRC_ROOT}" ] 873N/A if [ -n "${QUIET}" -a -n "${VERBOSE}" ] 873N/A Warning "Both Quiet and Verbose Mode Enabled - Choosing Verbose" 1086N/A if [ -n "${OPENGROK_DERBY}" ] 789N/A if [ ! -d "${DATA_ROOT}" ] 1086N/A Warning "OpenGrok generated data path ${DATA_ROOT} doesn't exist" 857N/A if [ ! -d "${DATA_ROOT}" ] 857N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ] 1339N/A Warning "OpenGrok generated etc path ${OPENGROK_INSTANCE_BASE}/etc " \ 857N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ] 869N/A if [ -n "${LOGGER_CONFIG_PATH}" -a ! -f "${LOGGER_CONFIG_PATH}" ] 869N/A if [ ! -f "${LOGGER_CONF_SOURCE}" ] 911N/A "(${LOGGER_CONF_SOURCE}) to install as default" \ 869N/A "logging configuration (${LOGGER_CONFIG_PATH})" 1339N/A "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}" 1339N/A "${LOGGER_CONF_SOURCE}" | \ 1086N/A if [ -n "${OPENGROK_DERBY}" ] 1339N/A if [ ! -d "${OPENGROK_INSTANCE_BASE}/derby" ] 1339N/A "${OPENGROK_INSTANCE_BASE}/derby doesn't exist" 294N/A # OPTIONAL : Update the EftarFile data 868N/A if [ -n "${PATH_DESC}" -a -s "${PATH_DESC}" ] 789N/A if [ -z "${warTarget}" ] 789N/A if [ ! -f "${OPENGROK_DIST_WAR}" ] 789N/A if [ ! -d "${warTarget}" ] 1308N/A ${DO} cp -p "${OPENGROK_DIST_WAR}" "${warTarget}/" 1339N/A Progress "Start your application server (${applicationServer}), " \ 1339N/A Progress "running, or wait until it loads the just installed web " \ 789N/A Progress "OpenGrok should be available on <HOST>:<PORT>/source" 789N/A Progress " where HOST and PORT are configured in ${applicationServer}."