source: trunk/gsdl/Install.sh@ 2325

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

* empty log message *

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