source: trunk/gsdl/Install.sh@ 2290

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

Unix install script now creates an install log

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