| 1 | #!/bin/sh
|
---|
| 2 |
|
---|
| 3 | ## Install.sh -- Install Greenstone
|
---|
| 4 |
|
---|
| 5 | cmd_cp="cp"
|
---|
| 6 | cmd_cpr="cp -r"
|
---|
| 7 | cmd_chmod="chmod"
|
---|
| 8 | cmd_mkdir="mkdir -p"
|
---|
| 9 | cmd_ln="ln -s"
|
---|
| 10 | cmd_mv="mv"
|
---|
| 11 | cmd_rm="rm -i"
|
---|
| 12 | cmd_rmr="rm -r"
|
---|
| 13 |
|
---|
| 14 | thisdir=`pwd`
|
---|
| 15 | cd ..
|
---|
| 16 | cd_dir=`pwd`
|
---|
| 17 | cd "$thisdir"
|
---|
| 18 |
|
---|
| 19 | # script must be run from within cdrom/unix directory
|
---|
| 20 | if [ ! -f "${thisdir}/Install.sh" ]; then
|
---|
| 21 | echo "Install.sh must be run from the directory in which it resides"
|
---|
| 22 | echo "Greenstone was not installed"
|
---|
| 23 | exit 1
|
---|
| 24 | fi
|
---|
| 25 |
|
---|
| 26 | # check that various important directories are on the cd
|
---|
| 27 | if [ ! -d "${cd_dir}/gsdl" ]; then
|
---|
| 28 | echo
|
---|
| 29 | echo "ERROR: Could not locate ${cd_dir}/gsdl"
|
---|
| 30 | echo "Greenstone was not installed"
|
---|
| 31 | exit 1
|
---|
| 32 | fi
|
---|
| 33 | if [ ! -d "${cd_dir}/Unix/bin/linux" ]; then
|
---|
| 34 | echo
|
---|
| 35 | echo "ERROR: Could not locate ${cd_dir}/Unix/bin/linux"
|
---|
| 36 | echo "Greenstone was not installed"
|
---|
| 37 | exit 1
|
---|
| 38 | fi
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | # install to /usr/local by default if user is "root", otherwise
|
---|
| 42 | # default to users home directory
|
---|
| 43 | gsdlos=`uname | tr A-Z a-z`
|
---|
| 44 | if [ "$gsdlos" = "linux" ]; then
|
---|
| 45 | logname=`whoami`
|
---|
| 46 | else
|
---|
| 47 | logname=""
|
---|
| 48 | fi
|
---|
| 49 | if [ "$logname" = "" ]; then
|
---|
| 50 | logname=`logname`
|
---|
| 51 | fi
|
---|
| 52 | gsdlhome="/home/${logname}"
|
---|
| 53 | if [ "$logname" = "root" ]; then
|
---|
| 54 | gsdlhome="/usr/local"
|
---|
| 55 | fi
|
---|
| 56 |
|
---|
| 57 | # get gsdlhome
|
---|
| 58 | echo
|
---|
| 59 | echo "This script will install Greenstone on your system. Please read"
|
---|
| 60 | echo "the Install.htm file that resides in the docs directory of this"
|
---|
| 61 | echo "cd-rom before installing."
|
---|
| 62 | echo
|
---|
| 63 | echo "Note that when prompted for input, hitting \"enter\" will select"
|
---|
| 64 | echo "the default (given in square brackets [] at the end of each question)."
|
---|
| 65 | echo
|
---|
| 66 | echo "Note also that Install.sh prints out information on any commands"
|
---|
| 67 | echo "it runs on your system in the form \"--> Install.sh: [command]\"."
|
---|
| 68 | echo
|
---|
| 69 | echo "It is assumed throughout this installation procedure that you"
|
---|
| 70 | echo "have a webserver installed on your system."
|
---|
| 71 | echo
|
---|
| 72 | echo "Continue? [y]"
|
---|
| 73 | printf "%s" "> "
|
---|
| 74 | read ans
|
---|
| 75 | if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
|
---|
| 76 | echo "Greenstone was not installed"
|
---|
| 77 | exit 0
|
---|
| 78 | fi
|
---|
| 79 |
|
---|
| 80 | echo
|
---|
| 81 | echo "Enter directory to install Greenstone into. A gsdl directory"
|
---|
| 82 | echo "will be created in this directory. [${gsdlhome}]"
|
---|
| 83 | printf "%s" "> "
|
---|
| 84 | read ans
|
---|
| 85 | if [ "$ans" != "" ]; then
|
---|
| 86 | gsdlhome="$ans"
|
---|
| 87 | fi
|
---|
| 88 |
|
---|
| 89 | if [ ! -d "$gsdlhome" ]; then
|
---|
| 90 | echo "Warning: The ${gsdlhome} directory does not exist."
|
---|
| 91 | echo "Create it? [y]"
|
---|
| 92 | printf "%s" "> "
|
---|
| 93 | read ans
|
---|
| 94 | if [ "$ans" = "" ]; then
|
---|
| 95 | ans="y"
|
---|
| 96 | fi
|
---|
| 97 | if [ "$ans" = "y" ]; then
|
---|
| 98 | echo "--> Install.sh: [$cmd_mkdir \"$gsdlhome\"]"
|
---|
| 99 | $cmd_mkdir "$gsdlhome"
|
---|
| 100 | if [ ! -d "$gsdlhome" ]; then
|
---|
| 101 | echo "ERROR: failed to create $gsdlhome directory"
|
---|
| 102 | echo "Greenstone was not installed"
|
---|
| 103 | exit 1
|
---|
| 104 | fi
|
---|
| 105 | else
|
---|
| 106 | echo "Greenstone was not installed"
|
---|
| 107 | exit 0
|
---|
| 108 | fi
|
---|
| 109 | fi;
|
---|
| 110 |
|
---|
| 111 |
|
---|
| 112 | # from now on $gsdlhome includes the "/gsdl"
|
---|
| 113 | gsdlhome="${gsdlhome}/gsdl"
|
---|
| 114 |
|
---|
| 115 | echo "--> Install.sh: [$cmd_mkdir \"${gsdlhome}\"]"
|
---|
| 116 | $cmd_mkdir "$gsdlhome"
|
---|
| 117 | if [ ! -d "$gsdlhome" ]; then
|
---|
| 118 | echo "ERROR: failed to create $gsdlhome directory"
|
---|
| 119 | echo "Greenstone was not installed"
|
---|
| 120 | exit 1
|
---|
| 121 | fi
|
---|
| 122 | # set permissions on gsdlhome directory (not that we should need to)
|
---|
| 123 | echo "--> Install.sh: [$cmd_chmod u+rwx \"${gsdlhome}\"]"
|
---|
| 124 | $cmd_chmod u+rwx "$gsdlhome"
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | # create initial uninstall.sh
|
---|
| 128 | cd "$gsdlhome"
|
---|
| 129 | echo "#!/bin/sh" > uninstall.sh
|
---|
| 130 | echo "" >> uninstall.sh
|
---|
| 131 | echo "echo \"remove ${gsdlhome} directory? [y]\"" >> uninstall.sh
|
---|
| 132 | echo "read ans" >> uninstall.sh
|
---|
| 133 | echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> uninstall.sh
|
---|
| 134 | echo " $cmd_rmr \"$gsdlhome\"" >> uninstall.sh
|
---|
| 135 | echo "fi" >> uninstall.sh
|
---|
| 136 | $cmd_chmod u+x uninstall.sh
|
---|
| 137 | cd "$thisdir"
|
---|
| 138 |
|
---|
| 139 | echo
|
---|
| 140 | echo "If this installation fails or is cancelled, run the uninstall"
|
---|
| 141 | echo "script (${gsdlhome}/uninstall.sh) to clean up the partial"
|
---|
| 142 | echo "installation."
|
---|
| 143 | echo "Continue? [y]"
|
---|
| 144 | printf "%s" "> "
|
---|
| 145 | read ans
|
---|
| 146 | if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
|
---|
| 147 | echo "Greenstone was not installed"
|
---|
| 148 | exit 0
|
---|
| 149 | fi
|
---|
| 150 |
|
---|
| 151 | echo
|
---|
| 152 | echo "Installing Greenstone directory structure to ${gsdlhome}"
|
---|
| 153 | # copy gsdl directory across
|
---|
| 154 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/gsdl/\"* \"$gsdlhome\"]"
|
---|
| 155 | $cmd_cpr "${cd_dir}/gsdl/"* "$gsdlhome"
|
---|
| 156 |
|
---|
| 157 | # copy setup shell scripts across too
|
---|
| 158 | echo "--> Install.sh: [$cmd_cp \"${cd_dir}/src/Unix/setup.\"* \"$gsdlhome\"]"
|
---|
| 159 | $cmd_cp "${cd_dir}/src/Unix/setup."* "$gsdlhome"
|
---|
| 160 |
|
---|
| 161 | # create the tmp directory
|
---|
| 162 | echo "--> Install.sh: [$cmd_mkdir \"$gsdlhome/tmp\"]"
|
---|
| 163 | $cmd_mkdir "$gsdlhome/tmp"
|
---|
| 164 |
|
---|
| 165 | # make collect directory writable so we can install collections
|
---|
| 166 | echo "--> Install.sh: [$cmd_chmod u+rwx \"$gsdlhome/collect\"]"
|
---|
| 167 | $cmd_chmod u+rwx "$gsdlhome/collect"
|
---|
| 168 |
|
---|
| 169 | # which collections do we want
|
---|
| 170 | cd "${cd_dir}/collect"
|
---|
| 171 | files=*
|
---|
| 172 | first="yes"
|
---|
| 173 | for file in $files
|
---|
| 174 | do
|
---|
| 175 | if [ "$file" != "*" ] && [ "$file" != "dlpeople" ]; then
|
---|
| 176 | if [ "$first" = "yes" ]; then
|
---|
| 177 | echo
|
---|
| 178 | echo "The Greenstone demonstration collection has been installed. Would you"
|
---|
| 179 | echo "like to install any other collections from the installation cd-rom? [y]"
|
---|
| 180 | read ans
|
---|
| 181 | if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
|
---|
| 182 | break
|
---|
| 183 | fi
|
---|
| 184 | first="no"
|
---|
| 185 | fi
|
---|
| 186 |
|
---|
| 187 | echo
|
---|
| 188 | echo "Install the $file collection? [y]"
|
---|
| 189 | printf "%s" "> "
|
---|
| 190 | read ans
|
---|
| 191 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
| 192 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/$file\" \"${gsdlhome}/collect\"]"
|
---|
| 193 | $cmd_cpr "${cd_dir}/collect/$file" "${gsdlhome}/collect"
|
---|
| 194 | fi
|
---|
| 195 | fi
|
---|
| 196 | done
|
---|
| 197 |
|
---|
| 198 | # set permissions
|
---|
| 199 | echo
|
---|
| 200 | echo "Setting permissions ..."
|
---|
| 201 | echo "--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]"
|
---|
| 202 | $cmd_chmod -R u+rw "$gsdlhome"
|
---|
| 203 | # gsdl/etc needs to be globally writable
|
---|
| 204 | echo "--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/etc\"]"
|
---|
| 205 | $cmd_chmod -R a+w "$gsdlhome/etc"
|
---|
| 206 |
|
---|
| 207 | # should gsdl/collect and gsdl/tmp be globally writable?
|
---|
| 208 | echo
|
---|
| 209 | echo "In order for end-user collection building to be enabled the"
|
---|
| 210 | echo "Greenstone cgi program must be able to write to the"
|
---|
| 211 | echo "${gsdlhome}/collect and ${gsdlhome}/tmp directories."
|
---|
| 212 | echo "On most systems this means they must be globally writable."
|
---|
| 213 | echo "Make these directories globally writable? [y]"
|
---|
| 214 | printf "%s" "> "
|
---|
| 215 | read ans
|
---|
| 216 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
| 217 | echo "--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/collect\"]"
|
---|
| 218 | $cmd_chmod -R a+w "$gsdlhome/collect"
|
---|
| 219 | echo "--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/tmp\"]"
|
---|
| 220 | $cmd_chmod -R a+w "$gsdlhome/tmp"
|
---|
| 221 | fi
|
---|
| 222 |
|
---|
| 223 | # binaries or source code?
|
---|
| 224 | compile="yes"
|
---|
| 225 | if [ "$gsdlos" = "linux" ]; then
|
---|
| 226 | echo
|
---|
| 227 | echo "You may either install pre-compiled, statically linked linux [b]inaries"
|
---|
| 228 | echo "or install and [c]ompile the Greenstone source code"
|
---|
| 229 |
|
---|
| 230 | found=no
|
---|
| 231 | while [ "$found" = "no" ]; do
|
---|
| 232 | echo "Enter \"[b]\" or \"c\""
|
---|
| 233 | printf "%s" "> "
|
---|
| 234 | read ans
|
---|
| 235 | if [ "$ans" = "" ] || [ "$ans" = "b" ]; then
|
---|
| 236 | compile="no"
|
---|
| 237 | # install binaries
|
---|
| 238 | echo
|
---|
| 239 | echo "Installing linux binaries"
|
---|
| 240 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/Unix/bin/linux\" \"${gsdlhome}/bin\" ]"
|
---|
| 241 | $cmd_cpr "${cd_dir}/Unix/bin/linux" "${gsdlhome}/bin"
|
---|
| 242 | echo "--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/bin/linux/\"*]"
|
---|
| 243 | $cmd_chmod a+x "${gsdlhome}/bin/linux/"*
|
---|
| 244 | echo "--> Install.sh: [$cmd_chmod -R u+rw \"${gsdlhome}/bin/linux\"]"
|
---|
| 245 | $cmd_chmod -R u+rw "${gsdlhome}/bin/linux"
|
---|
| 246 |
|
---|
| 247 | # move library executable to cgi-bin
|
---|
| 248 | echo "--> Install.sh: [$cmd_mv \"${gsdlhome}/bin/linux/library\" \"${gsdlhome}/cgi-bin\"]"
|
---|
| 249 | $cmd_mv "${gsdlhome}/bin/linux/library" "${gsdlhome}/cgi-bin"
|
---|
| 250 |
|
---|
| 251 | found="yes"
|
---|
| 252 | elif [ "$ans" = "c" ]; then
|
---|
| 253 | found="yes"
|
---|
| 254 | fi
|
---|
| 255 | done
|
---|
| 256 | fi
|
---|
| 257 |
|
---|
| 258 | if [ "$compile" = "yes" ]; then
|
---|
| 259 | # install source
|
---|
| 260 | echo
|
---|
| 261 | echo "Installing source code"
|
---|
| 262 | echo "--> Install.sh [$cmd_cpr \"${cd_dir}/src/lib\" \"$gsdlhome\"]"
|
---|
| 263 | $cmd_cpr "${cd_dir}/src/lib" "$gsdlhome"
|
---|
| 264 | echo "--> Install.sh [$cmd_cpr \"${cd_dir}/src/packages\" \"$gsdlhome\"]"
|
---|
| 265 | $cmd_cpr "${cd_dir}/src/packages" "$gsdlhome"
|
---|
| 266 | echo "--> Install.sh [$cmd_cpr \"${cd_dir}/src/src\" \"$gsdlhome\"]"
|
---|
| 267 | $cmd_cpr "${cd_dir}/src/src" "$gsdlhome"
|
---|
| 268 | echo "--> Install.sh [$cmd_cpr \"${cd_dir}/src/Unix/\"* \"$gsdlhome\"]"
|
---|
| 269 | $cmd_cpr "${cd_dir}/src/Unix/"* "$gsdlhome"
|
---|
| 270 | echo "--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]"
|
---|
| 271 | $cmd_chmod -R u+rw "$gsdlhome"
|
---|
| 272 | echo "--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/configure\"]"
|
---|
| 273 | $cmd_chmod a+x "${gsdlhome}/configure"
|
---|
| 274 | echo "--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/packages/yaz/configure\"]"
|
---|
| 275 | $cmd_chmod a+x "${gsdlhome}/packages/yaz/configure"
|
---|
| 276 |
|
---|
| 277 | # compile it
|
---|
| 278 | echo "--> Install.sh: [cd $gsdlhome]"
|
---|
| 279 | cd "$gsdlhome"
|
---|
| 280 | echo "configuring ..."
|
---|
| 281 | echo
|
---|
| 282 | echo "--> Install.sh: [./configure]"
|
---|
| 283 | ./configure
|
---|
| 284 | echo "compiling ..."
|
---|
| 285 | echo
|
---|
| 286 | echo "--> Install.sh: [make]"
|
---|
| 287 | make
|
---|
| 288 | echo "installing ..."
|
---|
| 289 | echo
|
---|
| 290 | echo "--> Install.sh: [make install]"
|
---|
| 291 | make install
|
---|
| 292 | echo "--> Install.sh: [cd $thisdir]"
|
---|
| 293 | cd "$thisdir"
|
---|
| 294 |
|
---|
| 295 | # check that things compiled ok
|
---|
| 296 | if [ ! -f "${gsdlhome}/cgi-bin/library" ]; then
|
---|
| 297 | echo
|
---|
| 298 | echo "ERROR: Compilation failed"
|
---|
| 299 | echo "Greenstone was not installed successfully"
|
---|
| 300 | echo "Run the uninstall script (${gsdlhome}/uninstall.sh)"
|
---|
| 301 | echo "to clean up the partial installation."
|
---|
| 302 | exit 1
|
---|
| 303 | fi
|
---|
| 304 | fi
|
---|
| 305 |
|
---|
| 306 |
|
---|
| 307 | # try to find out hostname
|
---|
| 308 | if [ "$gsdlos" = "linux" ]; then
|
---|
| 309 | hostname=`hostname -f`
|
---|
| 310 | if [ "$hostname" = "" ]; then
|
---|
| 311 | hostname=`hostname -i`
|
---|
| 312 | fi
|
---|
| 313 | fi
|
---|
| 314 | if [ "$hostname" = "" ]; then
|
---|
| 315 | hostname=`hostname`
|
---|
| 316 | fi
|
---|
| 317 | if [ "$hostname" = "" ]; then
|
---|
| 318 | hostname="your-computer-name"
|
---|
| 319 | fi
|
---|
| 320 |
|
---|
| 321 |
|
---|
| 322 | # get cgi-bin directory
|
---|
| 323 | echo
|
---|
| 324 | echo
|
---|
| 325 | echo "Greenstone needs a valid cgi executable directory (normally called"
|
---|
| 326 | echo "cgi-bin on unix systems) from which to run."
|
---|
| 327 | echo "This may be either:"
|
---|
| 328 | echo " 1. The default Greenstone cgi-bin directory (${gsdlhome}/cgi-bin)."
|
---|
| 329 | echo " If you use the Greenstone default you will need to configure"
|
---|
| 330 | echo " your webserver to treat this directory as a cgi executable"
|
---|
| 331 | echo " directory. For the Apache webserver you use the ScriptAlias"
|
---|
| 332 | echo " directive to do this (details of how to configure your webserver"
|
---|
| 333 | echo " will be displayed at the end of this installation procedure)."
|
---|
| 334 | if [ "$logname" != "root" ]; then
|
---|
| 335 | echo " Note that you will probably need help from your system"
|
---|
| 336 | echo " administrator to reconfigure your webserver."
|
---|
| 337 | fi
|
---|
| 338 | echo " 2. An existing cgi-bin directory. Normally a cgi-bin directory"
|
---|
| 339 | echo " is created when your webserver is installed. Typically, this"
|
---|
| 340 | echo " might be /home/httpd/cgi-bin, or /usr/local/apache/cgi-bin, or"
|
---|
| 341 | echo " /var/lib/apache/cgi-bin."
|
---|
| 342 | if [ "$logname" != "root" ]; then
|
---|
| 343 | echo " Many systems also allow individual users to have their own"
|
---|
| 344 | echo " cgi-bin in /home/username/public_html/cgi-bin."
|
---|
| 345 | fi
|
---|
| 346 | found=no
|
---|
| 347 | remind_cgi="no"
|
---|
| 348 | remind_cgi_nomove="no"
|
---|
| 349 | while [ "$found" = "no" ]; do
|
---|
| 350 | echo "Enter \"[1]\" or \"2\""
|
---|
| 351 | printf "%s" "> "
|
---|
| 352 | read ans
|
---|
| 353 | if [ "$ans" = "" ] || [ "$ans" = "1" ]; then
|
---|
| 354 | found="option1"
|
---|
| 355 | cgi_bin="${gsdlhome}/cgi-bin"
|
---|
| 356 | # default gsdl cgi-bin, do nothing
|
---|
| 357 | echo
|
---|
| 358 | echo "Don't forget to configure your webserver to treat $cgi_bin"
|
---|
| 359 | echo "as a cgi executable directory. Don't worry, you'll be"
|
---|
| 360 | echo "reminded of this again at the end of the installation"
|
---|
| 361 | echo "procedure"
|
---|
| 362 | remind_cgi="yes"
|
---|
| 363 | elif [ "$ans" = "2" ]; then
|
---|
| 364 | found="option2"
|
---|
| 365 | # external cgi-bin
|
---|
| 366 | echo
|
---|
| 367 | echo "Enter existing cgi executable directory [/usr/local/apache/cgi-bin]"
|
---|
| 368 | printf "%s" "> "
|
---|
| 369 | read ans
|
---|
| 370 | if [ "$ans" = "" ]; then
|
---|
| 371 | cgi_bin="/usr/local/apache/cgi-bin"
|
---|
| 372 | else
|
---|
| 373 | cgi_bin="$ans"
|
---|
| 374 | fi
|
---|
| 375 | if [ ! -d "$cgi_bin" ]; then
|
---|
| 376 | echo "Warning: The ${cgi_bin} directory does not exist."
|
---|
| 377 | echo "Create it? [y]"
|
---|
| 378 | printf "%s" "> "
|
---|
| 379 | read ans
|
---|
| 380 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
| 381 | echo "--> Install.sh: [$cmd_mkdir \"$cgi_bin\"]"
|
---|
| 382 | $cmd_mkdir "$cgi_bin"
|
---|
| 383 | if [ -d "$cgi_bin" ]; then
|
---|
| 384 | echo "Don't forget to configure your webserver to treat $cgi_bin"
|
---|
| 385 | echo "as a cgi executable directory. Don't worry, you'll be"
|
---|
| 386 | echo "reminded of this again at the end of the installation"
|
---|
| 387 | echo "procedure"
|
---|
| 388 | remind_cgi="yes"
|
---|
| 389 | else
|
---|
| 390 | echo "ERROR: failed to create $cgi_bin directory"
|
---|
| 391 | echo "Greenstone installation failed."
|
---|
| 392 | echo "Run the uninstall script (${gsdlhome}/uninstall.sh)"
|
---|
| 393 | echo "to clean up the partial installation."
|
---|
| 394 | exit 1
|
---|
| 395 | fi
|
---|
| 396 | fi
|
---|
| 397 | fi
|
---|
| 398 |
|
---|
| 399 | if [ ! -w "$cgi_bin" ]; then
|
---|
| 400 | echo
|
---|
| 401 | echo "Unable to write to $cgi_bin directory. You will need"
|
---|
| 402 | echo "to copy the contents of ${gsdlhome}/cgi-bin"
|
---|
| 403 | echo "to $cgi_bin after this installation is completed."
|
---|
| 404 | echo "You'll be reminded of this again at the end of the"
|
---|
| 405 | echo "installation procedure."
|
---|
| 406 | remind_cgi_nomove="yes"
|
---|
| 407 | else
|
---|
| 408 | # install cgi-bin stuff (update the uninstall script first)
|
---|
| 409 | cd "$gsdlhome"
|
---|
| 410 | echo "#!/bin/sh" > uninstall.sh
|
---|
| 411 | echo "" >> uninstall.sh
|
---|
| 412 | echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> uninstall.sh
|
---|
| 413 | echo "$cmd_rm \"${cgi_bin}/library\"" >> uninstall.sh
|
---|
| 414 | echo "echo \"remove ${gsdlhome} directory? [y]\"" >> uninstall.sh
|
---|
| 415 | echo "read ans" >> uninstall.sh
|
---|
| 416 | echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> uninstall.sh
|
---|
| 417 | echo " $cmd_rmr \"$gsdlhome\"" >> uninstall.sh
|
---|
| 418 | echo "fi" >> uninstall.sh
|
---|
| 419 | $cmd_chmod u+x uninstall.sh
|
---|
| 420 | cd "$thisdir"
|
---|
| 421 |
|
---|
| 422 | echo
|
---|
| 423 | echo "Installing Greenstone cgi programs in $cgi_bin"
|
---|
| 424 | echo "--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/gsdlsite.cfg\" \"$cgi_bin\"]"
|
---|
| 425 | $cmd_mv "${gsdlhome}/cgi-bin/gsdlsite.cfg" "$cgi_bin"
|
---|
| 426 | echo "--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/library\" \"$cgi_bin\"]"
|
---|
| 427 | $cmd_mv "${gsdlhome}/cgi-bin/library" "$cgi_bin"
|
---|
| 428 | fi
|
---|
| 429 | fi
|
---|
| 430 | done
|
---|
| 431 |
|
---|
| 432 | # web address of cgi-bin
|
---|
| 433 | web_cgi="http://${hostname}/cgi-bin"
|
---|
| 434 | if [ "$found" = "option1" ]; then
|
---|
| 435 | web_cgi="http://${hostname}/gsdl/cgi-bin"
|
---|
| 436 | fi
|
---|
| 437 | echo
|
---|
| 438 | echo "Please enter the web address of the $cgi_bin"
|
---|
| 439 | echo "directory. Typically this might be http://localhost/cgi-bin,"
|
---|
| 440 | echo "or http://127.0.0.1/cgi-bin, or http://your-computer-name/cgi-bin,"
|
---|
| 441 | echo "or http://nnn.nnn.nnn.nn/cgi-bin. [$web_cgi]"
|
---|
| 442 | printf "%s" "> "
|
---|
| 443 | read ans
|
---|
| 444 | if [ "$ans" != "" ]; then
|
---|
| 445 | web_cgi="$ans"
|
---|
| 446 | fi
|
---|
| 447 |
|
---|
| 448 | # get public_html directory
|
---|
| 449 | echo
|
---|
| 450 | echo
|
---|
| 451 | echo "In order for Greenstone to run, the $gsdlhome"
|
---|
| 452 | echo "directory and all it contains must be accessible from the web."
|
---|
| 453 | echo "To make this happen you may either:"
|
---|
| 454 | echo " 1. Configure your webserver so that $gsdlhome"
|
---|
| 455 | echo " is itself accessible from the web."
|
---|
| 456 | if [ "$logname" != "root" ]; then
|
---|
| 457 | echo " Note that you will probably need help from your system"
|
---|
| 458 | echo " administrator to reconfigure your webserver."
|
---|
| 459 | fi
|
---|
| 460 | echo " 2. Provide an existing web accessible directory from which"
|
---|
| 461 | echo " a symbolic link will be made to $gsdlhome."
|
---|
| 462 | echo " When your server was installed a web accessible directory"
|
---|
| 463 | echo " will have been created (the Apache webserver uses the"
|
---|
| 464 | echo " DocumentRoot directive to define this directory). Typically"
|
---|
| 465 | echo " this directory might be /home/httpd/html, or /usr/local/apache/htdocs,"
|
---|
| 466 | echo " or /var/lib/apache/htdocs."
|
---|
| 467 | if [ "$logname" != "root" ]; then
|
---|
| 468 | echo " Many systems also allow individual users to have their own"
|
---|
| 469 | echo " web accessible directory in /home/username/public_html."
|
---|
| 470 | fi
|
---|
| 471 | echo " Note that your web server will need to be configured to allow"
|
---|
| 472 | echo " symbolic links from within this directory. For the Apache"
|
---|
| 473 | echo " server that means this directory must be configured with"
|
---|
| 474 | echo " the SymLinksIfOwnerMatch or FollowSymLinks option (most Apache"
|
---|
| 475 | echo " installations are configured this way by default)."
|
---|
| 476 | found="no"
|
---|
| 477 | remind_ph="no"
|
---|
| 478 | remind_ph_nolink="no"
|
---|
| 479 | while [ "$found" = "no" ]; do
|
---|
| 480 | echo "Enter \"[1]\" or \"2\""
|
---|
| 481 | printf "%s" "> "
|
---|
| 482 | read ans
|
---|
| 483 | if [ "$ans" = "" ] || [ "$ans" = "1" ]; then
|
---|
| 484 | found="yes"
|
---|
| 485 | public_html="$gsdlhome"
|
---|
| 486 | # no link
|
---|
| 487 | echo
|
---|
| 488 | echo "Don't forget to configure your webserver to make $gsdlhome"
|
---|
| 489 | echo "accessible from the web. You'll be reminded of this again"
|
---|
| 490 | echo "at the end of this installation procedure."
|
---|
| 491 | remind_ph="yes"
|
---|
| 492 | elif [ "$ans" = "2" ]; then
|
---|
| 493 | found="yes"
|
---|
| 494 | # external public_html
|
---|
| 495 | echo
|
---|
| 496 | public_html="/home/${logname}/public_html"
|
---|
| 497 | if [ "$logname" = "root" ]; then
|
---|
| 498 | public_html="/usr/local/apache/htdocs"
|
---|
| 499 | fi
|
---|
| 500 | echo "Enter directory that is also accessible from the web [${public_html}]"
|
---|
| 501 | printf "%s" "> "
|
---|
| 502 | read ans
|
---|
| 503 | if [ "$ans" != "" ]; then
|
---|
| 504 | public_html="$ans"
|
---|
| 505 | fi
|
---|
| 506 | # create link to gsdl (and update uninstall.sh)
|
---|
| 507 | if [ -w "$public_html" ]; then
|
---|
| 508 | cd "$gsdlhome"
|
---|
| 509 | echo "#!/bin/sh" > uninstall.sh
|
---|
| 510 | echo "" >> uninstall.sh
|
---|
| 511 | echo "$cmd_rm \"$public_html/gsdl\"" >> uninstall.sh
|
---|
| 512 | echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> uninstall.sh
|
---|
| 513 | echo "$cmd_rm \"${cgi_bin}/library\"" >> uninstall.sh
|
---|
| 514 | echo "echo \"remove ${gsdlhome} directory? [y]\"" >> uninstall.sh
|
---|
| 515 | echo "read ans" >> uninstall.sh
|
---|
| 516 | echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> uninstall.sh
|
---|
| 517 | echo " $cmd_rmr \"$gsdlhome\"" >> uninstall.sh
|
---|
| 518 | echo "fi" >> uninstall.sh
|
---|
| 519 | $cmd_chmod u+x uninstall.sh
|
---|
| 520 | cd "$thisdir"
|
---|
| 521 |
|
---|
| 522 | echo "--> Install.sh: [cd \"$public_html\"]"
|
---|
| 523 | cd "$public_html"
|
---|
| 524 | echo "--> Install.sh: [$cmd_ln \"$gsdlhome\" gsdl]"
|
---|
| 525 | $cmd_ln "$gsdlhome" gsdl
|
---|
| 526 | echo "--> Install.sh: [cd \"$thisdir\"]"
|
---|
| 527 | cd "$thisdir"
|
---|
| 528 | else
|
---|
| 529 | echo
|
---|
| 530 | echo "Unable to write to $public_html directory. You will need"
|
---|
| 531 | echo "to create a link called gsdl from $public_html to"
|
---|
| 532 | echo "$gsdlhome after this installation is completed. You'll be"
|
---|
| 533 | echo "reminded of this again at the end of the installation"
|
---|
| 534 | echo "procedure."
|
---|
| 535 | old_ph=$public_html
|
---|
| 536 | remind_ph_nolink="yes"
|
---|
| 537 | fi
|
---|
| 538 | public_html="${public_html}/gsdl"
|
---|
| 539 | fi
|
---|
| 540 | done
|
---|
| 541 |
|
---|
| 542 |
|
---|
| 543 | # get httpprefix
|
---|
| 544 | echo
|
---|
| 545 | echo "Enter the web address of the $public_html directory."
|
---|
| 546 | echo "This may be a relative url (e.g. \"/gsdl\") or a"
|
---|
| 547 | echo "complete url (e.g. \"http://${hostname}/gsdl\") [/gsdl]"
|
---|
| 548 | printf "%s" ">"
|
---|
| 549 | httpprefix="/gsdl"
|
---|
| 550 | read ans
|
---|
| 551 | if [ "$ans" != "" ]; then
|
---|
| 552 | httpprefix="$ans"
|
---|
| 553 | fi
|
---|
| 554 |
|
---|
| 555 | # get initial password
|
---|
| 556 | echo
|
---|
| 557 | echo "In order to use end-user collection building or to access certain"
|
---|
| 558 | echo "parts of the administration pages you must have a password."
|
---|
| 559 | echo "A user with the username \"admin\" will be created for you with"
|
---|
| 560 | echo "the password you provide (i.e. to enter any pages requiring user"
|
---|
| 561 | echo "authentication enter the \"admin\" username and the password you"
|
---|
| 562 | echo "set here).\n";
|
---|
| 563 | pw=`${gsdlhome}/bin/${gsdlos}/getpw`
|
---|
| 564 | tmp="[admin]
|
---|
| 565 | <comment>
|
---|
| 566 | <enabled>true
|
---|
| 567 | <groups>administrator,colbuilder
|
---|
| 568 | <password>${pw}
|
---|
| 569 | <username>admin
|
---|
| 570 | ----------------------------------------------------------------------"
|
---|
| 571 | echo "$tmp" | ${gsdlhome}/bin/${gsdlos}/txt2db "${gsdlhome}/etc/users.db"
|
---|
| 572 |
|
---|
| 573 | # edit gsdlsite.cfg
|
---|
| 574 | cd "$cgi_bin"
|
---|
| 575 | sed "s|\(gsdlhome *\)[^ ]*|\1${gsdlhome}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
|
---|
| 576 | sed "s|#*\(httpprefix *\)[^ ]*|\1${httpprefix}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
|
---|
| 577 | sed "s|\(httpimg *\)[^ ]*|\1${httpprefix}/images|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
|
---|
| 578 |
|
---|
| 579 | echo
|
---|
| 580 | echo
|
---|
| 581 | echo "Greenstone installation completed successfully."
|
---|
| 582 | if [ "$remind_cgi" = "yes" ]; then
|
---|
| 583 | echo " * Don't forget to configure your webserver to treat"
|
---|
| 584 | echo " $cgi_bin as a cgi executable directory."
|
---|
| 585 |
|
---|
| 586 | apache_web_cgi=`echo "$web_cgi" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"`
|
---|
| 587 | cgi_bin_slash=`echo "$cgi_bin" | sed "s|/*$|/|"`
|
---|
| 588 | cgi_bin_noslash=`echo "$cgi_bin" | sed "s|/*$||"`
|
---|
| 589 |
|
---|
| 590 | echo " For the Apache webserver this means adding the following"
|
---|
| 591 | echo " ScriptAlias directive to your httpd.conf configuration file."
|
---|
| 592 | echo
|
---|
| 593 | echo " ScriptAlias ${apache_web_cgi} \"${cgi_bin_slash}\""
|
---|
| 594 | echo " <Directory \"${cgi_bin_noslash}\">"
|
---|
| 595 | echo " AllowOverride None"
|
---|
| 596 | echo " Options None"
|
---|
| 597 | echo " Order allow,deny"
|
---|
| 598 | echo " Allow from all"
|
---|
| 599 | echo " </Directory>"
|
---|
| 600 | echo
|
---|
| 601 | fi
|
---|
| 602 | if [ "$remind_cgi_nomove" = "yes" ]; then
|
---|
| 603 | echo " * Don't forget to move the contents of ${gsdlhome}/cgi-bin"
|
---|
| 604 | echo " to $cgi_bin"
|
---|
| 605 | echo
|
---|
| 606 | fi
|
---|
| 607 | if [ "$remind_ph" = "yes" ]; then
|
---|
| 608 | echo " * Don't forget to configure your webserver to treat"
|
---|
| 609 | echo " $gsdlhome as a web accessible directory."
|
---|
| 610 |
|
---|
| 611 | apache_httpprefix=`echo "$httpprefix" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"`
|
---|
| 612 | public_html_slash=`echo "$public_html" | sed "s|/*$|/|"`
|
---|
| 613 | public_html_noslash=`echo "$public_html" | sed "s|/*$||"`
|
---|
| 614 |
|
---|
| 615 | echo " For the Apache webserver this means adding the following"
|
---|
| 616 | echo " Alias directive to your httpd.conf configuration file."
|
---|
| 617 | echo
|
---|
| 618 | echo " Alias ${apache_httpprefix} \"${public_html_slash}\""
|
---|
| 619 | echo " <Directory \"${public_html_noslash}\">"
|
---|
| 620 | echo " Options Indexes MultiViews FollowSymLinks"
|
---|
| 621 | echo " AllowOverride None"
|
---|
| 622 | echo " Order allow,deny"
|
---|
| 623 | echo " Allow from all"
|
---|
| 624 | echo " </Directory>"
|
---|
| 625 | echo
|
---|
| 626 | fi
|
---|
| 627 | if [ "$remind_ph_nolink" = "yes" ]; then
|
---|
| 628 | echo " * Don't forget to create a link called gsdl from $old_ph"
|
---|
| 629 | echo " to ${gsdlhome}."
|
---|
| 630 | echo
|
---|
| 631 | fi
|
---|
| 632 | echo "You may remove Greenstone from your system at any time by running"
|
---|
| 633 | echo "the ${gsdlhome}/uninstall.sh script."
|
---|
| 634 | echo "Access Greenstone by pointing a web browser at"
|
---|
| 635 | echo " ${web_cgi}/library"
|
---|
| 636 | echo
|
---|
| 637 |
|
---|
| 638 | exit 0
|
---|