# if this file is executed, /bin/sh is used, as we don't start with #! # this should work under ash, bash, zsh, ksh, sh style shells. # make sure we are sourced, and not run if test "$0" != "`echo $0 | sed s/gs3-setup\.sh//`" ; then # if $0 contains "gs3-setup.sh" we've been run... $0 is shellname if sourced. # One exception is zsh has an option to set it temporarily to the script name if test -z "$ZSH_NAME" ; then # we aren't using zsh gsdl_not_sourced=true fi fi if test -n "$gsdl_not_sourced" ; then echo " Error: Make sure you source this script, not execute it. Eg:" echo " $ source gs3-setup.sh" echo " or" echo " $ . ./gs3-setup.sh" echo " not" echo " $ ./gs3-setup.sh" unset gsdl_not_sourced exit 1 fi if test ! -f gs3-setup.sh ; then echo "You must source the script from within the Greenstone home directory" exit 1 fi GSDL3SRCHOME=`pwd` GSDL3HOME=$GSDL3SRCHOME/web export GSDL3HOME export GSDL3SRCHOME GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # check for running bash under cygwin if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ; then GSDLOS=windows fi export GSDLOS #change this if external tomcat TOMCAT_HOME=$GSDL3SRCHOME/packages/tomcat PATH=$GSDL3SRCHOME/packages/mysql/bin:$GSDL3SRCHOME/bin/script:$GSDL3SRCHOME/bin:$PATH export PATH MANPATH=$MANPATH:$GSDL3SRCHOME/doc/man export MANPATH CLASSPATH=$GSDL3HOME/WEB-INF/classes:$GSDL3SRCHOME/resources/java:$CLASSPATH for JARFILE in $GSDL3SRCHOME/*.jar; do CLASSPATH=$CLASSPATH:$JARFILE done for JARFILE in $GSDL3SRCHOME/lib/jni/*.jar; do CLASSPATH=$CLASSPATH:$JARFILE done for JARFILE in $GSDL3HOME/WEB-INF/lib/*.jar; do CLASSPATH=$CLASSPATH:$JARFILE done for JARFILE in $TOMCAT_HOME/common/endorsed/*.jar; do CLASSPATH=$CLASSPATH:$JARFILE done for JARFILE in $GSDL3SRCHOME/build/*.jar; do CLASSPATH=$CLASSPATH:$JARFILE done export CLASSPATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GSDL3SRCHOME/lib/jni:$GSDL3SRCHOME/packages/mysql/lib/mysql export LD_LIBRARY_PATH ## for mac DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GSDL3SRCHOME/lib/jni:$GSDL3SRCHOME/packages/mysql/lib/mysql export DYLD_LIBRARY_PATH # see if we can find java java="java" jfound=1 jok=1 # if JAVAHOME or JAVA_HOME is set we'll use it to determine where java lives, otherwise # we just hope it's on the search path if [ "$JAVA_HOME" != "" ] ; then java="$JAVA_HOME/bin/java" elif [ "$JAVAHOME" != "" ] ; then java="$JAVAHOME/bin/java" export JAVA_HOME=$JAVAHOME else java=`which java 2> /dev/null` if [ ! -x "$java" ]; then echo "Failed to locate Java. You must install a java runtime environment" echo "(version 1.4 or greater) before installing Greenstone 3." jfound=0 jok=0 else export JAVA_HOME=`echo $java | sed -n 's/[\\\/]bin[\\\/]java$//p'` fi fi if [ $jfound -eq 1 ]; then javaversion=`$java -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'` jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'` jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'` if [ $jvmajor -lt 1 ] ; then jok=0 fi if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then jok=0 fi fi if [ $jfound -eq 1 ] && [ $jok -eq 0 ] ; then echo "The version of the java runtime environment you have installed is too" echo "old to run Greenstone 3. Please install a new version of the JRE (version" echo "1.4 or newer) and rerun this installation." else echo "Your environment has successfully been set up to run Greenstone3" fi #do we need to check for perl??? # make sure perl is ok #perl=`which perl 2> /dev/null` # echo "perl: $perl" #if [ ! -x "$perl" ] ; then # echo "Greenstone 3 requires perl in order to operate but this installation" # echo "could not detect perl on your system. Please ensure that perl is installed" # echo "and is on your search path then rerun this installation script." # exit 1 #fi