source: trunk/gsdl/Install.sh@ 2431

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