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"
|
---|
22 | #elif test -n "$GSDL3HOME" ; then
|
---|
23 | # echo "Your environment is already set up for Greenstone3!"
|
---|
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
|
---|
29 | GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
---|
30 | # check for running bash under cygwin
|
---|
31 | if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
|
---|
32 | then
|
---|
33 | GSDLOS=windows
|
---|
34 | fi
|
---|
35 | export GSDLOS
|
---|
36 |
|
---|
37 | PATH=$PATH:$GSDL3HOME/bin/script:$GSDL3HOME/bin
|
---|
38 | export PATH
|
---|
39 | MANPATH=$MANPATH:$GSDL3HOME/doc/man
|
---|
40 | export MANPATH
|
---|
41 |
|
---|
42 | CLASSPATH=$GSDL3HOME/resources/java:$GSDL3HOME/src/java:$GSDL3HOME/comms/tomcat/jakarta/common/lib/servlet.jar
|
---|
43 | for JARFILE in $GSDL3HOME/lib/java/*; do
|
---|
44 | CLASSPATH=$CLASSPATH:$JARFILE
|
---|
45 | done
|
---|
46 | export CLASSPATH
|
---|
47 |
|
---|
48 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GSDL3HOME/lib
|
---|
49 | export LD_LIBRARY_PATH
|
---|
50 |
|
---|
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 |
|
---|
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
|
---|
69 | fi
|
---|
70 |
|
---|
71 |
|
---|
72 | fi
|
---|
73 |
|
---|
74 |
|
---|
75 | unset gsdl_not_sourced
|
---|
76 |
|
---|
77 |
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|