source: main/trunk/greenstone3/gs3-server.sh@ 27830

Last change on this file since 27830 was 27830, checked in by davidb, 8 years ago

Additional work to help support Greenstone running off a read-only medium, such as a DVD

  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
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 fi
41}
42
43echo "Greenstone 3 Server"
44echo "Copyright (C) 2009, New Zealand Digital Library Project, University Of Waikato"
45echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
46echo "This is free software, and you are welcome to redistribute it"
47
48## -------- Run the Greenstone 3 Server --------
49
50
51## ---- Determine GSDL3SRCHOME ----
52gsdl3path=
53
54# Some users may set the above line manually
55if [ -z "$gsdl3path" ]; then
56 autoset_gsdl_home "gsdl3path"
57fi
58
59# Setup Greenstone3
60pushd $gsdl3path > /dev/null
61source ./gs3-setup.sh
62popd > /dev/null
63
64check_gsdl3home_writable
65
66opt_properties=
67if [ $gsdl3home_isreadonly = 1 ] ; then
68 opt_properties="-Dgsdl3home.isreadonly=true -Dgsdl3.writablehome=$gsdl3_writablehome"
69fi
70
71# JRE_HOME or JAVA_HOME must be set correctly to run this program
72HINT="`pwd`/packages/jre"
73javapath=`search4j -p "$HINT" -m $java_min_version -e`
74if [ "$?" == "0" ]; then
75 # In Java code, '...getResourceAsStream("build.properties")'
76 # needs up to be in the right directory when run
77 pushd "$gsdl3path" > /dev/null
78
79 "$javapath" $opt_properties org.greenstone.server.Server3 "$GSDL3SRCHOME" $serverlang
80
81 popd > /dev/null
82fi
83
Note: See TracBrowser for help on using the repository browser.