root/main/trunk/greenstone3/gs3-server.sh @ 27861

Revision 27861, 2.9 KB (checked in by davidb, 7 years ago)

No longer do the directory copies here. Better if this can be done in an OS-independant way in the ant build.xml file

  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/bin/bash
2serverlang=en
3
4java_min_version=1.4.0_00
5
6autoset_gsdl_home() {
7
8  # remove leading ./ if present
9  prog="${0#./}"
10
11  isrelative="${prog%%/*}"
12
13  if [ ! -z $isrelative ] ; then
14    # some text is left after stripping
15    # => is relative
16    pwd="$PWD"
17    prog="$pwd/$prog"
18  fi
19
20  fulldir="${prog%/*}"
21
22  # remove trailing /. if present
23  eval $1=\""${fulldir%/.}"\"
24}
25
26check_gsdl3home_writable() {
27
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
41    if [ ! -d "$gsdl3_writablehome" ] ; then
42        echo "Creating the directory: $gsdl3_writablehome"
43
44        mkdir -p "$gsdl3_writablehome"
45        mkdir -p "$gsdl3_writablehome/packages"
46        mkdir -p "$gsdl3_writablehome/logs"
47        mkdir -p "$gsdl3_writablehome/ext/solr"
48
49        chmod a+rwx "$gsdl3_writablehome"
50        chmod a+rwx "$gsdl3_writablehome/packages"
51        chmod a+rwx "$gsdl3_writablehome/logs"
52        chmod a+rwx "$gsdl3_writablehome/ext/solr"
53
54#       echo "Copying to $gsdl3_writablehome/packages/tomcat"
55#           /bin/cp -r "$GSDL3SRCHOME/packages/tomcat" "$gsdl3_writablehome/packages/."
56
57#            echo "=> Copying Greenstone's web/WEB-INF to writable area"
58       
59#       gsdl3_home=$GSDL3HOME
60#       /bin/cp -r "$gsdl3_home/WEB-INF" "$gsdl3_writablehome/."
61#       /bin/cp -r "$gsdl3_home/index.html" "$gsdl3_writablehome/."
62    fi
63    fi
64}
65
66echo "Greenstone 3 Server"
67echo "Copyright (C) 2009, New Zealand Digital Library Project, University Of Waikato"
68echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
69echo "This is free software, and you are welcome to redistribute it"
70
71##  -------- Run the Greenstone 3 Server --------
72
73
74##  ---- Determine GSDL3SRCHOME ----
75gsdl3path=
76
77# Some users may set the above line manually
78if [ -z "$gsdl3path" ]; then
79   autoset_gsdl_home "gsdl3path"
80fi
81
82# Setup Greenstone3
83pushd $gsdl3path > /dev/null
84source ./gs3-setup.sh
85popd > /dev/null
86
87check_gsdl3home_writable
88
89opt_properties=
90if [ $gsdl3home_isreadonly = 1 ] ; then
91    opt_properties="-Dgsdl3home.isreadonly=true -Dgsdl3.writablehome=$gsdl3_writablehome"
92fi
93
94# JRE_HOME or JAVA_HOME must be set correctly to run this program
95HINT="`pwd`/packages/jre"
96javapath=`search4j -p "$HINT" -m $java_min_version -e`
97if [ "$?" == "0" ]; then
98    # In Java code, '...getResourceAsStream("build.properties")'
99    # needs up to be in the right directory when run
100    pushd "$gsdl3path" > /dev/null
101
102    "$javapath" $opt_properties org.greenstone.server.Server3 "$GSDL3SRCHOME" $serverlang
103
104    popd > /dev/null
105fi
106
Note: See TracBrowser for help on using the browser.