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