#!/bin/sh ## Install.sh -- Install Greenstone # set iscdrom variable to "yes" for a cdrom installation iscdrom="no" 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 "$itext1" echo "$itext0" exit 1 fi # check that various important directories are on the cd if [ ! -d "${cd_dir}/gsdl" ]; then echo echo "${itext2}${cd_dir}/gsdl" echo "$itext0" exit 1 fi if [ ! -d "${cd_dir}/Unix/bin/linux" ]; then echo echo "${itext2}${cd_dir}/Unix/bin/linux" echo "$itext0" 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 itext0="Greenstone was not installed" itext1="Install.sh must be run from the directory in which it resides" itext2="ERROR: Could not locate " itext3="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]" itext4=" Which directory should Greenstone be installed to? Make sure that this directory is on a partition with sufficient free disk space for the installation options you intend selecting." itext5=" * A linux binary installation requires approximately 40Mb." itext6=" * Compiling Greenstone from source code requires approximately 155Mb. * Optional Greenstone demonstration collections may use up to a further 200Mb (you'll be told the size of each individual collection before you install it). * Online documentation requires a further 4Mb. * Enabling Greenstone's \"CD exporting\" function requires a further 24Mb. Enter directory to install Greenstone into. A gsdl directory will be created in this directory. [${gsdlhome}]" itext34=" Enter existing cgi executable directory [/usr/local/apache/cgi-bin]" # get gsdlhome echo "$itext3" printf "%s" "> " read ans log="${log}${itext3} > $ans " if [ "$ans" != "" ] && [ "$ans" != "y" ]; then echo "$itext0" exit 0 fi msg="$itext4" if [ "$gsdlos" = "linux" ]; then msg="${msg}$itext5" fi msg="${msg}$itext6" echo "$msg" printf "%s" "> " read ans log="${log}${msg} > $ans " if [ "$ans" != "" ]; then gsdlhome="$ans" fi itext7=" Warning: The ${gsdlhome} directory does not exist. Create it? [y]" itext8="ERROR: failed to create $gsdlhome directory" if [ ! -d "$gsdlhome" ]; then echo "$itext7" printf "%s" "> " read ans log="${log}${itext7} > $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 "$itext8" echo "$itext0" exit 1 fi else echo "$itext0" exit 0 fi fi # from now on $gsdlhome includes the "/gsdl" gsdlhome="${gsdlhome}/gsdl" itext9=" If this installation fails or is cancelled, run the uninstall script (${gsdlhome}/Uninstall.sh) to clean up the partial installation. Continue? [y]" itext10=" Installing Greenstone directory structure to ${gsdlhome}" itext11=" Would you like to install the Greenstone documentation to your hard drive? The docs will use about 4Mb of space. If you choose not to install them you can still access them from within the docs directory of the cd-rom) [y]" itext12=" Would you like to install support for Greenstone's \"CD exporting\" function? This function allows you to export a Greenstone collection in a form suitable for writing to a self-installing Windows cd-rom. This package will use approximately 23Mb of disk space [n]" itext13=" The Greenstone demonstration collection has been installed. Would you like to install any other collections from the installation cd-rom? [y] (note that only the built indexes will be installed for these collections - if you require the original source documents you may manually copy them from the \"collect\" directory of the cd-rom)" itext14=" Install the Greenstone mailing list archive (gsarch) - 3Mb? [y]" itext15=" Install the MSWord/PDF/RTF/Postscript demonstration collection (wordpdf) - 4Mb? [y]" itext16=" Install the Chinese demonstration collection (chinese) - 6Mb? [y]" itext17=" Install the Humanity Development Library subset (hdlsub) - 130 Mb? [y]" itext18="Setting permissions ..." itext19=" 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]" itext20=" You may either install pre-compiled, statically linked linux [b]inaries (i386 only) or install and [c]ompile the Greenstone source code" itext21="Enter \"[b]\" or \"c\"" itext22="Installing linux binaries" itext23="Installing source code" itext24="configuring ..." itext25="compiling ..." itext26="installing ..." itext27="ERROR: Compilation failed" itext28=" 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)." itext29=" Note that you will probably need help from your system administrator to reconfigure your webserver." itext30=" 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." itext31=" Many systems also allow individual users to have their own cgi-bin in /home/username/public_html/cgi-bin." itext32="Enter \"[1]\" or \"2\"" itext33=" Don't forget to configure your webserver to treat ${gsdlhome}/cgi-bin as a cgi executable directory. Don't worry, you'll be reminded of this again at the end of the installation procedure" itext37="Run the uninstall script (${gsdlhome}/Uninstall.sh) to clean up the partial installation." itext42=" 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." itext43=" 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." itext44=" Many systems also allow individual users to have their own web accessible directory in /home/username/public_html." itext45=" 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)." itext46=" 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." msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}\"]" echo "$msg" log="${log}${msg} " $cmd_mkdir "$gsdlhome" if [ ! -d "$gsdlhome" ]; then echo "$itext8" echo "$itext0" 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_chmod -R u+rwx \"$gsdlhome\"" >> 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" echo "$itext9" echo "$itext9" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" != "" ] && [ "$ans" != "y" ]; then msg="$itext0" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" exit 0 fi echo "$itext10" echo "$itext10" >> "${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" if [ $iscdrom = "yes" ]; then # do we want docs directory? echo "$itext11" echo "$itext11" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/docs\" \"$gsdlhome\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/docs" "$gsdlhome" fi # do we want the "CD exporting" stuff? echo "$itext12" echo "$itext12" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "Y" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_chmod u+rw \"${gsdlhome}/bin\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod u+rw "${gsdlhome}/bin" msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mkdir "${gsdlhome}/bin/windows" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/Windows/bin/windows/netscape\" \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/Windows/bin/windows/netscape" "${gsdlhome}/bin/windows" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/Windows/bin/windows/Win32s\" \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/Windows/bin/windows/Win32s" "${gsdlhome}/bin/windows" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/Windows/bin/windows/net16\" \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/Windows/bin/windows/net16" "${gsdlhome}/bin/windows" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/Windows/bin/windows/net32\" \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/Windows/bin/windows/net32" "${gsdlhome}/bin/windows" msg="--> Install.sh: [$cmd_cp \"${cd_dir}/Windows/bin/windows/server.exe\" \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cp "${cd_dir}/Windows/bin/windows/server.exe" "${gsdlhome}/bin/windows" msg="--> Install.sh: [$cmd_cp \"${cd_dir}/Windows/bin/windows/gssetup.exe\" \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cp "${cd_dir}/Windows/bin/windows/gssetup.exe" "${gsdlhome}/bin/windows" msg="--> Install.sh: [$cmd_cp \"${cd_dir}/Windows/bin/windows/setpw.exe\" \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cp "${cd_dir}/Windows/bin/windows/setpw.exe" "${gsdlhome}/bin/windows" msg="--> Install.sh: [$cmd_cp \"${cd_dir}/Windows/bin/windows/Setup.exe\" \"${gsdlhome}/bin/windows\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cp "${cd_dir}/Windows/bin/windows/Setup.exe" "${gsdlhome}/bin/windows" fi # which collections do we want cd "${cd_dir}/collect" echo "$itext13" echo "$itext13" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then # gsarch echo "$itext14" echo "$itext14" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}/collect/gsarch\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mkdir "${gsdlhome}/collect/gsarch" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/gsarch/etc\" \"${gsdlhome}/collect/gsarch\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/gsarch/etc" "${gsdlhome}/collect/gsarch" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/gsarch/images\" \"${gsdlhome}/collect/gsarch\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/gsarch/images" "${gsdlhome}/collect/gsarch" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/gsarch/index\" \"${gsdlhome}/collect/gsarch\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/gsarch/index" "${gsdlhome}/collect/gsarch" fi # wordpdf echo "$itext15" echo "$itext15" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}/collect/wordpdf\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mkdir "${gsdlhome}/collect/wordpdf" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/wordpdf/etc\" \"${gsdlhome}/collect/wordpdf\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/wordpdf/etc" "${gsdlhome}/collect/wordpdf" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/wordpdf/images\" \"${gsdlhome}/collect/wordpdf\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/wordpdf/images" "${gsdlhome}/collect/wordpdf" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/wordpdf/index\" \"${gsdlhome}/collect/wordpdf\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/wordpdf/index" "${gsdlhome}/collect/wordpdf" fi # chinese echo "$itext16" echo "$itext16" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}/collect/chinese\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mkdir "${gsdlhome}/collect/chinese" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/chinese/etc\" \"${gsdlhome}/collect/chinese\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/chinese/etc" "${gsdlhome}/collect/chinese" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/chinese/images\" \"${gsdlhome}/collect/chinese\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/chinese/images" "${gsdlhome}/collect/chinese" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/chinese/index\" \"${gsdlhome}/collect/chinese\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/chinese/index" "${gsdlhome}/collect/chinese" fi # hdlsub echo "$itext17" echo "$itext17" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "y" ]; then msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}/collect/hdlsub\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mkdir "${gsdlhome}/collect/hdlsub" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/hdlsub/etc\" \"${gsdlhome}/collect/hdlsub\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/hdlsub/etc" "${gsdlhome}/collect/hdlsub" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/hdlsub/images\" \"${gsdlhome}/collect/hdlsub\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/hdlsub/images" "${gsdlhome}/collect/hdlsub" msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/hdlsub/index\" \"${gsdlhome}/collect/hdlsub\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_cpr "${cd_dir}/collect/hdlsub/index" "${gsdlhome}/collect/hdlsub" fi fi fi # set permissions msg=" $itext18 --> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"] --> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/bin/script/\"*]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod -R u+rw "$gsdlhome" $cmd_chmod a+x "${gsdlhome}/bin/script/"* # certain files in gsdl/etc need to be globally writable msg="--> Install.sh: [$cmd_chmod a+w \"$gsdlhome/etc/errout.txt\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+w "$gsdlhome/etc/errout.txt" msg="--> Install.sh: [$cmd_chmod a+w \"$gsdlhome/etc/initout.txt\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+w "$gsdlhome/etc/initout.txt" msg="--> Install.sh: [$cmd_chmod a+w \"$gsdlhome/etc/key.db\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+w "$gsdlhome/etc/key.db" msg="--> Install.sh: [$cmd_chmod a+w \"$gsdlhome/etc/users.db\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+w "$gsdlhome/etc/users.db" msg="--> Install.sh: [$cmd_chmod a+w \"$gsdlhome/etc/main.cfg\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+w "$gsdlhome/etc/main.cfg" msg="--> Install.sh: [$cmd_chmod a+w \"$gsdlhome/etc/history.db\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+w "$gsdlhome/etc/history.db" msg="--> Install.sh: [$cmd_chmod a+w \"$gsdlhome/etc/usage.txt\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_chmod a+w "$gsdlhome/etc/usage.txt" # should gsdl/collect and gsdl/tmp be globally writable? echo "$itext19" echo "$itext19" >> "${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 echo "$itext20" echo "$itext20" >> "${gsdlhome}/INSTALL_RECORD" found=no while [ "$found" = "no" ]; do echo "$itext21" echo "$itext21" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "b" ]; then compile="no" # install binaries msg=" $itext22 --> 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" # move XML.tgz to perllib/cpan and untar it msg="--> Install.sh: [$cmd_mv \"${gsdlhome}/bin/linux/XML.tgz\" \"${gsdlhome}/perllib/cpan\"]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" $cmd_mv "${gsdlhome}/bin/linux/XML.tgz" "${gsdlhome}/perllib/cpan" cd "${gsdlhome}/perllib/cpan" msg="--> Install.sh: [gzip -dc XML.tgz | tar -xf -]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" gzip -dc XML.tgz | tar -xf - found="yes" elif [ "$ans" = "c" ]; then found="yes" fi done fi if [ "$compile" = "yes" ]; then # install source msg=" $itext23 --> 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="$itext24 --> Install.sh: [./configure]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" ./configure msg="$itext25 --> Install.sh: [make]" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" make msg="$itext26 --> 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="$itext27 $itext0 $itext37" 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 echo "$itext28" echo "$itext28" >> "${gsdlhome}/INSTALL_RECORD" if [ "$logname" != "root" ]; then echo "$itext29" echo "$itext29" >> "${gsdlhome}/INSTALL_RECORD" fi echo "$itext30" echo "$itext30" >> "${gsdlhome}/INSTALL_RECORD" if [ "$logname" != "root" ]; then echo "$itext31" echo "$itext31" >> "${gsdlhome}/INSTALL_RECORD" fi found=no remind_cgi="no" remind_cgi_nomove="no" while [ "$found" = "no" ]; do echo "$itext32" echo "$itext32" >> "${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 echo "$itext33" echo "$itext33" >> "${gsdlhome}/INSTALL_RECORD" remind_cgi="yes" elif [ "$ans" = "2" ]; then found="option2" # external cgi-bin echo "$itext34" echo "$itext34" >> "${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 itext35="Warning: The ${cgi_bin} directory does not exist. Create it? [y]" itext36="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" itext38="ERROR: failed to create $cgi_bin directory" itext39=" 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." itext40=" Installing Greenstone cgi programs in $cgi_bin" if [ ! -d "$cgi_bin" ]; then echo "$itext35" echo "$itext35" >> "${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 echo "$itext36" echo "$itext36" >> "${gsdlhome}/INSTALL_RECORD" remind_cgi="yes" else msg="$itext38 $itext0 $itext37" echo "$msg" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" exit 1 fi fi fi if [ ! -w "$cgi_bin" ]; then echo "$itext39" echo "$itext39" >> "${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="$itext40 --> 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 itext41=" 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 "$itext41" echo "$itext41" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" != "" ]; then web_cgi="$ans" fi # get public_html directory echo "$itext42" echo "$msg" >> "${gsdlhome}/INSTALL_RECORD" if [ "$logname" != "root" ]; then echo "$itext29" echo "$itext29" >> "${gsdlhome}/INSTALL_RECORD" fi echo "$itext43" echo "$itext43" >> "${gsdlhome}/INSTALL_RECORD" if [ "$logname" != "root" ]; then echo "$itext44" echo "$itext44" >> "${gsdlhome}/INSTALL_RECORD" fi echo "$itext45" echo "$itext45" >> "${gsdlhome}/INSTALL_RECORD" found="no" remind_ph="no" remind_ph_nolink="no" while [ "$found" = "no" ]; do echo "$itext32" echo "$itext32" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" = "" ] || [ "$ans" = "1" ]; then found="yes" public_html="$gsdlhome" # no link echo "$itext46" echo "$itext46" >> "${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 itext47="Enter directory that is also accessible from the web [${public_html}]" echo "$itext47" echo "$itext47" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" "> " read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" != "" ]; then public_html="$ans" fi itext48=" 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." # 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 echo "$itext48" echo "$itext48" >> "${gsdlhome}/INSTALL_RECORD" old_ph=$public_html remind_ph_nolink="yes" fi public_html="${public_html}/gsdl" fi done itext49=" 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]" itext50=" 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). " itext51=" Greenstone installation completed successfully." itext52=" * Don't forget to configure your webserver to treat $cgi_bin as a cgi executable directory." itext53=" For the Apache webserver this means adding the following ScriptAlias directive to your httpd.conf configuration file." itext54=" * Don't forget to move the contents of ${gsdlhome}/cgi-bin to $cgi_bin " itext55=" * Don't forget to configure your webserver to treat $gsdlhome as a web accessible directory." itext56=" For the Apache webserver this means adding the following Alias directive to your httpd.conf configuration file." itext57=" * Don't forget to create a link called gsdl from $old_ph to ${gsdlhome}. " itext58="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 " # get httpprefix echo "$itext49" echo "$itext49" >> "${gsdlhome}/INSTALL_RECORD" printf "%s" ">" httpprefix="/gsdl" read ans echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD" if [ "$ans" != "" ]; then httpprefix="$ans" fi # get initial password echo "$itext50" echo "$itext50" >> "${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 # success echo "$itext51" echo "$itext51" >> "${gsdlhome}/INSTALL_RECORD" if [ "$remind_cgi" = "yes" ]; then echo "$itext52" echo "$itext52" >> "${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="$itext53 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 echo "$itext54" echo "$itext54" >> "${gsdlhome}/INSTALL_RECORD" fi if [ "$remind_ph" = "yes" ]; then echo "$itext55" echo "$itext55" >> "${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="$itext56 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 echo "$itext57" echo "$itext57" >> "${gsdlhome}/INSTALL_RECORD" fi echo "$itext58" echo "$itext58" >> "${gsdlhome}/INSTALL_RECORD" exit 0