source: trunk/gli/Install.sh@ 4528

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

My installation is complete message is better than yours.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 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 echo "A Greenstone installation has been detected at ${gsdlhome}."
78 echo "To use this Greenstone installation with the Gatherer hit enter."
79 echo "To use an alternative Greenstone installation enter the path to"
80 echo "that installation now and hit enter"
81 printf "%s" "> "
82 read ans
83 if [ "$ans" != "" ] ; then
84 gsdlhome="$ans"
85 fi
86else
87 echo "No Greenstone installation could be detected. If you have Greenstone"
88 echo "installed please enter the full path to your gsdl directory and hit"
89 echo "enter. If you don't have Greenstone installed please exit this"
90 echo "installation script by hitting ctrl-c and install Greenstone before"
91 echo "installing the Gatherer."
92 printf "%s" "> "
93 read ans
94 gsdlhome="$ans"
95fi
96# check the the given greenstone installation looks ok
97if [ ! -x "${gsdlhome}/bin/script/import.pl" ] ; then
98 echo "The Greenstone installation at ${gsdlhome} does not"
99 echo "appear to be complete. Try reinstalling Greenstone then running"
100 echo "the install script again."
101 exit 1
102fi
103
104
105# ask the installer for the http path to their greenstone installation
106echo "Please enter the http path to your Greenstone installation's"
107echo "library cgi program. Typically this might be"
108echo "http://localhost/cgi-bin/library,"
109echo "or http://localhost:8080/cgi-bin/library,"
110echo "or http://127.0.0.1/cgi-bin/library,"
111echo "or http://your-computer-name/cgi-bin/library,"
112echo "or http://nnn.nnn.nnn.nn/cgi-bin/library."
113printf "%s" "> "
114read ans
115librarypath="$ans"
116# don't include leading "http://" or trailing "library" in library path
117librarypath=`echo "$librarypath" | sed 's|^http://||'`
118librarypath=`echo "$librarypath" | sed 's|library$||'`
119
120# finally, edit the Gatherer shell script
121sed "s|\*\*GSDLHOME\*\*|${gsdlhome}|" Gatherer > tmp123.txt && mv tmp123.txt Gatherer
122sed "s|\*\*LIBRARYPATH\*\*|${librarypath}|" Gatherer > tmp123.txt && mv tmp123.txt Gatherer
123
124chmod u+x Gatherer
125
126echo "Greenstone Librarian Interface - Installation Complete!"
127
128exit 0
Note: See TracBrowser for help on using the repository browser.