#!/bin/sh ## Install.sh -- Install Greenstone cmd_cp="cp" cmd_cpr="cp -r" cmd_chmod="chmod" cmd_mkdir="mkdir -p" cmd_ln="ln -s" cmd_mv="mv" cmd_rm="rm -i" cmd_rmr="rm -r" thisdir=`pwd` cd .. cd_dir=`pwd` cd "$thisdir" # script must be run from within cdrom/unix directory if [ ! -f "${thisdir}/Install.sh" ]; then echo "Install.sh must be run from the directory in which it resides" echo "Greenstone was not installed" exit 1 fi # check that various important directories are on the cd if [ ! -d "${cd_dir}/gsdl" ]; then echo echo "ERROR: Could not locate ${cd_dir}/gsdl" echo "Greenstone was not installed" exit 1 fi if [ ! -d "${cd_dir}/Unix/bin/linux" ]; then echo echo "ERROR: Could not locate ${cd_dir}/Unix/bin/linux" echo "Greenstone was not installed" exit 1 fi # install to /usr/local by default if user is "root", otherwise # default to users home directory gsdlos=`uname | tr A-Z a-z` if [ "$gsdlos" = "linux" ]; then logname=`whoami` else logname="" fi if [ "$logname" = "" ]; then logname=`logname` fi gsdlhome="/home/${logname}" if [ "$logname" = "root" ]; then gsdlhome="/usr/local" fi # get gsdlhome msg="This script will install Greenstone on your system. You may want to skim through the Install.pdf document that resides in the docs directory on this cd-rom before continuing with the installation. Note that when prompted for input, hitting \"enter\" will select the default (given in square brackets [] at the end of each question). If you're unsure which option to select, use the default. Note also that Install.sh prints out information on any commands it runs on your system in the form \"--> Install.sh: [command]\". It is assumed throughout this installation procedure that you have a webserver installed on your system. For later reference the output of this install script will be recorded in a file called INSTALL_RECORD in the directory into which you choose to install Greenstone. Continue? [y]" echo "$msg" printf "%s" "> " read ans log="${log}${msg} > $ans " if [ "$ans" != "" ] && [ "$ans" != "y" ]; then echo "Greenstone was not installed" exit 0 fi msg=" Which directory should Greenstone be installed to? Make sure that this directory is on a partition with sufficient free disk space for the installation option you intend selecting. " if [ "$gsdlos" = "linux" ]; then msg="${msg}--A standard linux binary installation requires approximately 50Mb of free disk space (not including additional collections). " fi msg="${msg}--Compiling Greenstone from source code requires approximately 155Mb of free disk space (not including additional collections). --Optional Greenstone demonstration collections may require up to 200Mb of free disk space (you'll be told the size of individual collections before you install them) Enter directory to install Greenstone into. A gsdl directory will be created in this directory. [${gsdlhome}]" echo "$msg" printf "%s" "> " read ans log="${log}${msg} > $ans " if [ "$ans" != "" ]; then gsdlhome="$ans" fi if [ ! -d "$gsdlhome" ]; then msg=" Warning: The ${gsdlhome} directory does not exist. Create it? [y]" echo "$msg" printf "%s" "> " read ans log="${log}${msg} > $ans " if [ "$ans" = "" ]; then ans="y" fi if [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_mkdir \"$gsdlhome\"]" echo "$msg" log="${log}${msg} " $cmd_mkdir "$gsdlhome" if [ ! -d "$gsdlhome" ]; then echo "ERROR: failed to create $gsdlhome directory" echo "Greenstone was not installed" exit 1 fi else echo "Greenstone was not installed" exit 0 fi fi # from now on $gsdlhome includes the "/gsdl" gsdlhome="${gsdlhome}/gsdl" msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}\"]" echo "$msg" log="${log}${msg} " $cmd_mkdir "$gsdlhome" if [ ! -d "$gsdlhome" ]; then echo "ERROR: failed to create $gsdlhome directory" echo "Greenstone was not installed" exit 1 fi # set permissions on gsdlhome directory msg="--> Install.sh: [$cmd_chmod u+rwx \"${gsdlhome}\"]" echo "$msg" log="${log}${msg} " $cmd_chmod u+rwx "$gsdlhome" # create initial Uninstall.sh cd "$gsdlhome" echo "#!/bin/sh" > Uninstall.sh echo "" >> Uninstall.sh echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh echo "read ans" >> Uninstall.sh echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh echo "fi" >> Uninstall.sh $cmd_chmod u+x Uninstall.sh cd "$thisdir" # create initial INSTALL_RECORD echo "$log" >> "${gsdlhome}/INSTALL_RECORD" msg=" If this installation fails or is cancelled, run the uninstall script (${gsdlhome}/Uninstall.sh) to clean up the partial installation. Continue? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" != "" ] && [ "$ans" != "y" ]; then msg="Greenstone was not installed" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" exit 0 fi msg=" Installing Greenstone directory structure to ${gsdlhome}" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" # copy gsdl directory across msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/gsdl/\"* \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/gsdl/"* "$gsdlhome" # copy setup shell scripts across too msg="--> Install.sh: [$cmd_cp \"${cd_dir}/src/Unix/setup.\"* \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cp "${cd_dir}/src/Unix/setup."* "$gsdlhome" # make sure we have a tmp directory if [ ! -d "$gsdlhome/tmp" ]; then msg="--> Install.sh: [$cmd_mkdir \"$gsdlhome/tmp\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mkdir "$gsdlhome/tmp" fi # make collect directory writable so we can install collections msg="--> Install.sh: [$cmd_chmod u+rwx \"$gsdlhome/collect\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod u+rwx "$gsdlhome/collect" # which collections do we want cd "${cd_dir}/collect" msg=" The Greenstone demonstration collection has been installed. Would you like to install any other collections from the installation cd-rom? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg=" Install the greenstone archive (gsarch) - 1Mb? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/gsarch\" \"${gsdlhome}/collect\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/gsarch" "${gsdlhome}/collect" fi msg=" Install the MSWord and PDF demonstration collection (wordpdf) - 3Mb? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/wordpdf\" \"${gsdlhome}/collect\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/wordpdf" "${gsdlhome}/collect" fi msg=" Install the Chinese demonstration collection (chinese) - 1Mb? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/chinese\" \"${gsdlhome}/collect\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/chinese" "${gsdlhome}/collect" fi msg=" Install the food and nutrition library (fnl) - 175 Mb? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/fnl\" \"${gsdlhome}/collect\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/fnl" "${gsdlhome}/collect" fi msg=" Install the language extraction demonstration collection (folktale) - 2Mb? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/folktale\" \"${gsdlhome}/collect\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/folktale" "${gsdlhome}/collect" fi fi # set permissions msg=" Setting permissions ... --> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod -R u+rw "$gsdlhome" # gsdl/etc needs to be globally writable msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/etc\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod -R a+w "$gsdlhome/etc" # should gsdl/collect and gsdl/tmp be globally writable? msg=" In order for end-user collection building to be enabled the Greenstone cgi program must be able to write to the ${gsdlhome}/collect and ${gsdlhome}/tmp directories. On most systems this means they must be globally writable. Make these directories globally writable? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/collect\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod -R a+w "$gsdlhome/collect" msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/tmp\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod -R a+w "$gsdlhome/tmp" fi # binaries or source code? compile="yes" if [ "$gsdlos" = "linux" ]; then msg=" You may either install pre-compiled, statically linked linux [b]inaries or install and [c]ompile the Greenstone source code" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" found=no while [ "$found" = "no" ]; do msg="Enter \"[b]\" or \"c\"" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "b" ]; then compile="no" # install binaries msg=" Installing linux binaries --> Install.sh: [$cmd_cpr \"${cd_dir}/Unix/bin/linux\" \"${gsdlhome}/bin\" ]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/Unix/bin/linux" "${gsdlhome}/bin" msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/bin/linux/\"*]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+x "${gsdlhome}/bin/linux/"* msg="--> Install.sh: [$cmd_chmod -R u+rw \"${gsdlhome}/bin/linux\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod -R u+rw "${gsdlhome}/bin/linux" # move library executable to cgi-bin msg="--> Install.sh: [$cmd_mv \"${gsdlhome}/bin/linux/library\" \"${gsdlhome}/cgi-bin\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mv "${gsdlhome}/bin/linux/library" "${gsdlhome}/cgi-bin" found="yes" elif [ "$ans" = "c" ]; then found="yes" fi done fi if [ "$compile" = "yes" ]; then # install source msg=" Installing source code --> Install.sh [$cmd_cpr \"${cd_dir}/src/lib\" \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/src/lib" "$gsdlhome" msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/packages\" \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/src/packages" "$gsdlhome" msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/src\" \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/src/src" "$gsdlhome" msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/Unix/\"* \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/src/Unix/"* "$gsdlhome" msg="--> Install.sh [$cmd_cp \"${cd_dir}/src/Install.txt\" \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cp "${cd_dir}/src/Install.txt" "$gsdlhome" msg="--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod -R u+rw "$gsdlhome" msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/configure\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+x "${gsdlhome}/configure" msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/packages/yaz/configure\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+x "${gsdlhome}/packages/yaz/configure" # compile it msg="--> Install.sh: [cd $gsdlhome]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" cd "$gsdlhome" msg="configuring ... --> Install.sh: [./configure]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" ./configure msg="compiling ... --> Install.sh: [make]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" make msg="installing ... --> Install.sh: [make install]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" make install msg="--> Install.sh: [cd $thisdir]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" cd "$thisdir" # check that things compiled ok if [ ! -f "${gsdlhome}/cgi-bin/library" ]; then msg=" ERROR: Compilation failed Greenstone was not installed successfully Run the uninstall script (${gsdlhome}/Uninstall.sh) to clean up the partial installation." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" exit 1 fi fi # try to find out hostname if [ "$gsdlos" = "linux" ]; then hostname=`hostname -f` if [ "$hostname" = "" ]; then hostname=`hostname -i` fi fi if [ "$hostname" = "" ]; then hostname=`hostname` fi if [ "$hostname" = "" ]; then hostname="your-computer-name" fi # get cgi-bin directory msg=" Greenstone needs a valid cgi executable directory (normally called cgi-bin on unix systems) from which to run. This may be either: 1. The default Greenstone cgi-bin directory (${gsdlhome}/cgi-bin). If you use the Greenstone default you will need to configure your webserver to treat this directory as a cgi executable directory. For the Apache webserver you use the ScriptAlias directive to do this (details of how to configure your webserver will be displayed at the end of this installation procedure)." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" if [ "$logname" != "root" ]; then msg=" Note that you will probably need help from your system administrator to reconfigure your webserver." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" fi msg=" 2. An existing cgi-bin directory. Normally a cgi-bin directory is created when your webserver is installed. Typically, this might be /home/httpd/cgi-bin, or /usr/local/apache/cgi-bin, or /var/lib/apache/cgi-bin." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" if [ "$logname" != "root" ]; then msg=" Many systems also allow individual users to have their own cgi-bin in /home/username/public_html/cgi-bin." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" fi found=no remind_cgi="no" remind_cgi_nomove="no" while [ "$found" = "no" ]; do msg="Enter \"[1]\" or \"2\"" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "1" ]; then found="option1" cgi_bin="${gsdlhome}/cgi-bin" # default gsdl cgi-bin, do nothing msg=" Don't forget to configure your webserver to treat $cgi_bin as a cgi executable directory. Don't worry, you'll be reminded of this again at the end of the installation procedure" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" remind_cgi="yes" elif [ "$ans" = "2" ]; then found="option2" # external cgi-bin msg=" Enter existing cgi executable directory [/usr/local/apache/cgi-bin]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ]; then cgi_bin="/usr/local/apache/cgi-bin" else cgi_bin="$ans" fi if [ ! -d "$cgi_bin" ]; then msg="Warning: The ${cgi_bin} directory does not exist. Create it? [y]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_mkdir \"$cgi_bin\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mkdir "$cgi_bin" if [ -d "$cgi_bin" ]; then msg="Don't forget to configure your webserver to treat $cgi_bin as a cgi executable directory. Don't worry, you'll be reminded of this again at the end of the installation procedure" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" remind_cgi="yes" else msg="ERROR: failed to create $cgi_bin directory Greenstone installation failed. Run the uninstall script (${gsdlhome}/Uninstall.sh) to clean up the partial installation." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" exit 1 fi fi fi if [ ! -w "$cgi_bin" ]; then msg=" Unable to write to $cgi_bin directory. You will need to copy the contents of ${gsdlhome}/cgi-bin to $cgi_bin after this installation is completed. You'll be reminded of this again at the end of the installation procedure." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" remind_cgi_nomove="yes" else # install cgi-bin stuff (update the uninstall script first) cd "$gsdlhome" echo "#!/bin/sh" > Uninstall.sh echo "" >> Uninstall.sh echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> Uninstall.sh echo "$cmd_rm \"${cgi_bin}/library\"" >> Uninstall.sh echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh echo "read ans" >> Uninstall.sh echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh echo "fi" >> Uninstall.sh $cmd_chmod u+x Uninstall.sh cd "$thisdir" msg=" Installing Greenstone cgi programs in $cgi_bin --> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/gsdlsite.cfg\" \"$cgi_bin\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mv "${gsdlhome}/cgi-bin/gsdlsite.cfg" "$cgi_bin" msg="--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/library\" \"$cgi_bin\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mv "${gsdlhome}/cgi-bin/library" "$cgi_bin" fi fi done # web address of cgi-bin web_cgi="http://${hostname}/cgi-bin" if [ "$found" = "option1" ]; then web_cgi="http://${hostname}/gsdl/cgi-bin" fi msg=" Please enter the web address of the $cgi_bin directory. Typically this might be http://localhost/cgi-bin, or http://127.0.0.1/cgi-bin, or http://your-computer-name/cgi-bin, or http://nnn.nnn.nnn.nn/cgi-bin. [$web_cgi]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" != "" ]; then web_cgi="$ans" fi # get public_html directory msg=" In order for Greenstone to run, the $gsdlhome directory and all it contains must be accessible from the web. To make this happen you may either: 1. Configure your webserver so that $gsdlhome is itself accessible from the web." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" if [ "$logname" != "root" ]; then msg=" Note that you will probably need help from your system administrator to reconfigure your webserver." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" fi msg=" 2. Provide an existing web accessible directory from which a symbolic link (ln -s) will be made to $gsdlhome. When your server was installed a web accessible directory will have been created (the Apache webserver uses the DocumentRoot directive to define this directory). Typically this directory might be /home/httpd/html, or /usr/local/apache/htdocs, or /var/lib/apache/htdocs." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" if [ "$logname" != "root" ]; then msg=" Many systems also allow individual users to have their own web accessible directory in /home/username/public_html." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" fi msg=" Note that your web server will need to be configured to allow symbolic links from within this directory. For the Apache server that means this directory must be configured with the SymLinksIfOwnerMatch or FollowSymLinks option (most Apache installations are configured this way by default)." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" found="no" remind_ph="no" remind_ph_nolink="no" while [ "$found" = "no" ]; do msg="Enter \"[1]\" or \"2\"" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "1" ]; then found="yes" public_html="$gsdlhome" # no link msg=" Don't forget to configure your webserver to make $gsdlhome accessible from the web. You'll be reminded of this again at the end of this installation procedure." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" remind_ph="yes" elif [ "$ans" = "2" ]; then found="yes" # external public_html echo public_html="/home/${logname}/public_html" if [ "$logname" = "root" ]; then public_html="/usr/local/apache/htdocs" fi msg="Enter directory that is also accessible from the web [${public_html}]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" != "" ]; then public_html="$ans" fi # create link to gsdl (and update Uninstall.sh) if [ -w "$public_html" ]; then cd "$gsdlhome" echo "#!/bin/sh" > Uninstall.sh echo "" >> Uninstall.sh echo "$cmd_rm \"$public_html/gsdl\"" >> Uninstall.sh echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> Uninstall.sh echo "$cmd_rm \"${cgi_bin}/library\"" >> Uninstall.sh echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh echo "read ans" >> Uninstall.sh echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh echo "fi" >> Uninstall.sh $cmd_chmod u+x Uninstall.sh cd "$thisdir" msg="--> Install.sh: [cd \"$public_html\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" cd "$public_html" msg="--> Install.sh: [$cmd_ln \"$gsdlhome\" gsdl]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_ln "$gsdlhome" gsdl msg="--> Install.sh: [cd \"$thisdir\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" cd "$thisdir" else msg=" Unable to write to $public_html directory. You will need to create a link called gsdl from $public_html to $gsdlhome after this installation is completed. You'll be reminded of this again at the end of the installation procedure." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" old_ph=$public_html remind_ph_nolink="yes" fi public_html="${public_html}/gsdl" fi done # get httpprefix msg=" Enter the web address of the $public_html directory. This may be a relative url (e.g. \"/gsdl\") or a complete url (e.g. \"http://${hostname}/gsdl\") [/gsdl]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" ">" httpprefix="/gsdl" read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" != "" ]; then httpprefix="$ans" fi # get initial password msg=" In order to use end-user collection building or to access certain parts of the administration pages you must have a password. A user with the username \"admin\" will be created for you with the password you provide (i.e. to enter any pages requiring user authentication enter the \"admin\" username and the password you set here).\n"; echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" pw=`${gsdlhome}/bin/${gsdlos}/getpw` tmp="[admin] true administrator,colbuilder ${pw} admin ----------------------------------------------------------------------" echo "$tmp" | ${gsdlhome}/bin/${gsdlos}/txt2db "${gsdlhome}/etc/users.db" $cmd_chmod a+rw "${gsdlhome}/etc/users.db" # edit gsdlsite.cfg cd "$cgi_bin" sed "s|\(gsdlhome *\)[^ ]*|\1${gsdlhome}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg sed "s|#*\(httpprefix *\)[^ ]*|\1${httpprefix}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg sed "s|\(httpimg *\)[^ ]*|\1${httpprefix}/images|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg msg=" Greenstone installation completed successfully." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" if [ "$remind_cgi" = "yes" ]; then msg=" * Don't forget to configure your webserver to treat $cgi_bin as a cgi executable directory." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" apache_web_cgi=`echo "$web_cgi" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"` cgi_bin_slash=`echo "$cgi_bin" | sed "s|/*$|/|"` cgi_bin_noslash=`echo "$cgi_bin" | sed "s|/*$||"` msg=" For the Apache webserver this means adding the following ScriptAlias directive to your httpd.conf configuration file. ScriptAlias ${apache_web_cgi} \"${cgi_bin_slash}\" AllowOverride None Options None Order allow,deny Allow from all " echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" fi if [ "$remind_cgi_nomove" = "yes" ]; then msg=" * Don't forget to move the contents of ${gsdlhome}/cgi-bin to $cgi_bin " echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" fi if [ "$remind_ph" = "yes" ]; then msg=" * Don't forget to configure your webserver to treat $gsdlhome as a web accessible directory." echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" apache_httpprefix=`echo "$httpprefix" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"` public_html_slash=`echo "$public_html" | sed "s|/*$|/|"` public_html_noslash=`echo "$public_html" | sed "s|/*$||"` msg=" For the Apache webserver this means adding the following Alias directive to your httpd.conf configuration file. Alias ${apache_httpprefix} \"${public_html_slash}\" Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all " echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" fi if [ "$remind_ph_nolink" = "yes" ]; then msg=" * Don't forget to create a link called gsdl from $old_ph to ${gsdlhome}. " echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" fi msg="The output of this script has been recorded for you at ${gsdlhome}/INSTALL_RECORD. You may remove Greenstone from your system at any time by running the ${gsdlhome}/Uninstall.sh script. Access Greenstone by pointing a web browser at ${web_cgi}/library " echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" exit 0