OpenGrok revision 868
98N/A# OpenGrok Wrapper (initial setup and cron job updating) 98N/A# Supported Operating Systems: 98N/A# - Solaris 10 (SunOS 5.10) 98N/A# - OpenSolaris (SunOS 5.11) 98N/A# Supported Deployment Engines 98N/A# Supported Environment Variables : 98N/A# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages 98N/A# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script) 98N/A# - OPENGROK_CONFIGURATION User Configuration (Shell Script) 98N/A# Supported Environment Variables for configuring the default setup 98N/A# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution 98N/A# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area 98N/A# - EXUBERANT_CTAGS Full Path to Exuberant CTags 98N/A# - JAVA_HOME Full Path to Java Installation Root 98N/A# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish") 98N/A# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory 98N/A# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory 98N/A# - OPENGROK_WAR_TARGET Fallback WAR Target Directory 98N/A# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps) 98N/A# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish (contains domains) 98N/A# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name 98N/A echo "Usage: ${0} <deploy|index <directory>|update|updateQuietly|updateConfiguration|usage>" 1>&2 98N/A echo " Optional environment variables:" 1>&2 98N/A echo " OPENGROK_CONFIGURATION - location of your configuartion" 1>&2 98N/A echo " See the code for more information on configuration options / variables" 1>&2 98N/A# Runtime Configuration 98N/A# Default Instance Configuration 98N/A # Use the built-in defaults. This section can be copied to its own 98N/A # file and tailored to your local requirements. Then simply set 98N/A # this wrapper. It will save you hand editing in your settings 98N/A # on each new release. A sample cron(1M) entry might look like: 98N/A # Note: It is not really possible to ever provided defaults for 98N/A # these values which will run in every UNIX-like environment. 98N/A # So I have provided a set which are functional for a given 98N/A # environment on which you can based you own configuration. 98N/A # This has been updated to support more environment variables and 98N/A # operating systems, if you have any reasonably generic 98N/A # improvements please feel free to submit a patch. 98N/A if [ -z "${OPENGROK_DISTRIBUTION_BASE}" ] 98N/A # Handle Developer Build Environments 98N/A # Handle Binary Distributions 98N/A#below might not work as intended when symlinks ??!? 98N/A LOGGERS="${OPENGROK_DISTRIBUTION_BASE}/doc/${LOGGERF}" # (your source code or the root of all repositories) SRC_ROOT="${OPENGROK_INSTANCE_BASE}/src" # REQUIRED: OpenGrok Generate Data Root # (for Lucene index and hypertext cross-references) # This area is rebuilt by "update" / "updateQuietly" # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value) # (The user maintained source of the generated EftarFile file) # REQUIRED: XML Configuration # (the configuration used by Web/GUI interfaces) # REQUIRED: Java Archive of OpenGrok (Installation Location) # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location) # (user building from source code will find this and other key # files in the "dist" directory after the build is completed) # REQUIRED: Java Virtual Machine # ignore these pattern as names of files/dirs # enable projects, every dir in SRC_ROOT is considered a separate project # OPTIONAL: Scanning Options (for Mercurial repositories) # support remote repositories (cvs or svn), can be very time demanding, comment out if not needed # allow leading wildcard searches, by default off # skin \"default\", \"offwhite\" and \"polished\" # OPTIONAL: Full Path to History Utilities # OPTIONAL: Override Built-in Properties # Assumption: We should not set properties to the empty string #history cache in Java DB - derby ? # by default standalone derby server on localhost:1527 is expected #JAVA_OPTS="-server -Xmx1024m" # DELIVERED: An update program for EftarFile # Usage: <class> inputFile [inputFile ...] outputFile # EftarFile == An Extremely Fast Tagged Attribute Read-only File System # HARDCODED: Generated EftarFile (See web/*.jsp) # Be Quiet? (set indirectly by command line arguments in the main program) # or alternatively, Be Verbose! # maximum of words that will be indexed per file, 60000 is internal default # host:port of web application which we should update, localhost:2424 is internal default in web.xml # Helper Functions - Logging # In general, non-interactive use like cron jobs and automated # installation environments should not generate unnecessary # progress information or warnings, as usage and configuration # will have generally been debugged prior to automation. if [ -z "${OPENGROK_NON_INTERACTIVE}" ] if [ -z "${OPENGROK_NON_INTERACTIVE}" ] echo "WARNING: ${@}" 1>&2 echo "FATAL ERROR: ${@} - Aborting!" 1>&2 # Helper Functions - Autodetection of Runtime Environment case "${OS_NAME}:${OS_VERSION}" in if [ -z "${commandName}" ] Error "Unable to determine Exuberant CTags command name" \ "for ${OS_NAME} ${OS_VERSION}" case "${OS_NAME}:${OS_VERSION}" in Error "Unable to determine Java 6 Home" \ "for ${OS_NAME} ${OS_VERSION}" if [ ! -d "${javaHome}" ] Error "Missing Java Home ${javaHome}" # Use this function to determine which environment the deploy the # web application function into. Some users (especially # developers) will have many deployment environments or will wish # to specify directly the application server to deploy to. # Either use the environment variable OPENGROK_APP_SERVER or # reimplement this function in your configuration file (as # specified by OPENGROK_CONFIGURATION) if [ -n "${OPENGROK_APP_SERVER}" ] echo "${OPENGROK_APP_SERVER}" # This implementation favours Tomcat, but needs a lot of work, # especially if Glassfish is perferrerd or it is under the control # of SMF (Service Management Facility) # Maybe a better implementation would be to call Application # Server specific WAR Directory and see if they exist. if [ -n "${OPENGROK_WAR_TARGET_TOMCAT}" ] echo "${OPENGROK_WAR_TARGET_TOMCAT}" elif [ -n "${OPENGROK_WAR_TARGET}" ] echo "${OPENGROK_WAR_TARGET}" if [ -d "${prefix}/webapps" ] if [ -n "${OPENGROK_WAR_TARGET_GLASSFISH}" ] echo "${OPENGROK_WAR_TARGET_GLASSFISH}" elif [ -n "${OPENGROK_WAR_TARGET}" ] echo "${OPENGROK_WAR_TARGET}" if [ -d "${prefix}/domains" ] if [ -z "${domainDirectory}" ] if [ -z "${domainDirectory}" ] if [ -n "${OPENGROK_GLASSFISH_DOMAIN}" ] directory="${domainDirectory}/${OPENGROK_GLASSFISH_DOMAIN}/autodeploy" if [ ! -d "${directory}" ] FatalError "Missing Specified Glassfish Domain ${OPENGROK_GLASSFISH_DOMAIN}" # Arbitrary Domain Selection if [ -z "${firstDomain}" ] FatalError "Failed to dynamically determine Glassfish Domain from ${domainDirectory}" echo "${domainDirectory}/${firstDomain}/autodeploy" # The variable "DO" can usefully be set to "echo" to aid in script debugging # Setup a standard execution environment (if required) if [ -f "${OPENGROK_STANDARD_ENV}" ] Progress "Loading ${OPENGROK_STANDARD_ENV} ..." . "${OPENGROK_STANDARD_ENV}" # Note: As all functions have been defined by the time this routine # is called, your configuration can, if desired, override functions # in addition to setting the variables mentioned in the function # DefaultInstanceConfiguration(), this maybe useful to override # functionality used to determine the default deployment environment # find dependencies or validate the configuration, for example. if [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ] # Load the Local OpenGrok Configuration Environment Progress "Loading ${OPENGROK_CONFIGURATION} ..." . "${OPENGROK_CONFIGURATION}" Progress "Loading the default instance configuration ..." if [ ! -x "${EXUBERANT_CTAGS}" ] FatalError "Missing Dependent Application - Exuberant CTags" if [ ! -d "${SRC_ROOT}" ] FatalError "OpenGrok Source Path ${SRC_ROOT} doesn't exist" if [ ! -d "${DATA_ROOT}" ] Warning "OpenGrok Generated Data Path ${DATA_ROOT} doesn't exist" Progress " Attempting to create generated data directory ... " if [ ! -d "${DATA_ROOT}" ] FatalError "OpenGrok Data Path ${DATA_ROOT} doesn't exist" if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ] Warning "OpenGrok Generated Etc Path ${OPENGROK_INSTANCE_BASE}/etc doesn't exist" Progress " Attempting to create generated etc directory ... " ${DO} mkdir -p "${OPENGROK_INSTANCE_BASE}/etc" if [ ! -d "${OPENGROK_INSTANCE_BASE}/etc" ] FatalError "OpenGrok Etc Path ${OPENGROK_INSTANCE_BASE}/etc doesn't exist" # sed and lower the level? ${DO} # set logging dir to instance base? #? -R ${XML_CONFIGURATION} \ # OPTIONAL : Update the EftarFile data if [ -n "${PATH_DESC}" -a -s "${PATH_DESC}" ] case "${applicationServer}" in *) FatalError "Unsupported Application Server ${applicationServer}" ;; FatalError "Unable to determine Deployment Directory for ${applicationServer}" if [ ! -f "${OPENGROK_DIST_WAR}" ] FatalError "Missing Web Application Archive ${OPENGROK_DIST_WAR}" if [ ! -d "${warTarget}" ] FatalError "Missing Deployment Directory ${warTarget}" Progress "Installing ${OPENGROK_DIST_WAR} to ${warTarget} ..." ${DO} cp "${OPENGROK_DIST_WAR}" "${warTarget}/" Progress "Start your application server (${applicationServer}), if it is not already" Progress "running, or wait until it loads the just installed web application." Progress "OpenGrok should be available on <HOST>:<PORT>/source" Progress " where HOST and PORT are configured in ${applicationServer}." if [ $# -
eq 0 -o $# -
gt 2 ]
if [ ${
2}x !=
""x ] ;
then