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