source: trunk/gli/Install.sh@ 4620

Last change on this file since 4620 was 4575, checked in by jmt12, 21 years ago

Added test to see if GSDLHOME is set, and gave an even better installation complete message that tells you what to do next.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1#!/bin/sh
2
3## Install.sh -- Install the Gatherer
4
5
6# script must be run from within the directory in which it lives
7thisdir=`pwd`
8if [ ! -f "${thisdir}/Install.sh" ]; then
9 echo "Install.sh must be run from the directory in which it resides"
10 exit 1
11fi
12
13
14# see if we can find java
15java="java"
16
17# if JAVAHOME is set we'll use it to determine where java lives, otherwise
18# we just hope it's on the search path
19if [ "$JAVAHOME" != "" ] ; then
20 java="$JAVAHOME/bin/java"
21else
22 java=`which java 2> /dev/null`
23 if [ ! -x "$java" ]; then
24 echo "Failed to locate Java. You must install a java runtime environment"
25 echo "(version 1.4 or greater) before installing the Gatherer."
26 exit 1
27 fi
28fi
29
30javaversion=`$java -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
31jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
32jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
33jok=1
34if [ $jvmajor -lt 1 ] ; then
35 jok=0
36fi
37if [ $jvmajor -eq 1 ] && [ $jvminor -lt 3 ] ; then
38 jok=0
39fi
40if [ $jok -eq 0 ] ; then
41 echo "The version of the java runtime environment you have installed is too"
42 echo "old to run the Gatherer. Please install a new version of the JRE (version"
43 echo "1.4 or newer) and rerun this installation."
44 exit 1
45fi
46
47
48# make sure perl is ok
49perl=`which perl 2> /dev/null`
50echo "perl: $perl"
51if [ ! -x "$perl" ] ; then
52 echo "The Gatherer requires perl in order to operate but this installation"
53 echo "could not detect perl on your system. Please ensure that perl is installed"
54 echo "and is on your search path then rerun this installation script."
55 exit 1
56fi
57
58
59# Try to find greenstone - greenstone defaults to being installed to
60# either /usr/local/gsdl (if installed as root) or ~/gsdl. We'll look
61# there first
62gsdlhome=
63if [ -d "/usr/local/gsdl" ] ; then
64 gsdlhome="/usr/local/gsdlhome"
65fi
66gsdlos=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
67if [ "$gsdlos" = "linux" ]; then
68 logname=`whoami`
69else
70 logname=`logname`
71fi
72if [ -d "/home/${logname}/gsdl" ] ; then
73 gsdlhome="/home/${logname}/gsdl"
74fi
75
76if [ "$GSDLHOME" != "" ] ; then
77 gsdlhome=$GSDLHOME
78fi
79
80if [ "$gsdlhome" != "" ] ; then
81 echo "A Greenstone installation has been detected at ${gsdlhome}."
82 echo "To use this Greenstone installation with the Gatherer hit enter."
83 echo "To use an alternative Greenstone installation enter the path to"
84 echo "that installation now and hit enter"
85 printf "%s" "> "
86 read ans
87 if [ "$ans" != "" ] ; then
88 gsdlhome="$ans"
89 fi
90else
91 echo "No Greenstone installation could be detected. If you have Greenstone"
92 echo "installed please enter the full path to your gsdl directory and hit"
93 echo "enter. If you don't have Greenstone installed please exit this"
94 echo "installation script by hitting ctrl-c and install Greenstone before"
95 echo "installing the Gatherer."
96 printf "%s" "> "
97 read ans
98 gsdlhome="$ans"
99fi
100# check the the given greenstone installation looks ok
101if [ ! -x "${gsdlhome}/bin/script/import.pl" ] ; then
102 echo "The Greenstone installation at ${gsdlhome} does not"
103 echo "appear to be complete. Try reinstalling Greenstone then running"
104 echo "the install script again."
105 exit 1
106fi
107
108
109# ask the installer for the http path to their greenstone installation
110echo "Please enter the http path to your Greenstone installation's"
111echo "library cgi program. Typically this might be"
112echo "http://localhost/cgi-bin/library,"
113echo "or http://localhost:8080/cgi-bin/library,"
114echo "or http://127.0.0.1/cgi-bin/library,"
115echo "or http://your-computer-name/cgi-bin/library,"
116echo "or http://nnn.nnn.nnn.nn/cgi-bin/library."
117printf "%s" "> "
118read ans
119librarypath="$ans"
120# don't include leading "http://" or trailing "library" in library path
121librarypath=`echo "$librarypath" | sed 's|^http://||'`
122librarypath=`echo "$librarypath" | sed 's|library$||'`
123
124# finally, edit the Gatherer shell script
125sed "s|\*\*GSDLHOME\*\*|${gsdlhome}|" Gatherer > tmp123.txt && mv tmp123.txt Gatherer
126sed "s|\*\*LIBRARYPATH\*\*|${librarypath}|" Gatherer > tmp123.txt && mv tmp123.txt Gatherer
127
128chmod u+x Gatherer
129
130echo "Greenstone Librarian Interface - Installation Complete!"
131echo "Change to the directory 'gli' and run './Gatherer' to start the application."
132
133exit 0
Note: See TracBrowser for help on using the repository browser.