[4293] | 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
|
---|
| 7 | thisdir=`pwd`
|
---|
| 8 | if [ ! -f "${thisdir}/Install.sh" ]; then
|
---|
| 9 | echo "Install.sh must be run from the directory in which it resides"
|
---|
| 10 | exit 1
|
---|
| 11 | fi
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | # see if we can find java
|
---|
| 15 | java="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
|
---|
| 19 | if [ "$JAVAHOME" != "" ] ; then
|
---|
| 20 | java="$JAVAHOME/bin/java"
|
---|
| 21 | else
|
---|
| 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
|
---|
| 28 | fi
|
---|
| 29 |
|
---|
| 30 | javaversion=`$java -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
|
---|
| 31 | jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
|
---|
| 32 | jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
|
---|
| 33 | jok=1
|
---|
| 34 | if [ $jvmajor -lt 1 ] ; then
|
---|
| 35 | jok=0
|
---|
| 36 | fi
|
---|
| 37 | if [ $jvmajor -eq 1 ] && [ $jvminor -lt 3 ] ; then
|
---|
| 38 | jok=0
|
---|
| 39 | fi
|
---|
| 40 | if [ $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
|
---|
| 45 | fi
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | # make sure perl is ok
|
---|
| 49 | perl=`which perl 2> /dev/null`
|
---|
| 50 | echo "perl: $perl"
|
---|
| 51 | if [ ! -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
|
---|
| 56 | fi
|
---|
| 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
|
---|
| 62 | gsdlhome=
|
---|
| 63 | if [ -d "/usr/local/gsdl" ] ; then
|
---|
| 64 | gsdlhome="/usr/local/gsdlhome"
|
---|
| 65 | fi
|
---|
| 66 | gsdlos=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
---|
| 67 | if [ "$gsdlos" = "linux" ]; then
|
---|
| 68 | logname=`whoami`
|
---|
| 69 | else
|
---|
| 70 | logname=`logname`
|
---|
| 71 | fi
|
---|
| 72 | if [ -d "/home/${logname}/gsdl" ] ; then
|
---|
| 73 | gsdlhome="/home/${logname}/gsdl"
|
---|
| 74 | fi
|
---|
| 75 |
|
---|
| 76 | if [ "$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
|
---|
| 86 | else
|
---|
| 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"
|
---|
| 95 | fi
|
---|
| 96 | # check the the given greenstone installation looks ok
|
---|
| 97 | if [ ! -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
|
---|
| 102 | fi
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 | # ask the installer for the http path to their greenstone installation
|
---|
| 106 | echo "Please enter the http path to your Greenstone installation's"
|
---|
| 107 | echo "library cgi program. Typically this might be"
|
---|
| 108 | echo "http://localhost/cgi-bin/library,"
|
---|
| 109 | echo "or http://localhost:8080/cgi-bin/library,"
|
---|
| 110 | echo "or http://127.0.0.1/cgi-bin/library,"
|
---|
| 111 | echo "or http://your-computer-name/cgi-bin/library,"
|
---|
| 112 | echo "or http://nnn.nnn.nnn.nn/cgi-bin/library."
|
---|
| 113 | printf "%s" "> "
|
---|
| 114 | read ans
|
---|
| 115 | librarypath="$ans"
|
---|
| 116 | # don't include leading "http://" or trailing "library" in library path
|
---|
| 117 | librarypath=`echo "$librarypath" | sed 's|^http://||'`
|
---|
| 118 | librarypath=`echo "$librarypath" | sed 's|library$||'`
|
---|
| 119 |
|
---|
| 120 | # finally, edit the Gatherer shell script
|
---|
| 121 | sed "s|\*\*GSDLHOME\*\*|${gsdlhome}|" Gatherer > tmp123.txt && mv tmp123.txt Gatherer
|
---|
| 122 | sed "s|\*\*LIBRARYPATH\*\*|${librarypath}|" Gatherer > tmp123.txt && mv tmp123.txt Gatherer
|
---|
| 123 |
|
---|
| 124 | chmod u+x Gatherer
|
---|
| 125 |
|
---|
[4528] | 126 | echo "Greenstone Librarian Interface - Installation Complete!"
|
---|
| 127 |
|
---|
[4293] | 128 | exit 0
|
---|