[6433] | 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/gs3-setup\.sh//`" ; then
|
---|
| 7 | # if $0 contains "gs3-setup.sh" 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 gs3-setup.sh"
|
---|
| 18 | echo " or"
|
---|
| 19 | echo " $ . ./gs3-setup.sh"
|
---|
| 20 | echo " not"
|
---|
| 21 | echo " $ ./gs3-setup.sh"
|
---|
| 22 |
|
---|
| 23 | elif test ! -f gs3-setup.sh ; then
|
---|
| 24 | echo "You must source the script from within the Greenstone home directory"
|
---|
| 25 |
|
---|
| 26 | else
|
---|
| 27 |
|
---|
| 28 | GSDL3HOME=`pwd`
|
---|
| 29 | export GSDL3HOME
|
---|
| 30 | GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
---|
| 31 | # check for running bash under cygwin
|
---|
| 32 | if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ; then
|
---|
| 33 | GSDLOS=windows
|
---|
| 34 | fi
|
---|
| 35 |
|
---|
| 36 | export GSDLOS
|
---|
| 37 |
|
---|
| 38 | PATH=$GSDL3HOME/packages/mysql/bin:$GSDL3HOME/bin/script:$GSDL3HOME/bin:$PATH
|
---|
| 39 | export PATH
|
---|
| 40 | MANPATH=$MANPATH:$GSDL3HOME/doc/man
|
---|
| 41 | export MANPATH
|
---|
| 42 |
|
---|
| 43 | CLASSPATH=$GSDL3HOME/resources/java:$GSDL3HOME/resources/dtd:$GSDL3HOME/src/java:$GSDL3HOME/comms/jakarta/tomcat/common/lib/servlet.jar:$GSDL3HOME/lib/java
|
---|
[6500] | 44 | for JARFILE in $GSDL3HOME/lib/java/*.jar; do
|
---|
[6433] | 45 | CLASSPATH=$CLASSPATH:$JARFILE
|
---|
| 46 | done
|
---|
| 47 | export CLASSPATH
|
---|
| 48 |
|
---|
[6560] | 49 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GSDL3HOME/lib:$GSDL3HOME/packages/mysql/lib/mysql
|
---|
[6433] | 50 | export LD_LIBRARY_PATH
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | # see if we can find java
|
---|
| 54 | java="java"
|
---|
| 55 | jfound=1
|
---|
| 56 | jok=1
|
---|
| 57 | # if JAVAHOME or JAVA_HOME is set we'll use it to determine where java lives, otherwise
|
---|
| 58 | # we just hope it's on the search path
|
---|
| 59 | if [ "$JAVA_HOME" != "" ] ; then
|
---|
| 60 | java="$JAVA_HOME/bin/java"
|
---|
| 61 | elif [ "$JAVAHOME" != "" ] ; then
|
---|
| 62 | java="$JAVAHOME/bin/java"
|
---|
| 63 | export JAVA_HOME=$JAVAHOME
|
---|
| 64 | else
|
---|
| 65 | java=`which java 2> /dev/null`
|
---|
| 66 | if [ ! -x "$java" ]; then
|
---|
| 67 | echo "Failed to locate Java. You must install a java runtime environment"
|
---|
| 68 | echo "(version 1.4 or greater) before installing Greenstone 3."
|
---|
| 69 | jfound=0
|
---|
| 70 | jok=0
|
---|
| 71 | else
|
---|
| 72 | export JAVA_HOME=`echo $java | sed -n 's/[\\\/]bin[\\\/]java$//p'`
|
---|
| 73 | fi
|
---|
| 74 | fi
|
---|
| 75 | if [ $jfound -eq 1 ]; then
|
---|
| 76 | javaversion=`$java -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
|
---|
| 77 | jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
|
---|
| 78 | jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
|
---|
| 79 |
|
---|
| 80 | if [ $jvmajor -lt 1 ] ; then
|
---|
| 81 | jok=0
|
---|
| 82 | fi
|
---|
| 83 | if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
|
---|
| 84 | jok=0
|
---|
| 85 | fi
|
---|
| 86 | fi
|
---|
| 87 |
|
---|
| 88 | if [ $jfound -eq 1 ] && [ $jok -eq 0 ] ; then
|
---|
| 89 | echo "The version of the java runtime environment you have installed is too"
|
---|
| 90 | echo "old to run Greenstone 3. Please install a new version of the JRE (version"
|
---|
| 91 | echo "1.4 or newer) and rerun this installation."
|
---|
| 92 | else
|
---|
| 93 | echo "Your environment has successfully been set up to run Greenstone3"
|
---|
| 94 | fi
|
---|
| 95 | fi
|
---|
| 96 |
|
---|
| 97 | unset gsdl_not_sourced
|
---|
| 98 |
|
---|
| 99 | #do we need to check for perl???
|
---|
| 100 | # make sure perl is ok
|
---|
| 101 | #perl=`which perl 2> /dev/null`
|
---|
| 102 | # echo "perl: $perl"
|
---|
| 103 | #if [ ! -x "$perl" ] ; then
|
---|
| 104 | # echo "Greenstone 3 requires perl in order to operate but this installation"
|
---|
| 105 | # echo "could not detect perl on your system. Please ensure that perl is installed"
|
---|
| 106 | # echo "and is on your search path then rerun this installation script."
|
---|
| 107 | # exit 1
|
---|
| 108 | #fi
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 |
|
---|
| 112 |
|
---|