source: trunk/gsdl/Install.sh@ 2435

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