#!/bin/sh # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # $Id: xindice 523149 2007-03-28 02:53:46Z vgritsenko $ # ----------------------------------------------------------------------------- # Xindice @VERSION@ Database Rebuild Tool Unix Shell Script # ----------------------------------------------------------------------------- # ----- OS specific support ---------------------------------------------------- cygwin=false; darwin=false; case "`uname`" in CYGWIN*) cygwin=true ;; Darwin*) darwin=true if [ -z "$JAVA_HOME" ] ; then JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home fi ;; esac # ----- Verify and Set Required Environment Variables ------------------------- if [ "$JAVA_HOME" = "" ] ; then echo You must set JAVA_HOME to point at your Java Development Kit installation exit 1 fi if [ "$JAVA_OPTIONS" = "" ] ; then JAVA_OPTIONS="-Xms64m -Xmx128m" fi if [ "$XINDICE_HOME" = "" ] ; then XINDICE_HOME=`dirname $0`/.. if [ ! -f $XINDICE_HOME/xindice-1*.jar ] ; then echo ERROR: You must set XINDICE_HOME to point at your echo Xindice installation directory. exit 2 fi fi if [ "$LOGGER" = "" ] ; then LOGGER=org.apache.commons.logging.impl.SimpleLog ; fi if [ "$LOGLEVEL" = "" ] ; then LOGLEVEL=INFO ; fi if [ ! -d $XINDICE_HOME/logs ] then echo Creating the logs directory under $XINDICE_HOME mkdir -p $XINDICE_HOME/logs fi # ----- Set Classpath ---------------------------------------------------------- CP= for i in `ls $XINDICE_HOME/lib/endorsed/*.jar` ; do CP=$CP:$i ; done for i in `ls $XINDICE_HOME/lib/*.jar` ; do CP=$CP:$i ; done for i in `ls $XINDICE_HOME/xindice*.jar` ; do CP=$CP:$i ; done if [ "$3" = "-backup" ]; then if [ -n "$2" -a -e ${2}.backup ]; then echo "Cannot back up a database. ${2}.backup already exists" exit 1 fi if [ -n "$2" -a -d "$2" ]; then echo "Creating backup..." cp -r $2 ${2}.backup fi fi # ----- Run Tools -------------------------------------------------------------- JAVACMD=$JAVA_HOME/bin/java # For Cygwin, switch paths to Windows format before running java if $cygwin; then CP=`cygpath --path --windows "$CP"` XINDICE_HOME=`cygpath --path --windows "$XINDICE_HOME"` fi $JAVACMD $JAVA_OPTIONS -Dorg.apache.commons.logging.Log="$LOGGER" -Dorg.apache.commons.logging.simplelog.defaultlog="$LOGLEVEL" -classpath "$CP" org.apache.xindice.tools.DatabaseRebuild $* 2>>"$XINDICE_HOME"/logs/rebuild.log