source: trunk/gsdl/Install.sh@ 2565

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

Install.sh now installs PDF manuals to hard drive

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