# 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/setup\.bash//`" ; then # if $0 contains "setup.bash" 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 setup.bash" echo " or" echo " $ . ./setup.bash" echo " not" echo " $ ./setup.bash" #elif test -n "$GSDL3HOME" ; then # echo "Your environment is already set up for Greenstone3!" elif test ! -f setup.bash ; then echo "You must source the script from within the Greenstone home directory" else GSDL3HOME=`pwd` export GSDL3HOME 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 PATH=$PATH:$GSDL3HOME/bin/script:$GSDL3HOME/bin export PATH MANPATH=$MANPATH:$GSDL3HOME/doc/man export MANPATH CLASSPATH=$GSDL3HOME/resources/java:$GSDL3HOME/src/java:$GSDL3HOME/comms/tomcat/jakarta/common/lib/servlet.jar for JARFILE in $GSDL3HOME/lib/java/*; do CLASSPATH=$CLASSPATH:$JARFILE done export CLASSPATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GSDL3HOME/lib export LD_LIBRARY_PATH #set up java options for catalina CATALINA_OPTS="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DGSDLHOME=$GSDLHOME -DPATH=$PATH" export CATALINA_OPTS # Make sure JAVA_HOME is set if test ! -n "$JAVA_HOME" ; then echo "Error: JAVA_HOME variable not set." # Make sure the Java executable is in JAVA_HOME/bin/ elif test ! -f "$JAVA_HOME/bin/java"; then echo "Error: Java executable not found." # Make sure the Java version is 1.4 (should really check for 1.4 or higher) elif test ! -n "`$JAVA_HOME/bin/java -version 2>&1 | grep 'version \"1.4'`" ; then echo "Error: Java version 1.4.0 required." else echo "Your environment has successfully been set up to run Greenstone3" if test ! -n "$GSDLHOME" ; then echo "However, if you want to run greenstone 2 compatible building, then you need to 'source setup.bash' in the home directory of your greenstone 2 installation, and then re-source this script" fi fi fi unset gsdl_not_sourced