#!/bin/sh ## Install.sh -- Install the Gatherer # script must be run from within the directory in which it lives thisdir=`pwd` if [ ! -f "${thisdir}/Install.sh" ]; then echo "Install.sh must be run from the directory in which it resides" exit 1 fi # see if we can find java java="java" # if JAVAHOME is set we'll use it to determine where java lives, otherwise # we just hope it's on the search path if [ "$JAVAHOME" != "" ] ; then java="$JAVAHOME/bin/java" else java=`which java 2> /dev/null` if [ ! -x "$java" ]; then echo "Failed to locate Java. You must install a java runtime environment" echo "(version 1.4 or greater) before installing the Gatherer." exit 1 fi fi javaversion=`$java -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'` jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'` jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'` jok=1 if [ $jvmajor -lt 1 ] ; then jok=0 fi if [ $jvmajor -eq 1 ] && [ $jvminor -lt 3 ] ; then jok=0 fi if [ $jok -eq 0 ] ; then echo "The version of the java runtime environment you have installed is too" echo "old to run the Gatherer. Please install a new version of the JRE (version" echo "1.4 or newer) and rerun this installation." exit 1 fi # make sure perl is ok perl=`which perl 2> /dev/null` echo "perl: $perl" if [ ! -x "$perl" ] ; then echo "The Gatherer requires perl in order to operate but this installation" echo "could not detect perl on your system. Please ensure that perl is installed" echo "and is on your search path then rerun this installation script." exit 1 fi # Try to find greenstone - greenstone defaults to being installed to # either /usr/local/gsdl (if installed as root) or ~/gsdl. We'll look # there first gsdlhome= if [ -d "/usr/local/gsdl" ] ; then gsdlhome="/usr/local/gsdlhome" fi gsdlos=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` if [ "$gsdlos" = "linux" ]; then logname=`whoami` else logname=`logname` fi if [ -d "/home/${logname}/gsdl" ] ; then gsdlhome="/home/${logname}/gsdl" fi if [ "$GSDLHOME" != "" ] ; then gsdlhome=$GSDLHOME fi if [ "$gsdlhome" != "" ] ; then echo "A Greenstone installation has been detected at ${gsdlhome}." echo "To use this Greenstone installation with the Gatherer hit enter." echo "To use an alternative Greenstone installation enter the path to" echo "that installation now and hit enter" printf "%s" "> " read ans if [ "$ans" != "" ] ; then gsdlhome="$ans" fi else echo "No Greenstone installation could be detected. If you have Greenstone" echo "installed please enter the full path to your gsdl directory and hit" echo "enter. If you don't have Greenstone installed please exit this" echo "installation script by hitting ctrl-c and install Greenstone before" echo "installing the Gatherer." printf "%s" "> " read ans gsdlhome="$ans" fi # check the the given greenstone installation looks ok if [ ! -x "${gsdlhome}/bin/script/import.pl" ] ; then echo "The Greenstone installation at ${gsdlhome} does not" echo "appear to be complete. Try reinstalling Greenstone then running" echo "the install script again." exit 1 fi # ask the installer for the http path to their greenstone installation echo "Please enter the http path to your Greenstone installation's" echo "library cgi program. Typically this might be" echo "http://localhost/cgi-bin/library," echo "or http://localhost:8080/cgi-bin/library," echo "or http://127.0.0.1/cgi-bin/library," echo "or http://your-computer-name/cgi-bin/library," echo "or http://nnn.nnn.nnn.nn/cgi-bin/library." printf "%s" "> " read ans librarypath="$ans" # don't include leading "http://" or trailing "library" in library path librarypath=`echo "$librarypath" | sed 's|^http://||'` librarypath=`echo "$librarypath" | sed 's|library$||'` # finally, edit the Gatherer shell script sed "s|\*\*GSDLHOME\*\*|${gsdlhome}|" Gatherer > tmp123.txt && mv tmp123.txt Gatherer sed "s|\*\*LIBRARYPATH\*\*|${librarypath}|" Gatherer > tmp123.txt && mv tmp123.txt Gatherer chmod u+x Gatherer echo "Greenstone Librarian Interface - Installation Complete!" echo "Change to the directory 'gli' and run './Gatherer' to start the application." exit 0