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