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

Last change on this file since 27830 was 27830, checked in by davidb, 11 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
RevLine 
[19937]1#!/bin/bash
[13235]2serverlang=en
3
[15131]4java_min_version=1.4.0_00
5
[18559]6autoset_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]26check_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]43echo "Greenstone 3 Server"
[18559]44echo "Copyright (C) 2009, New Zealand Digital Library Project, University Of Waikato"
[13235]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
[14727]55if [ -z "$gsdl3path" ]; then
[20187]56 autoset_gsdl_home "gsdl3path"
[13235]57fi
58
[20188]59# Setup Greenstone3
60pushd $gsdl3path > /dev/null
61source ./gs3-setup.sh
62popd > /dev/null
[13235]63
[27830]64check_gsdl3home_writable
65
66opt_properties=
67if [ $gsdl3home_isreadonly = 1 ] ; then
68 opt_properties="-Dgsdl3home.isreadonly=true -Dgsdl3.writablehome=$gsdl3_writablehome"
69fi
70
[14727]71# JRE_HOME or JAVA_HOME must be set correctly to run this program
[20059]72HINT="`pwd`/packages/jre"
73javapath=`search4j -p "$HINT" -m $java_min_version -e`
[15132]74if [ "$?" == "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]82fi
[13235]83
Note: See TracBrowser for help on using the repository browser.