OpenGrok revision 0ca9a2c194523c517c3aafe5758e217ac88d6baa
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Kosco# OpenGrok Wrapper (initial setup and cron job updating)
cd348e325366620fe047edcc849e3c9424828599Peter Bray# targeted against OpenSolaris + Debian , tomcat6 and glassfish
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# `date +%Y-%m-%d-%H-%M`
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "Usage: ${0} <deploy|update|updateQuietly|updateConfiguration|usage>" 1>&2
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray echo "OPENGROK_CONFIGURATION - location of own config, see sample.env.conf" 1>&2
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray echo "e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ./${0} ... " 1>&2
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# Configuration
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Brayif [ -n "${OPENGROK_CONFIGURATION}" -a -f "${OPENGROK_CONFIGURATION}" ]
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # Load the Local OpenGrok Configuration Environment
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray . "${OPENGROK_CONFIGURATION}"
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # Use the built-in defaults. This section can be copied to its own
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # file and tailored to your local requirements. Then simply set
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray # OPENGROK_CONFIGURATION=/path/to/your/configuration, before using
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # this wrapper. It will save you hand editing in your settings
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # on each new release. A sample Cron Entry might look like:
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # 15 0 * * * OPENGROK_CONFIGURATION=/pkgs/etc/OpenGrok.sh /pkgs/sbin/OpenGrok updateQuietly
65df1e87266301e243dcead8082ca6255abea666Vladimir Kotal # Note: below is doing some small autodetection, use own config in case it fails
425278cfacbc73f1e955ab6016f206fc5ed93ccbVladimir Kotal # Note: It is not really possible to ever provided defaults for
425278cfacbc73f1e955ab6016f206fc5ed93ccbVladimir Kotal # these values which will run in every UNIX-like environment.
65df1e87266301e243dcead8082ca6255abea666Vladimir Kotal # So I have provided a set which are functional for a given
65df1e87266301e243dcead8082ca6255abea666Vladimir Kotal # environment on which you can based you own configuration.
425278cfacbc73f1e955ab6016f206fc5ed93ccbVladimir Kotal STANDARD_ENV=/pkgs/sbin/CronExecutionEnvironment.sh
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # Setup a standard execution environment
3ba66fbb56ef22f183da783a1b2718280c357a4eStanislav Kozina # BINARYBASE="./" in case of local execution ...
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # REQUIRED: Source Code/Repository Root
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # (your source code or the root of all repositories)
983523cf73bc85cce6282cb5aa78b60f6bcd959fLubos Kosco # REQUIRED: OpenGrok Generate Data Root
983523cf73bc85cce6282cb5aa78b60f6bcd959fLubos Kosco # (for Lucene index and hypertext cross-references)
983523cf73bc85cce6282cb5aa78b60f6bcd959fLubos Kosco # This area is rebuilt by "update" / "updateQuietly"
c577d2f6c082eaff9af5bc997d12f3d3bcef537cPeter Bray # OPTIONAL: User Provided Source Path to Description Mapping (Tab Separated Value)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # (The user maintained source of the generated EftarFile file)
425278cfacbc73f1e955ab6016f206fc5ed93ccbVladimir Kotal # REQUIRED: XML Configuration
6c8465e3b4611cb632cba9b0572e3e3737c8c341Vladimir Kotal # (the configuration used by Web/GUI interfaces)
cd348e325366620fe047edcc849e3c9424828599Peter Bray XML_CONFIGURATION="$VARBASE/etc/configuration.xml"
cd348e325366620fe047edcc849e3c9424828599Peter Bray # REQUIRED: Java Archive of OpenGrok
cd348e325366620fe047edcc849e3c9424828599Peter Bray # (user building from source code will find this other key
cd348e325366620fe047edcc849e3c9424828599Peter Bray # files in the "dist" directory after the build is completed)
43dac746513591adbd09bc4f417feb385f4fd87eVladimir Kotal # REQUIRED: Exuberant CTags (http://ctags.sf.net)
fbf97ea1786d1e25add88bbfb91810170473bc9fLubos Kosco # EXUBERANT_CTAGS="/pkgs/64-bit/release/ctags-5.7/bin/ctags"
f21b682cd9b414738a4f5a38b56f6682e537e1d2Trond Norbye # REQUIRED: Java Home
cd348e325366620fe047edcc849e3c9424828599Peter Bray #JAVA_HOME="/usr/jdk/latest/" # if we will be backwards compatible
c276b1ec9722ee95a86a4a381b39c5f405fc1cc4Vladimir Kotal # REQUIRED: Java Virtual Machine
c276b1ec9722ee95a86a4a381b39c5f405fc1cc4Vladimir Kotal # OPTIONAL: Uncomment the following line if your source contains Mercurial repositories.
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray # OPTIONAL: Override Built-in Properties
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray PROPERTIES="-Dorg.opensolaris.opengrok.history.Mercurial=$HG \
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray-Dorg.opensolaris.opengrok.history.Subversion=$SVN \
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # OPTIONAL: JVM Options
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray #JAVA_OPTS="-server -Xmx1024m"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # DELIVERED: An update program for EftarFile
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Usage: <class> inputFile [inputFile ...] outputFile
cd348e325366620fe047edcc849e3c9424828599Peter Bray # EftarFile == An Extremely Fast Tagged Attribute Read-only File System
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray EFTAR_UPDATE="org.opensolaris.opengrok.web.EftarFile"
cd348e325366620fe047edcc849e3c9424828599Peter Bray # HARDCODED: Generated EftarFile (See web/*.jsp)
cd348e325366620fe047edcc849e3c9424828599Peter Bray EFTAR_OUTPUT_FILE="${DATA_ROOT}/index/dtags.eftar"
cd348e325366620fe047edcc849e3c9424828599Peter Bray # Be Quiet? (set indirectly by command line arguments in the main program)
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray # or alternatively, Be Verbose!
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray #VERBOSE="-v"
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Brayif [ ! -x $EXUBERANT_CTAGS ] ; then
0ca9a2c194523c517c3aafe5758e217ac88d6baaLubos Koscoecho "Exuberant ctags for $OS: $EXCTAGS not found or not executable, exiting until this dependency is resolved ..."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Brayif [ ! -d $SRC_ROOT ] ; then
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Brayecho "The source path: $SRC_ROOT doesn't exist, exiting cowardly ..."
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Brayif [ ! -d $DATA_ROOT ] ; then
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Brayecho "Index path $DATA_ROOT nonexistent, attempting to create one ... "
5e6c91d7e77062129cd0b6ac8aaa546dff216419Lubos Kosco# Implementation
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray# The variable "DO" can usefully be set to "echo" to aid in script debugging
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray ${EFTAR_UPDATE} ${PATH_DESC} ${EFTAR_OUTPUT_FILE}
d2a02e104622a26dd90fa88f4f17188f2039809fPeter Bray ${DO} ${JAVA} ${JAVA_OPTS} -jar ${OPENGROK_JAR} '-?'
cd348e325366620fe047edcc849e3c9424828599Peter Bray# detection mechanism could be better, but as a starter this will do the job,
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal# if you expect more, write it, we accept patches !
d961aa46ea0d50fed47802497e45226b1965b12dVladimir Kotal# tomcat is preffered
cd348e325366620fe047edcc849e3c9424828599Peter Brayif [ ! -d $WARDIR ]; then
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal# test whether glassfish is there, only if tomcat webapp dir is not present
56d93b0c761868f813ac0bc0b5bc21a7a9fefd89Vladimir Kotal if [ -x /etc/init.d/appserv ]; then
4f3c0816485669143aa54f1c6461fcb47cf5bc5cVladimir Kotal if [ -d $DOMAINDIR ]; then
17d95a647aba8c37d9ac34d97e4eed729aa46f67Naseer Ahmed error "Glassfish installed, but cannot get first domain from $DOMAINDIR."
d280c5e286f5b98be13237f52281ae5afdcf51b9Peter Bray error "$WARDIR doesn't exist, seems this combination of application container and $OS is unsupported"
477c09a2656e6a2c1075425ad81e61d594164fa9Lubos Koscoecho "Copying $WAR to $WARDIR , start your $CONTAINER or wait until it loads the war"
cd348e325366620fe047edcc849e3c9424828599Peter Brayecho "OpenGrok should be listening on HOST:PORT/source , where HOST and PORT are configured in your $CONTAINER."
d6ee3934a24d8ccc0e4bb478405d8e5f6a35825dLubos Koscoecho "There was a problem copying the web archive to target directory, consult error message above."
d70dc22c6dce3f498251b0873638d1fea0e644a3Lubos Kosco# Main Program