source: trunk/gsdl/Install.sh@ 2434

Last change on this file since 2434 was 2434, checked in by sjboddie, 23 years ago

* empty log message *

  • Property svn:executable set to *
  • Property svn:mime-type set to application/octet-stream
File size: 27.2 KB
Line 
1#!/bin/sh
2
3## Install.sh -- Install Greenstone
4
5cmd_cp="cp"
6cmd_cpr="cp -r"
7cmd_chmod="chmod"
8cmd_mkdir="mkdir -p"
9cmd_ln="ln -s"
10cmd_mv="mv"
11cmd_rm="rm -i"
12cmd_rmr="rm -r"
13
14thisdir=`pwd`
15cd ..
16cd_dir=`pwd`
17cd "$thisdir"
18
19# script must be run from within cdrom/unix directory
20if [ ! -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
24fi
25
26# check that various important directories are on the cd
27if [ ! -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
32fi
33if [ ! -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
38fi
39
40
41# install to /usr/local by default if user is "root", otherwise
42# default to users home directory
43gsdlos=`uname | tr A-Z a-z`
44if [ "$gsdlos" = "linux" ]; then
45 logname=`whoami`
46else
47 logname=""
48fi
49if [ "$logname" = "" ]; then
50 logname=`logname`
51fi
52gsdlhome="/home/${logname}"
53if [ "$logname" = "root" ]; then
54 gsdlhome="/usr/local"
55fi
56
57# get gsdlhome
58msg="This script will install Greenstone on your system. You may want
59to skim through the Install.pdf document that resides in the docs
60directory on this cd-rom before continuing with the installation.
61
62Note that when prompted for input, hitting \"enter\" will select
63the default (given in square brackets [] at the end of each question).
64If you're unsure which option to select, use the default.
65
66Note also that Install.sh prints out information on any commands
67it runs on your system in the form \"--> Install.sh: [command]\".
68
69It is assumed throughout this installation procedure that you
70have a webserver installed on your system.
71
72For later reference the output of this install script will be
73recorded in a file called INSTALL_RECORD in the directory into
74which you choose to install Greenstone.
75
76Continue? [y]"
77echo "$msg"
78printf "%s" "> "
79read ans
80log="${log}${msg}
81> $ans
82"
83if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
84 echo "Greenstone was not installed"
85 exit 0
86fi
87
88msg="
89Which directory should Greenstone be installed to?
90Make sure that this directory is on a partition with sufficient
91free disk space for the installation option you intend
92selecting.
93"
94if [ "$gsdlos" = "linux" ]; then
95msg="${msg}--A standard linux binary installation requires approximately
96 50Mb of free disk space (not including additional collections).
97"
98fi
99msg="${msg}--Compiling Greenstone from source code requires approximately
100 155Mb of free disk space (not including additional collections).
101--Optional Greenstone demonstration collections may require up
102 to 200Mb of free disk space (you'll be told the size of
103 individual collections before you install them)
104Enter directory to install Greenstone into. A gsdl directory
105will be created in this directory. [${gsdlhome}]"
106echo "$msg"
107printf "%s" "> "
108read ans
109log="${log}${msg}
110> $ans
111"
112if [ "$ans" != "" ]; then
113 gsdlhome="$ans"
114fi
115
116if [ ! -d "$gsdlhome" ]; then
117 msg="
118Warning: The ${gsdlhome} directory does not exist.
119Create it? [y]"
120 echo "$msg"
121 printf "%s" "> "
122 read ans
123 log="${log}${msg}
124> $ans
125"
126 if [ "$ans" = "" ]; then
127 ans="y"
128 fi
129 if [ "$ans" = "y" ]; then
130 msg="--> Install.sh: [$cmd_mkdir \"$gsdlhome\"]"
131 echo "$msg"
132 log="${log}${msg}
133"
134 $cmd_mkdir "$gsdlhome"
135 if [ ! -d "$gsdlhome" ]; then
136 echo "ERROR: failed to create $gsdlhome directory"
137 echo "Greenstone was not installed"
138 exit 1
139 fi
140 else
141 echo "Greenstone was not installed"
142 exit 0
143 fi
144fi
145
146# from now on $gsdlhome includes the "/gsdl"
147gsdlhome="${gsdlhome}/gsdl"
148msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}\"]"
149echo "$msg"
150log="${log}${msg}
151"
152$cmd_mkdir "$gsdlhome"
153if [ ! -d "$gsdlhome" ]; then
154 echo "ERROR: failed to create $gsdlhome directory"
155 echo "Greenstone was not installed"
156 exit 1
157fi
158# set permissions on gsdlhome directory (not that we should need to)
159msg="--> Install.sh: [$cmd_chmod u+rwx \"${gsdlhome}\"]"
160echo "$msg"
161log="${log}${msg}
162"
163$cmd_chmod u+rwx "$gsdlhome"
164
165# create initial Uninstall.sh
166cd "$gsdlhome"
167echo "#!/bin/sh" > Uninstall.sh
168echo "" >> Uninstall.sh
169echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh
170echo "read ans" >> Uninstall.sh
171echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh
172echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh
173echo "fi" >> Uninstall.sh
174$cmd_chmod u+x Uninstall.sh
175cd "$thisdir"
176
177# create initial INSTALL_RECORD
178echo "$log" >> "${gsdlhome}/INSTALL_RECORD"
179
180msg="
181If this installation fails or is cancelled, run the uninstall
182script (${gsdlhome}/Uninstall.sh) to clean up the partial
183installation.
184Continue? [y]"
185echo "$msg"
186echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
187printf "%s" "> "
188read ans
189echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
190if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
191 msg="Greenstone was not installed"
192 echo "$msg"
193 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
194 exit 0
195fi
196
197msg="
198Installing Greenstone directory structure to ${gsdlhome}"
199echo "$msg"
200echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
201
202# copy gsdl directory across
203msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/gsdl/\"* \"$gsdlhome\"]"
204echo "$msg"
205echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
206$cmd_cpr "${cd_dir}/gsdl/"* "$gsdlhome"
207
208# copy setup shell scripts across too
209msg="--> Install.sh: [$cmd_cp \"${cd_dir}/src/Unix/setup.\"* \"$gsdlhome\"]"
210echo "$msg"
211echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
212$cmd_cp "${cd_dir}/src/Unix/setup."* "$gsdlhome"
213
214# create the tmp directory
215msg="--> Install.sh: [$cmd_mkdir \"$gsdlhome/tmp\"]"
216echo "$msg"
217echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
218$cmd_mkdir "$gsdlhome/tmp"
219
220# make collect directory writable so we can install collections
221msg="--> Install.sh: [$cmd_chmod u+rwx \"$gsdlhome/collect\"]"
222echo "$msg"
223echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
224$cmd_chmod u+rwx "$gsdlhome/collect"
225
226# which collections do we want
227cd "${cd_dir}/collect"
228
229msg="
230The Greenstone demonstration collection has been installed. Would you
231like to install any other collections from the installation cd-rom? [y]"
232echo "$msg"
233echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
234printf "%s" "> "
235read ans
236echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
237if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
238
239 msg="
240Install the greenstone archive (gsarch) - 1Mb? [y]"
241 echo "$msg"
242 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
243 printf "%s" "> "
244 read ans
245 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
246 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
247 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/gsarch\" \"${gsdlhome}/collect\"]"
248 echo "$msg"
249 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
250 $cmd_cpr "${cd_dir}/collect/gsarch" "${gsdlhome}/collect"
251 fi
252
253 msg="
254Install the MSWord and PDF demonstration collection (wordpdf) - 3Mb? [y]"
255 echo "$msg"
256 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
257 printf "%s" "> "
258 read ans
259 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
260 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
261 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/wordpdf\" \"${gsdlhome}/collect\"]"
262 echo "$msg"
263 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
264 $cmd_cpr "${cd_dir}/collect/wordpdf" "${gsdlhome}/collect"
265 fi
266
267 msg="
268Install the Chinese demonstration collection (chinese) - 1Mb? [y]"
269 echo "$msg"
270 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
271 printf "%s" "> "
272 read ans
273 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
274 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
275 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/chinese\" \"${gsdlhome}/collect\"]"
276 echo "$msg"
277 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
278 $cmd_cpr "${cd_dir}/collect/chinese" "${gsdlhome}/collect"
279 fi
280
281 msg="
282Install the food and nutrition library (fnl) - 175 Mb? [y]"
283 echo "$msg"
284 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
285 printf "%s" "> "
286 read ans
287 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
288 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
289 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/fnl\" \"${gsdlhome}/collect\"]"
290 echo "$msg"
291 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
292 $cmd_cpr "${cd_dir}/collect/fnl" "${gsdlhome}/collect"
293 fi
294
295 msg="
296Install the language extraction demonstration collection (folktale) - 2Mb? [y]"
297 echo "$msg"
298 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
299 printf "%s" "> "
300 read ans
301 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
302 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
303 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/folktale\" \"${gsdlhome}/collect\"]"
304 echo "$msg"
305 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
306 $cmd_cpr "${cd_dir}/collect/folktale" "${gsdlhome}/collect"
307 fi
308fi
309
310# set permissions
311msg="
312Setting permissions ...
313--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]"
314echo "$msg"
315echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
316$cmd_chmod -R u+rw "$gsdlhome"
317# gsdl/etc needs to be globally writable
318msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/etc\"]"
319echo "$msg"
320echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
321$cmd_chmod -R a+w "$gsdlhome/etc"
322
323# should gsdl/collect and gsdl/tmp be globally writable?
324msg="
325In order for end-user collection building to be enabled the
326Greenstone cgi program must be able to write to the
327${gsdlhome}/collect and ${gsdlhome}/tmp directories.
328On most systems this means they must be globally writable.
329Make these directories globally writable? [y]"
330echo "$msg"
331echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
332printf "%s" "> "
333read ans
334echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
335if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
336 msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/collect\"]"
337 echo "$msg"
338 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
339 $cmd_chmod -R a+w "$gsdlhome/collect"
340 msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/tmp\"]"
341 echo "$msg"
342 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
343 $cmd_chmod -R a+w "$gsdlhome/tmp"
344fi
345
346# binaries or source code?
347compile="yes"
348if [ "$gsdlos" = "linux" ]; then
349 msg="
350You may either install pre-compiled, statically linked linux [b]inaries
351or install and [c]ompile the Greenstone source code"
352 echo "$msg"
353 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
354
355 found=no
356 while [ "$found" = "no" ]; do
357 msg="Enter \"[b]\" or \"c\""
358 echo "$msg"
359 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
360 printf "%s" "> "
361 read ans
362 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
363 if [ "$ans" = "" ] || [ "$ans" = "b" ]; then
364 compile="no"
365 # install binaries
366 msg="
367Installing linux binaries
368--> Install.sh: [$cmd_cpr \"${cd_dir}/Unix/bin/linux\" \"${gsdlhome}/bin\" ]"
369 echo "$msg"
370 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
371 $cmd_cpr "${cd_dir}/Unix/bin/linux" "${gsdlhome}/bin"
372 msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/bin/linux/\"*]"
373 echo "$msg"
374 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
375 $cmd_chmod a+x "${gsdlhome}/bin/linux/"*
376 msg="--> Install.sh: [$cmd_chmod -R u+rw \"${gsdlhome}/bin/linux\"]"
377 echo "$msg"
378 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
379 $cmd_chmod -R u+rw "${gsdlhome}/bin/linux"
380
381 # move library executable to cgi-bin
382 msg="--> Install.sh: [$cmd_mv \"${gsdlhome}/bin/linux/library\" \"${gsdlhome}/cgi-bin\"]"
383 echo "$msg"
384 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
385 $cmd_mv "${gsdlhome}/bin/linux/library" "${gsdlhome}/cgi-bin"
386
387 found="yes"
388 elif [ "$ans" = "c" ]; then
389 found="yes"
390 fi
391 done
392fi
393
394if [ "$compile" = "yes" ]; then
395 # install source
396 msg="
397Installing source code
398--> Install.sh [$cmd_cpr \"${cd_dir}/src/lib\" \"$gsdlhome\"]"
399 echo "$msg"
400 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
401 $cmd_cpr "${cd_dir}/src/lib" "$gsdlhome"
402 msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/packages\" \"$gsdlhome\"]"
403 echo "$msg"
404 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
405 $cmd_cpr "${cd_dir}/src/packages" "$gsdlhome"
406 msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/src\" \"$gsdlhome\"]"
407 echo "$msg"
408 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
409 $cmd_cpr "${cd_dir}/src/src" "$gsdlhome"
410 msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/Unix/\"* \"$gsdlhome\"]"
411 echo "$msg"
412 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
413 $cmd_cpr "${cd_dir}/src/Unix/"* "$gsdlhome"
414 msg="--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]"
415 echo "$msg"
416 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
417 $cmd_chmod -R u+rw "$gsdlhome"
418 msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/configure\"]"
419 echo "$msg"
420 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
421 $cmd_chmod a+x "${gsdlhome}/configure"
422 msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/packages/yaz/configure\"]"
423 echo "$msg"
424 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
425 $cmd_chmod a+x "${gsdlhome}/packages/yaz/configure"
426
427 # compile it
428 msg="--> Install.sh: [cd $gsdlhome]"
429 echo "$msg"
430 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
431 cd "$gsdlhome"
432 msg="configuring ...
433
434--> Install.sh: [./configure]"
435 echo "$msg"
436 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
437 ./configure
438 msg="compiling ...
439
440--> Install.sh: [make]"
441 echo "$msg"
442 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
443 make
444 msg="installing ...
445
446--> Install.sh: [make install]"
447 echo "$msg"
448 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
449 make install
450 msg="--> Install.sh: [cd $thisdir]"
451 echo "$msg"
452 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
453 cd "$thisdir"
454
455 # check that things compiled ok
456 if [ ! -f "${gsdlhome}/cgi-bin/library" ]; then
457 msg="
458ERROR: Compilation failed
459Greenstone was not installed successfully
460Run the uninstall script (${gsdlhome}/Uninstall.sh)
461to clean up the partial installation."
462 echo "$msg"
463 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
464 exit 1
465 fi
466fi
467
468
469# try to find out hostname
470if [ "$gsdlos" = "linux" ]; then
471 hostname=`hostname -f`
472 if [ "$hostname" = "" ]; then
473 hostname=`hostname -i`
474 fi
475fi
476if [ "$hostname" = "" ]; then
477 hostname=`hostname`
478fi
479if [ "$hostname" = "" ]; then
480 hostname="your-computer-name"
481fi
482
483
484# get cgi-bin directory
485msg="
486
487Greenstone needs a valid cgi executable directory (normally called
488cgi-bin on unix systems) from which to run.
489This may be either:
490 1. The default Greenstone cgi-bin directory (${gsdlhome}/cgi-bin).
491 If you use the Greenstone default you will need to configure
492 your webserver to treat this directory as a cgi executable
493 directory. For the Apache webserver you use the ScriptAlias
494 directive to do this (details of how to configure your webserver
495 will be displayed at the end of this installation procedure)."
496echo "$msg"
497echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
498if [ "$logname" != "root" ]; then
499 msg=" Note that you will probably need help from your system
500 administrator to reconfigure your webserver."
501 echo "$msg"
502 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
503fi
504msg=" 2. An existing cgi-bin directory. Normally a cgi-bin directory
505 is created when your webserver is installed. Typically, this
506 might be /home/httpd/cgi-bin, or /usr/local/apache/cgi-bin, or
507 /var/lib/apache/cgi-bin."
508echo "$msg"
509echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
510if [ "$logname" != "root" ]; then
511 msg=" Many systems also allow individual users to have their own
512 cgi-bin in /home/username/public_html/cgi-bin."
513 echo "$msg"
514 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
515fi
516found=no
517remind_cgi="no"
518remind_cgi_nomove="no"
519while [ "$found" = "no" ]; do
520 msg="Enter \"[1]\" or \"2\""
521 echo "$msg"
522 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
523 printf "%s" "> "
524 read ans
525 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
526 if [ "$ans" = "" ] || [ "$ans" = "1" ]; then
527 found="option1"
528 cgi_bin="${gsdlhome}/cgi-bin"
529 # default gsdl cgi-bin, do nothing
530 msg="
531Don't forget to configure your webserver to treat $cgi_bin
532as a cgi executable directory. Don't worry, you'll be
533reminded of this again at the end of the installation
534procedure"
535 echo "$msg"
536 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
537 remind_cgi="yes"
538 elif [ "$ans" = "2" ]; then
539 found="option2"
540 # external cgi-bin
541 msg="
542Enter existing cgi executable directory [/usr/local/apache/cgi-bin]"
543 echo "$msg"
544 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
545 printf "%s" "> "
546 read ans
547 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
548 if [ "$ans" = "" ]; then
549 cgi_bin="/usr/local/apache/cgi-bin"
550 else
551 cgi_bin="$ans"
552 fi
553 if [ ! -d "$cgi_bin" ]; then
554 msg="Warning: The ${cgi_bin} directory does not exist.
555Create it? [y]"
556 echo "$msg"
557 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
558 printf "%s" "> "
559 read ans
560 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
561 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
562 msg="--> Install.sh: [$cmd_mkdir \"$cgi_bin\"]"
563 echo "$msg"
564 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
565 $cmd_mkdir "$cgi_bin"
566 if [ -d "$cgi_bin" ]; then
567 msg="Don't forget to configure your webserver to treat $cgi_bin
568as a cgi executable directory. Don't worry, you'll be
569reminded of this again at the end of the installation
570procedure"
571 echo "$msg"
572 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
573 remind_cgi="yes"
574 else
575 msg="ERROR: failed to create $cgi_bin directory
576Greenstone installation failed.
577Run the uninstall script (${gsdlhome}/Uninstall.sh)
578to clean up the partial installation."
579 echo "$msg"
580 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
581 exit 1
582 fi
583 fi
584 fi
585
586 if [ ! -w "$cgi_bin" ]; then
587 msg="
588Unable to write to $cgi_bin directory. You will need
589to copy the contents of ${gsdlhome}/cgi-bin
590to $cgi_bin after this installation is completed.
591You'll be reminded of this again at the end of the
592installation procedure."
593 echo "$msg"
594 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
595 remind_cgi_nomove="yes"
596 else
597 # install cgi-bin stuff (update the uninstall script first)
598 cd "$gsdlhome"
599 echo "#!/bin/sh" > Uninstall.sh
600 echo "" >> Uninstall.sh
601 echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> Uninstall.sh
602 echo "$cmd_rm \"${cgi_bin}/library\"" >> Uninstall.sh
603 echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh
604 echo "read ans" >> Uninstall.sh
605 echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh
606 echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh
607 echo "fi" >> Uninstall.sh
608 $cmd_chmod u+x Uninstall.sh
609 cd "$thisdir"
610
611 msg="
612Installing Greenstone cgi programs in $cgi_bin
613--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/gsdlsite.cfg\" \"$cgi_bin\"]"
614 echo "$msg"
615 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
616 $cmd_mv "${gsdlhome}/cgi-bin/gsdlsite.cfg" "$cgi_bin"
617 msg="--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/library\" \"$cgi_bin\"]"
618 echo "$msg"
619 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
620 $cmd_mv "${gsdlhome}/cgi-bin/library" "$cgi_bin"
621 fi
622 fi
623done
624
625# web address of cgi-bin
626web_cgi="http://${hostname}/cgi-bin"
627if [ "$found" = "option1" ]; then
628 web_cgi="http://${hostname}/gsdl/cgi-bin"
629fi
630msg="
631Please enter the web address of the $cgi_bin
632directory. Typically this might be http://localhost/cgi-bin,
633or http://127.0.0.1/cgi-bin, or http://your-computer-name/cgi-bin,
634or http://nnn.nnn.nnn.nn/cgi-bin. [$web_cgi]"
635echo "$msg"
636echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
637printf "%s" "> "
638read ans
639echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
640if [ "$ans" != "" ]; then
641 web_cgi="$ans"
642fi
643
644# get public_html directory
645msg="
646
647In order for Greenstone to run, the $gsdlhome
648directory and all it contains must be accessible from the web.
649To make this happen you may either:
650 1. Configure your webserver so that $gsdlhome
651 is itself accessible from the web."
652echo "$msg"
653echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
654if [ "$logname" != "root" ]; then
655 msg=" Note that you will probably need help from your system
656 administrator to reconfigure your webserver."
657 echo "$msg"
658 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
659fi
660msg=" 2. Provide an existing web accessible directory from which
661 a symbolic link (ln -s) will be made to $gsdlhome.
662 When your server was installed a web accessible directory
663 will have been created (the Apache webserver uses the
664 DocumentRoot directive to define this directory). Typically
665 this directory might be /home/httpd/html, or /usr/local/apache/htdocs,
666 or /var/lib/apache/htdocs."
667echo "$msg"
668echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
669if [ "$logname" != "root" ]; then
670 msg=" Many systems also allow individual users to have their own
671 web accessible directory in /home/username/public_html."
672 echo "$msg"
673 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
674fi
675msg=" Note that your web server will need to be configured to allow
676 symbolic links from within this directory. For the Apache
677 server that means this directory must be configured with
678 the SymLinksIfOwnerMatch or FollowSymLinks option (most Apache
679 installations are configured this way by default)."
680echo "$msg"
681echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
682found="no"
683remind_ph="no"
684remind_ph_nolink="no"
685while [ "$found" = "no" ]; do
686 msg="Enter \"[1]\" or \"2\""
687 echo "$msg"
688 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
689 printf "%s" "> "
690 read ans
691 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
692 if [ "$ans" = "" ] || [ "$ans" = "1" ]; then
693 found="yes"
694 public_html="$gsdlhome"
695 # no link
696 msg="
697Don't forget to configure your webserver to make $gsdlhome
698accessible from the web. You'll be reminded of this again
699at the end of this installation procedure."
700 echo "$msg"
701 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
702 remind_ph="yes"
703 elif [ "$ans" = "2" ]; then
704 found="yes"
705 # external public_html
706 echo
707 public_html="/home/${logname}/public_html"
708 if [ "$logname" = "root" ]; then
709 public_html="/usr/local/apache/htdocs"
710 fi
711 msg="Enter directory that is also accessible from the web [${public_html}]"
712 echo "$msg"
713 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
714 printf "%s" "> "
715 read ans
716 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
717 if [ "$ans" != "" ]; then
718 public_html="$ans"
719 fi
720 # create link to gsdl (and update Uninstall.sh)
721 if [ -w "$public_html" ]; then
722 cd "$gsdlhome"
723 echo "#!/bin/sh" > Uninstall.sh
724 echo "" >> Uninstall.sh
725 echo "$cmd_rm \"$public_html/gsdl\"" >> Uninstall.sh
726 echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> Uninstall.sh
727 echo "$cmd_rm \"${cgi_bin}/library\"" >> Uninstall.sh
728 echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh
729 echo "read ans" >> Uninstall.sh
730 echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh
731 echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh
732 echo "fi" >> Uninstall.sh
733 $cmd_chmod u+x Uninstall.sh
734 cd "$thisdir"
735
736 msg="--> Install.sh: [cd \"$public_html\"]"
737 echo "$msg"
738 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
739 cd "$public_html"
740 msg="--> Install.sh: [$cmd_ln \"$gsdlhome\" gsdl]"
741 echo "$msg"
742 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
743 $cmd_ln "$gsdlhome" gsdl
744 msg="--> Install.sh: [cd \"$thisdir\"]"
745 echo "$msg"
746 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
747 cd "$thisdir"
748 else
749 msg="
750Unable to write to $public_html directory. You will need
751to create a link called gsdl from $public_html to
752$gsdlhome after this installation is completed. You'll be
753reminded of this again at the end of the installation
754procedure."
755 echo "$msg"
756 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
757 old_ph=$public_html
758 remind_ph_nolink="yes"
759 fi
760 public_html="${public_html}/gsdl"
761 fi
762done
763
764
765# get httpprefix
766msg="
767Enter the web address of the $public_html directory.
768This may be a relative url (e.g. \"/gsdl\") or a
769complete url (e.g. \"http://${hostname}/gsdl\") [/gsdl]"
770echo "$msg"
771echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
772printf "%s" ">"
773httpprefix="/gsdl"
774read ans
775echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
776if [ "$ans" != "" ]; then
777 httpprefix="$ans"
778fi
779
780# get initial password
781msg="
782In order to use end-user collection building or to access certain
783parts of the administration pages you must have a password.
784A user with the username \"admin\" will be created for you with
785the password you provide (i.e. to enter any pages requiring user
786authentication enter the \"admin\" username and the password you
787set here).\n";
788echo "$msg"
789echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
790pw=`${gsdlhome}/bin/${gsdlos}/getpw`
791tmp="[admin]
792<comment>
793<enabled>true
794<groups>administrator,colbuilder
795<password>${pw}
796<username>admin
797----------------------------------------------------------------------"
798echo "$tmp" | ${gsdlhome}/bin/${gsdlos}/txt2db "${gsdlhome}/etc/users.db"
799$cmd_chmod a+rw "${gsdlhome}/etc/users.db"
800
801# edit gsdlsite.cfg
802cd "$cgi_bin"
803sed "s|\(gsdlhome *\)[^ ]*|\1${gsdlhome}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
804sed "s|#*\(httpprefix *\)[^ ]*|\1${httpprefix}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
805sed "s|\(httpimg *\)[^ ]*|\1${httpprefix}/images|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
806
807msg="
808
809Greenstone installation completed successfully."
810echo "$msg"
811echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
812if [ "$remind_cgi" = "yes" ]; then
813 msg=" * Don't forget to configure your webserver to treat
814 $cgi_bin as a cgi executable directory."
815 echo "$msg"
816 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
817
818 apache_web_cgi=`echo "$web_cgi" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"`
819 cgi_bin_slash=`echo "$cgi_bin" | sed "s|/*$|/|"`
820 cgi_bin_noslash=`echo "$cgi_bin" | sed "s|/*$||"`
821
822 msg=" For the Apache webserver this means adding the following
823 ScriptAlias directive to your httpd.conf configuration file.
824
825 ScriptAlias ${apache_web_cgi} \"${cgi_bin_slash}\"
826 <Directory \"${cgi_bin_noslash}\">
827 AllowOverride None
828 Options None
829 Order allow,deny
830 Allow from all
831 </Directory>
832"
833 echo "$msg"
834 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
835fi
836if [ "$remind_cgi_nomove" = "yes" ]; then
837 msg=" * Don't forget to move the contents of ${gsdlhome}/cgi-bin
838 to $cgi_bin
839"
840 echo "$msg"
841 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
842fi
843if [ "$remind_ph" = "yes" ]; then
844 msg=" * Don't forget to configure your webserver to treat
845 $gsdlhome as a web accessible directory."
846 echo "$msg"
847 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
848
849 apache_httpprefix=`echo "$httpprefix" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"`
850 public_html_slash=`echo "$public_html" | sed "s|/*$|/|"`
851 public_html_noslash=`echo "$public_html" | sed "s|/*$||"`
852
853 msg=" For the Apache webserver this means adding the following
854 Alias directive to your httpd.conf configuration file.
855
856 Alias ${apache_httpprefix} \"${public_html_slash}\"
857 <Directory \"${public_html_noslash}\">
858 Options Indexes MultiViews FollowSymLinks
859 AllowOverride None
860 Order allow,deny
861 Allow from all
862 </Directory>
863"
864 echo "$msg"
865 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
866fi
867if [ "$remind_ph_nolink" = "yes" ]; then
868 msg=" * Don't forget to create a link called gsdl from $old_ph
869 to ${gsdlhome}.
870"
871 echo "$msg"
872 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
873fi
874msg="The output of this script has been recorded for you at
875${gsdlhome}/INSTALL_RECORD.
876You may remove Greenstone from your system at any time by running
877the ${gsdlhome}/Uninstall.sh script.
878Access Greenstone by pointing a web browser at
879${web_cgi}/library
880"
881echo "$msg"
882echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
883
884exit 0
Note: See TracBrowser for help on using the repository browser.