[3222] | 1 | # if this file is executed, /bin/sh is used, as we don't start with #!
|
---|
| 2 | # this should work under ash, bash, zsh, ksh, sh style shells.
|
---|
| 3 |
|
---|
| 4 | # make sure we are sourced, and not run
|
---|
| 5 |
|
---|
| 6 | if test "$0" != "`echo $0 | sed s/setup\.bash//`" ; then
|
---|
| 7 | # if $0 contains "setup.bash" we've been run... $0 is shellname if sourced.
|
---|
| 8 | # One exception is zsh has an option to set it temporarily to the script name
|
---|
| 9 | if test -z "$ZSH_NAME" ; then
|
---|
| 10 | # we aren't using zsh
|
---|
| 11 | gsdl_not_sourced=true
|
---|
| 12 | fi
|
---|
| 13 | fi
|
---|
| 14 |
|
---|
| 15 | if test -n "$gsdl_not_sourced" ; then
|
---|
| 16 | echo " Error: Make sure you source this script, not execute it. Eg:"
|
---|
| 17 | echo " $ source setup.bash"
|
---|
| 18 | echo " or"
|
---|
| 19 | echo " $ . ./setup.bash"
|
---|
| 20 | echo " not"
|
---|
| 21 | echo " $ ./setup.bash"
|
---|
[3635] | 22 | #elif test -n "$GSDL3HOME" ; then
|
---|
| 23 | # echo "Your environment is already set up for Greenstone3!"
|
---|
[3222] | 24 | elif test ! -f setup.bash ; then
|
---|
| 25 | echo "You must source the script from within the Greenstone home directory"
|
---|
| 26 | else
|
---|
| 27 | GSDL3HOME=`pwd`
|
---|
| 28 | export GSDL3HOME
|
---|
[3689] | 29 | GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
---|
[3222] | 30 | # check for running bash under cygwin
|
---|
[3689] | 31 | if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
|
---|
[3222] | 32 | then
|
---|
[3689] | 33 | GSDLOS=windows
|
---|
[3222] | 34 | fi
|
---|
[3689] | 35 | export GSDLOS
|
---|
[3222] | 36 |
|
---|
[3695] | 37 | PATH=$PATH:$GSDL3HOME/bin/script:$GSDL3HOME/bin
|
---|
[3222] | 38 | export PATH
|
---|
| 39 | MANPATH=$MANPATH:$GSDL3HOME/doc/man
|
---|
| 40 | export MANPATH
|
---|
[3591] | 41 |
|
---|
[4848] | 42 | CLASSPATH=$GSDL3HOME/resources/java:$GSDL3HOME/src/java:$GSDL3HOME/comms/jakarta/tomcat/common/lib/servlet.jar
|
---|
[3591] | 43 | for JARFILE in $GSDL3HOME/lib/java/*; do
|
---|
| 44 | CLASSPATH=$CLASSPATH:$JARFILE
|
---|
| 45 | done
|
---|
[3222] | 46 | export CLASSPATH
|
---|
| 47 |
|
---|
[3356] | 48 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GSDL3HOME/lib
|
---|
[3253] | 49 | export LD_LIBRARY_PATH
|
---|
| 50 |
|
---|
[3689] | 51 | #set up java options for catalina
|
---|
| 52 | CATALINA_OPTS="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DGSDLHOME=$GSDLHOME -DPATH=$PATH"
|
---|
| 53 | export CATALINA_OPTS
|
---|
| 54 |
|
---|
[3832] | 55 | # Make sure JAVA_HOME is set
|
---|
| 56 | if test ! -n "$JAVA_HOME" ; then
|
---|
| 57 | echo "Error: JAVA_HOME variable not set."
|
---|
| 58 | # Make sure the Java executable is in JAVA_HOME/bin/
|
---|
| 59 | elif test ! -f "$JAVA_HOME/bin/java"; then
|
---|
| 60 | echo "Error: Java executable not found."
|
---|
| 61 | # Make sure the Java version is 1.4 (should really check for 1.4 or higher)
|
---|
| 62 | elif test ! -n "`$JAVA_HOME/bin/java -version 2>&1 | grep 'version \"1.4'`" ; then
|
---|
| 63 | echo "Error: Java version 1.4.0 required."
|
---|
| 64 | else
|
---|
| 65 | echo "Your environment has successfully been set up to run Greenstone3"
|
---|
| 66 | if test ! -n "$GSDLHOME" ; then
|
---|
| 67 | 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"
|
---|
| 68 | fi
|
---|
[3689] | 69 | fi
|
---|
| 70 |
|
---|
| 71 |
|
---|
[3222] | 72 | fi
|
---|
[3689] | 73 |
|
---|
| 74 |
|
---|
[3222] | 75 | unset gsdl_not_sourced
|
---|
[3253] | 76 |
|
---|
| 77 |
|
---|
| 78 |
|
---|
[3591] | 79 |
|
---|
| 80 |
|
---|