source: trunk/gsdl/Install.sh@ 2291

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