source: trunk/gsdl/Install.sh@ 2637

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