OpenGrok revision b34561d2c3d92fac37dbced05ba6a8738e3d20e9
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# OpenGrok Wrapper (initial setup and cron job updating)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# Supported Operating Systems:
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - Solaris 10 (SunOS 5.10)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OpenSolaris (SunOS 5.11)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - Debian (Linux)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# Supported Deployment Engines:
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - Tomcat 6
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - Tomcat 5.5
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - Glassfish
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# Supported Environment Variables:
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
16b55a35cff91315d261d1baa776138af465c4e4fuankg# Supported Environment Variables for configuring the default setup:
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - EXUBERANT_CTAGS Full Path to Exuberant CTags
16b55a35cff91315d261d1baa776138af465c4e4fuankg# - JAVA_HOME Full Path to Java Installation Root
16b55a35cff91315d261d1baa776138af465c4e4fuankg# - OPENGROK_APP_SERVER Application Server ("Tomcat" or "Glassfish")
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish (contains domains)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_REMOTE_REPOS Disable History Cache for (remote) Repositories (*)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)_
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# - READ_XML_CONFIGURATION file with read only configuration - a temp workaround for bug # 327
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# (*) Any Non-Empty String will enable these options
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg echo "Usage: ${0} <deploy|update|updateQuietly|usage>" 1>&2
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg echo " OPENGROK_CONFIGURATION - location of your configuration" 1>&2
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... " 1>&2
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg echo " See the code for more information on configuration options / variables" 1>&2
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# Runtime Configuration
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# TODO: Handle symlinks correctly (especially in ${0})
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg# Default Instance Configuration
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # Use the built-in defaults. This section can be copied to its own
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # file and tailored to your local requirements. Then simply set
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # this wrapper. It will save you hand editing in your settings
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # on each new release. A sample cron(1M) entry might look like:
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # Note: It is not really possible to ever provided defaults for
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # these values which will run in every UNIX-like environment.
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # So I have provided a set which are functional for a given
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # environment on which you can based you own configuration.
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # This has been updated to support more environment variables and
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # operating systems, if you have any reasonably generic
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg OPENGROK_INSTANCE_BASE="${OPENGROK_INSTANCE_BASE:-/var/opengrok}"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg OPENGROK_DISTRIBUTION_BASE="${SCRIPT_DIRECTORY}/dist"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg LOGGER_CONF_SOURCE="${SCRIPT_DIRECTORY}/${LOGGER_CONFIG_FILE}"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg LOGGER_CONF_SOURCE="${OPENGROK_DISTRIBUTION_BASE}/${LOGGER_CONFIG_FILE}"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # (The user maintained source of the generated EftarFile file)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg XML_CONFIGURATION="${OPENGROK_INSTANCE_BASE}/etc/configuration.xml"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # OPTIONAL: read only XML config, if it exists, it will be read
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg LOGGER_CONFIG_PATH="${OPENGROK_INSTANCE_BASE}/${LOGGER_CONFIG_FILE}"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg LOGGER_PROPERTIES="-Djava.util.logging.config.file=${LOGGER_CONFIG_PATH}"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # REQUIRED: Java Archive of OpenGrok (Installation Location)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg OPENGROK_JAR="${OPENGROK_DISTRIBUTION_BASE}/opengrok.jar"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # REQUIRED(deploy): Web Archive of OpenGrok (Distribution Location)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # (user building from source code will find this and other key
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # files in the "dist" directory after the build is completed)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg OPENGROK_DIST_WAR="${OPENGROK_DISTRIBUTION_BASE}/source.war"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg EXUBERANT_CTAGS="${EXUBERANT_CTAGS:-`FindExuberantCTags`}"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # DEVELOPMENT: Debug option, if enabled current indexer will listen on the port 8010 until a debugger connects
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg #JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,address=8010,suspend=y"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # OPTIONAL: Ignore these patterns as names of files or directories
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # (Every directory in SRC_ROOT is considered a separate project)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # OPTIONAL: Scanning Options (for Mercurial repositories)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # Note, that you might run out of memory, then either increase JVM memory
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # as noted in JAVA_OPTS, or set this limit(if you don't mind opengrok not
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # indexing the rest of the file, once the limit is reached)
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # Assumption: We should not set properties to the empty string
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg${HG:+-Dorg.opensolaris.opengrok.history.Mercurial=$HG} \
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg${SVN:+-Dorg.opensolaris.opengrok.history.Subversion=$SVN} \
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg${SCCS:+-Dorg.opensolaris.opengrok.history.SCCS=$SCCS} \
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg${CLEARCASE:+-Dorg.opensolaris.opengrok.history.ClearCase=$CLEARCASE} \
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg${P4:+-Dorg.opensolaris.opengrok.history.Perforce=$P4} \
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg${MTN:+-Dorg.opensolaris.opengrok.history.Monotone=$MTN} \
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg${BZR:+-Dorg.opensolaris.opengrok.history.Bazaar=$BZR} \
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # OPTIONAL: Store The History Cache in Java DB (derby),
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # - derbyclient.jar - See README.txt for more details
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # - Running Derby Server - Defaults to localhost:1527
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # Usage: <class> inputFile [inputFile ...] outputFile
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
13b501825bce68e7e49b4bc775da93e38d9bd9f3fuankg # Be Quiet? (set indirectly by command line arguments in the main program)
${DO} exit 2
${OPENGROK_TOMCAT_BASE} \
${DO} grep -v java.util.logging.FileHandler.pattern "${LOGGER_CONF_SOURCE}" > "${LOGGER_CONFIG_PATH}"
${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}"
${DO} mkdir ${OPENGROK_INSTANCE_BASE}/log
${DO} ${JAVA} ${JAVA_OPTS} ${PROPERTIES} \
${LOGGER_PROPERTIES} \
${JAVA_DEBUG} \
-jar ${OPENGROK_JAR} \
${IGNORE_PATTERNS} ${ENABLE_PROJECTS} \
${DERBY_HISTORY_CACHE} \
${EXUBERANT_CTAGS:+-c} ${EXUBERANT_CTAGS} \
${MAX_INDEXED_WORDS} ${SKIN} ${LEADING_WILDCARD} \
${READ_XML_CONF} \
-W ${XML_CONFIGURATION} \
${DO} ${JAVA} -classpath ${OPENGROK_JAR} \
${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}