source: trunk/gsdl/Install.sh@ 2307

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