[19937] | 1 | #!/bin/bash
|
---|
[13235] | 2 | serverlang=en
|
---|
| 3 |
|
---|
[15131] | 4 | java_min_version=1.4.0_00
|
---|
| 5 |
|
---|
[18559] | 6 | autoset_gsdl_home() {
|
---|
| 7 |
|
---|
| 8 | # remove leading ./ if present
|
---|
[20187] | 9 | prog="${0#./}"
|
---|
[18559] | 10 |
|
---|
[20187] | 11 | isrelative="${prog%%/*}"
|
---|
[18559] | 12 |
|
---|
| 13 | if [ ! -z $isrelative ] ; then
|
---|
| 14 | # some text is left after stripping
|
---|
| 15 | # => is relative
|
---|
[20187] | 16 | pwd="$PWD"
|
---|
[18559] | 17 | prog="$pwd/$prog"
|
---|
| 18 | fi
|
---|
| 19 |
|
---|
[20187] | 20 | fulldir="${prog%/*}"
|
---|
[18559] | 21 |
|
---|
| 22 | # remove trailing /. if present
|
---|
[20187] | 23 | eval $1=\""${fulldir%/.}"\"
|
---|
[18559] | 24 | }
|
---|
| 25 |
|
---|
[27830] | 26 | check_gsdl3home_writable() {
|
---|
[18559] | 27 |
|
---|
[27830] | 28 | echo "Checking if the Greenstone3 web directory is writable ..."
|
---|
| 29 | (echo "This is a temporary file. It is safe to delete it." > "$GSDL3HOME/testing.tmp" ) 2>/dev/null
|
---|
| 30 | if [ -e "$GSDL3HOME/testing.tmp" ] ; then
|
---|
| 31 | /bin/rm "$GSDL3HOME/testing.tmp"
|
---|
| 32 | gsdl3home_isreadonly=0
|
---|
| 33 | echo " ... yes."
|
---|
| 34 | else
|
---|
| 35 | gsdl3home_isreadonly=1
|
---|
| 36 | gsdl3_writablehome="/tmp/greenstone/web"
|
---|
| 37 |
|
---|
| 38 | echo " ... no."
|
---|
| 39 | echo "Setting Greenstone3 web home writable area to be: $gsdl3_writablehome"
|
---|
| 40 | fi
|
---|
| 41 | }
|
---|
| 42 |
|
---|
[13235] | 43 | echo "Greenstone 3 Server"
|
---|
[18559] | 44 | echo "Copyright (C) 2009, New Zealand Digital Library Project, University Of Waikato"
|
---|
[13235] | 45 | echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
|
---|
| 46 | echo "This is free software, and you are welcome to redistribute it"
|
---|
| 47 |
|
---|
| 48 | ## -------- Run the Greenstone 3 Server --------
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | ## ---- Determine GSDL3SRCHOME ----
|
---|
| 52 | gsdl3path=
|
---|
| 53 |
|
---|
| 54 | # Some users may set the above line manually
|
---|
[14727] | 55 | if [ -z "$gsdl3path" ]; then
|
---|
[20187] | 56 | autoset_gsdl_home "gsdl3path"
|
---|
[13235] | 57 | fi
|
---|
| 58 |
|
---|
[20188] | 59 | # Setup Greenstone3
|
---|
| 60 | pushd $gsdl3path > /dev/null
|
---|
| 61 | source ./gs3-setup.sh
|
---|
| 62 | popd > /dev/null
|
---|
[13235] | 63 |
|
---|
[27830] | 64 | check_gsdl3home_writable
|
---|
| 65 |
|
---|
| 66 | opt_properties=
|
---|
| 67 | if [ $gsdl3home_isreadonly = 1 ] ; then
|
---|
| 68 | opt_properties="-Dgsdl3home.isreadonly=true -Dgsdl3.writablehome=$gsdl3_writablehome"
|
---|
| 69 | fi
|
---|
| 70 |
|
---|
[14727] | 71 | # JRE_HOME or JAVA_HOME must be set correctly to run this program
|
---|
[20059] | 72 | HINT="`pwd`/packages/jre"
|
---|
| 73 | javapath=`search4j -p "$HINT" -m $java_min_version -e`
|
---|
[15132] | 74 | if [ "$?" == "0" ]; then
|
---|
[18559] | 75 | # In Java code, '...getResourceAsStream("build.properties")'
|
---|
| 76 | # needs up to be in the right directory when run
|
---|
[20059] | 77 | pushd "$gsdl3path" > /dev/null
|
---|
[18559] | 78 |
|
---|
[27830] | 79 | "$javapath" $opt_properties org.greenstone.server.Server3 "$GSDL3SRCHOME" $serverlang
|
---|
[18559] | 80 |
|
---|
| 81 | popd > /dev/null
|
---|
[15132] | 82 | fi
|
---|
[13235] | 83 |
|
---|