source: trunk/gsdl/Install.sh@ 2430

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

* empty log message *

  • Property svn:executable set to *
  • Property svn:mime-type set to application/octet-stream
File size: 28.6 KB
Line 
1#!/bin/sh
2
3## Install.sh -- Install Greenstone
4
5cmd_cp="cp"
6cmd_cpr="cp -r"
7cmd_chmod="chmod"
8cmd_mkdir="mkdir -p"
9cmd_ln="ln -s"
10cmd_mv="mv"
11cmd_rm="rm -i"
12cmd_rmr="rm -r"
13
14thisdir=`pwd`
15cd ..
16cd_dir=`pwd`
17cd "$thisdir"
18
19# script must be run from within cdrom/unix directory
20if [ ! -f "${thisdir}/Install.sh" ]; then
21 echo "Install.sh must be run from the directory in which it resides"
22 echo "Greenstone was not installed"
23 exit 1
24fi
25
26# check that various important directories are on the cd
27if [ ! -d "${cd_dir}/gsdl" ]; then
28 echo
29 echo "ERROR: Could not locate ${cd_dir}/gsdl"
30 echo "Greenstone was not installed"
31 exit 1
32fi
33if [ ! -d "${cd_dir}/Unix/bin/linux" ]; then
34 echo
35 echo "ERROR: Could not locate ${cd_dir}/Unix/bin/linux"
36 echo "Greenstone was not installed"
37 exit 1
38fi
39
40
41# install to /usr/local by default if user is "root", otherwise
42# default to users home directory
43gsdlos=`uname | tr A-Z a-z`
44if [ "$gsdlos" = "linux" ]; then
45 logname=`whoami`
46else
47 logname=""
48fi
49if [ "$logname" = "" ]; then
50 logname=`logname`
51fi
52gsdlhome="/home/${logname}"
53if [ "$logname" = "root" ]; then
54 gsdlhome="/usr/local"
55fi
56
57# get gsdlhome
58msg="This script will install Greenstone on your system. You may want
59to skim through the Install.pdf document that resides in the docs
60directory on this cd-rom before continuing with the installation.
61
62Note that when prompted for input, hitting \"enter\" will select
63the default (given in square brackets [] at the end of each question).
64If you're unsure which option to select, use the default.
65
66Note also that Install.sh prints out information on any commands
67it runs on your system in the form \"--> Install.sh: [command]\".
68
69It is assumed throughout this installation procedure that you
70have a webserver installed on your system.
71
72For later reference the output of this install script will be
73recorded in a file called INSTALL_RECORD in the directory into
74which you choose to install Greenstone.
75
76Continue? [y]"
77echo "$msg"
78printf "%s" "> "
79read ans
80log="${log}${msg}
81> $ans
82"
83if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
84 echo "Greenstone was not installed"
85 exit 0
86fi
87
88msg="
89Which directory should Greenstone be installed to?
90Make sure that this directory is on a partition with sufficient
91free disk space for the installation option you intend
92selecting.
93"
94if [ "$gsdlos" = "linux" ]; then
95msg="${msg}--A standard linux binary installation requires approximately
96 50Mb of free disk space (not including additional collections).
97"
98fi
99msg="${msg}--Compiling Greenstone from source code requires approximately
100 155Mb of free disk space (not including additional collections).
101--Optional Greenstone demonstration collections may require up
102 to 200Mb of free disk space (you'll be told the size of
103 individual collections before you install them)
104Enter directory to install Greenstone into. A gsdl directory
105will be created in this directory. [${gsdlhome}]"
106echo "$msg"
107printf "%s" "> "
108read ans
109log="${log}${msg}
110> $ans
111"
112if [ "$ans" != "" ]; then
113 gsdlhome="$ans"
114fi
115
116if [ ! -d "$gsdlhome" ]; then
117 msg="
118Warning: The ${gsdlhome} directory does not exist.
119Create it? [y]"
120 echo "$msg"
121 printf "%s" "> "
122 read ans
123 log="${log}${msg}
124> $ans
125"
126 if [ "$ans" = "" ]; then
127 ans="y"
128 fi
129 if [ "$ans" = "y" ]; then
130 msg="--> Install.sh: [$cmd_mkdir \"$gsdlhome\"]"
131 echo "$msg"
132 log="${log}${msg}
133"
134 $cmd_mkdir "$gsdlhome"
135 if [ ! -d "$gsdlhome" ]; then
136 echo "ERROR: failed to create $gsdlhome directory"
137 echo "Greenstone was not installed"
138 exit 1
139 fi
140 else
141 echo "Greenstone was not installed"
142 exit 0
143 fi
144fi
145
146# from now on $gsdlhome includes the "/gsdl"
147gsdlhome="${gsdlhome}/gsdl"
148msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}\"]"
149echo "$msg"
150log="${log}${msg}
151"
152$cmd_mkdir "$gsdlhome"
153if [ ! -d "$gsdlhome" ]; then
154 echo "ERROR: failed to create $gsdlhome directory"
155 echo "Greenstone was not installed"
156 exit 1
157fi
158# set permissions on gsdlhome directory (not that we should need to)
159msg="--> Install.sh: [$cmd_chmod u+rwx \"${gsdlhome}\"]"
160echo "$msg"
161log="${log}${msg}
162"
163$cmd_chmod u+rwx "$gsdlhome"
164
165# create initial Uninstall.sh
166cd "$gsdlhome"
167echo "#!/bin/sh" > Uninstall.sh
168echo "" >> Uninstall.sh
169echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh
170echo "read ans" >> Uninstall.sh
171echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh
172echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh
173echo "fi" >> Uninstall.sh
174$cmd_chmod u+x Uninstall.sh
175cd "$thisdir"
176
177# create initial INSTALL_RECORD
178echo "$log" >> "${gsdlhome}/INSTALL_RECORD"
179
180msg="
181If this installation fails or is cancelled, run the uninstall
182script (${gsdlhome}/Uninstall.sh) to clean up the partial
183installation.
184Continue? [y]"
185echo "$msg"
186echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
187printf "%s" "> "
188read ans
189echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
190if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
191 msg="Greenstone was not installed"
192 echo "$msg"
193 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
194 exit 0
195fi
196
197msg="
198Installing Greenstone directory structure to ${gsdlhome}"
199echo "$msg"
200echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
201
202# copy gsdl directory across
203msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/gsdl/\"* \"$gsdlhome\"]"
204echo "$msg"
205echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
206$cmd_cpr "${cd_dir}/gsdl/"* "$gsdlhome"
207
208# copy across those parts of bin/windows that are required by exportcol.pl
209$net16dir="${cd_dir}/Windows/bin/windows/net16"
210$net32dir="${cd_dir}/Windows/bin/windows/net32"
211$netscapedir="${cd_dir}/Windows/bin/windows/netscape"
212$netwin32s="${cd_dir}/Windows/bin/windows/Win32s"
213if [ ! -d "${gsdlhome}/bin/windows" ]; then
214 $msg="--> Install.sh: [$cmd_mkdir \"${gsdlhome}/bin/windows\"]";
215 echo "$msg"
216 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
217 $cmd_mkdir "${gsdlhome}/bin/windows"
218fi
219if [ -d "$net16dir" ]; then
220 msg="--> Install.sh [$cmd_cpr \"${net16dir}\" \"${gsdlhome}/bin/windows\"]"
221 echo "$msg"
222 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
223 $cmd_cpr "$net16dir" "${gsdlhome}/bin/windows"
224fi
225if [ -d "$net32dir" ]; then
226 msg="--> Install.sh [$cmd_cpr \"${net32dir}\" \"${gsdlhome}/bin/windows\"]"
227 echo "$msg"
228 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
229 $cmd_cpr "$net32dir" "${gsdlhome}/bin/windows"
230fi
231if [ -d "$netscapedir" ]; then
232 msg="--> Install.sh [$cmd_cpr \"${netscapedir}\" \"${gsdlhome}/bin/windows\"]"
233 echo "$msg"
234 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
235 $cmd_cpr "$netscapedir" "${gsdlhome}/bin/windows"
236fi
237if [ -d "$win32sdir" ]; then
238 msg="--> Install.sh [$cmd_cpr \"${win32sdir}\" \"${gsdlhome}/bin/windows\"]"
239 echo "$msg"
240 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
241 $cmd_cpr "$win32sdir" "${gsdlhome}/bin/windows"
242fi
243
244# copy setup shell scripts across too
245msg="--> Install.sh: [$cmd_cp \"${cd_dir}/src/Unix/setup.\"* \"$gsdlhome\"]"
246echo "$msg"
247echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
248$cmd_cp "${cd_dir}/src/Unix/setup."* "$gsdlhome"
249
250# create the tmp directory
251msg="--> Install.sh: [$cmd_mkdir \"$gsdlhome/tmp\"]"
252echo "$msg"
253echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
254$cmd_mkdir "$gsdlhome/tmp"
255
256# make collect directory writable so we can install collections
257msg="--> Install.sh: [$cmd_chmod u+rwx \"$gsdlhome/collect\"]"
258echo "$msg"
259echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
260$cmd_chmod u+rwx "$gsdlhome/collect"
261
262# which collections do we want
263cd "${cd_dir}/collect"
264
265msg="The Greenstone demonstration collection has been installed. Would you
266like to install any other collections from the installation cd-rom? [y]"
267echo "$msg"
268echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
269printf "%s" "> "
270read ans
271echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
272if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
273
274 msg="Install the greenstone archive (gsarch) - 1Mb? [y]"
275 echo "$msg"
276 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
277 printf "%s" "> "
278 read ans
279 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
280 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
281 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/gsarch\" \"${gsdlhome}/collect\"]"
282 echo "$msg"
283 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
284 $cmd_cpr "${cd_dir}/collect/gsarch" "${gsdlhome}/collect"
285 fi
286
287 msg="Install the MSWord and PDF demonstration collection (wordpdf) - 3Mb? [y]"
288 echo "$msg"
289 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
290 printf "%s" "> "
291 read ans
292 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
293 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
294 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/wordpdf\" \"${gsdlhome}/collect\"]"
295 echo "$msg"
296 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
297 $cmd_cpr "${cd_dir}/collect/wordpdf" "${gsdlhome}/collect"
298 fi
299
300 msg="Install the Chinese demonstration collection (chinese) - 1Mb? [y]"
301 echo "$msg"
302 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
303 printf "%s" "> "
304 read ans
305 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
306 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
307 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/chinese\" \"${gsdlhome}/collect\"]"
308 echo "$msg"
309 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
310 $cmd_cpr "${cd_dir}/collect/chinese" "${gsdlhome}/collect"
311 fi
312
313 msg="Install the food and nutrition library (fnl) - 175 Mb? [y]"
314 echo "$msg"
315 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
316 printf "%s" "> "
317 read ans
318 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
319 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
320 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/fnl\" \"${gsdlhome}/collect\"]"
321 echo "$msg"
322 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
323 $cmd_cpr "${cd_dir}/collect/fnl" "${gsdlhome}/collect"
324 fi
325
326 msg="Install the language extraction demonstration collection (folktale) - 2Mb? [y]"
327 echo "$msg"
328 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
329 printf "%s" "> "
330 read ans
331 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
332 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
333 msg="--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/folktale\" \"${gsdlhome}/collect\"]"
334 echo "$msg"
335 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
336 $cmd_cpr "${cd_dir}/collect/folktale" "${gsdlhome}/collect"
337 fi
338fi
339
340# set permissions
341msg="
342Setting permissions ...
343--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]"
344echo "$msg"
345echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
346$cmd_chmod -R u+rw "$gsdlhome"
347# gsdl/etc needs to be globally writable
348msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/etc\"]"
349echo "$msg"
350echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
351$cmd_chmod -R a+w "$gsdlhome/etc"
352
353# should gsdl/collect and gsdl/tmp be globally writable?
354msg="
355In order for end-user collection building to be enabled the
356Greenstone cgi program must be able to write to the
357${gsdlhome}/collect and ${gsdlhome}/tmp directories.
358On most systems this means they must be globally writable.
359Make these directories globally writable? [y]"
360echo "$msg"
361echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
362printf "%s" "> "
363read ans
364echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
365if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
366 msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/collect\"]"
367 echo "$msg"
368 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
369 $cmd_chmod -R a+w "$gsdlhome/collect"
370 msg="--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/tmp\"]"
371 echo "$msg"
372 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
373 $cmd_chmod -R a+w "$gsdlhome/tmp"
374fi
375
376# binaries or source code?
377compile="yes"
378if [ "$gsdlos" = "linux" ]; then
379 msg="
380You may either install pre-compiled, statically linked linux [b]inaries
381or install and [c]ompile the Greenstone source code"
382 echo "$msg"
383 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
384
385 found=no
386 while [ "$found" = "no" ]; do
387 msg="Enter \"[b]\" or \"c\""
388 echo "$msg"
389 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
390 printf "%s" "> "
391 read ans
392 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
393 if [ "$ans" = "" ] || [ "$ans" = "b" ]; then
394 compile="no"
395 # install binaries
396 msg="
397Installing linux binaries
398--> Install.sh: [$cmd_cpr \"${cd_dir}/Unix/bin/linux\" \"${gsdlhome}/bin\" ]"
399 echo "$msg"
400 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
401 $cmd_cpr "${cd_dir}/Unix/bin/linux" "${gsdlhome}/bin"
402 msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/bin/linux/\"*]"
403 echo "$msg"
404 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
405 $cmd_chmod a+x "${gsdlhome}/bin/linux/"*
406 msg="--> Install.sh: [$cmd_chmod -R u+rw \"${gsdlhome}/bin/linux\"]"
407 echo "$msg"
408 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
409 $cmd_chmod -R u+rw "${gsdlhome}/bin/linux"
410
411 # move library executable to cgi-bin
412 msg="--> Install.sh: [$cmd_mv \"${gsdlhome}/bin/linux/library\" \"${gsdlhome}/cgi-bin\"]"
413 echo "$msg"
414 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
415 $cmd_mv "${gsdlhome}/bin/linux/library" "${gsdlhome}/cgi-bin"
416
417 found="yes"
418 elif [ "$ans" = "c" ]; then
419 found="yes"
420 fi
421 done
422fi
423
424if [ "$compile" = "yes" ]; then
425 # install source
426 msg="
427Installing source code
428--> Install.sh [$cmd_cpr \"${cd_dir}/src/lib\" \"$gsdlhome\"]"
429 echo "$msg"
430 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
431 $cmd_cpr "${cd_dir}/src/lib" "$gsdlhome"
432 msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/packages\" \"$gsdlhome\"]"
433 echo "$msg"
434 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
435 $cmd_cpr "${cd_dir}/src/packages" "$gsdlhome"
436 msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/src\" \"$gsdlhome\"]"
437 echo "$msg"
438 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
439 $cmd_cpr "${cd_dir}/src/src" "$gsdlhome"
440 msg="--> Install.sh [$cmd_cpr \"${cd_dir}/src/Unix/\"* \"$gsdlhome\"]"
441 echo "$msg"
442 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
443 $cmd_cpr "${cd_dir}/src/Unix/"* "$gsdlhome"
444 msg="--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]"
445 echo "$msg"
446 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
447 $cmd_chmod -R u+rw "$gsdlhome"
448 msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/configure\"]"
449 echo "$msg"
450 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
451 $cmd_chmod a+x "${gsdlhome}/configure"
452 msg="--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/packages/yaz/configure\"]"
453 echo "$msg"
454 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
455 $cmd_chmod a+x "${gsdlhome}/packages/yaz/configure"
456
457 # compile it
458 msg="--> Install.sh: [cd $gsdlhome]"
459 echo "$msg"
460 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
461 cd "$gsdlhome"
462 msg="configuring ...
463
464--> Install.sh: [./configure]"
465 echo "$msg"
466 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
467 ./configure
468 msg="compiling ...
469
470--> Install.sh: [make]"
471 echo "$msg"
472 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
473 make
474 msg="installing ...
475
476--> Install.sh: [make install]"
477 echo "$msg"
478 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
479 make install
480 msg="--> Install.sh: [cd $thisdir]"
481 echo "$msg"
482 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
483 cd "$thisdir"
484
485 # check that things compiled ok
486 if [ ! -f "${gsdlhome}/cgi-bin/library" ]; then
487 msg="
488ERROR: Compilation failed
489Greenstone was not installed successfully
490Run the uninstall script (${gsdlhome}/Uninstall.sh)
491to clean up the partial installation."
492 echo "$msg"
493 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
494 exit 1
495 fi
496fi
497
498
499# try to find out hostname
500if [ "$gsdlos" = "linux" ]; then
501 hostname=`hostname -f`
502 if [ "$hostname" = "" ]; then
503 hostname=`hostname -i`
504 fi
505fi
506if [ "$hostname" = "" ]; then
507 hostname=`hostname`
508fi
509if [ "$hostname" = "" ]; then
510 hostname="your-computer-name"
511fi
512
513
514# get cgi-bin directory
515msg="
516
517Greenstone needs a valid cgi executable directory (normally called
518cgi-bin on unix systems) from which to run.
519This may be either:
520 1. The default Greenstone cgi-bin directory (${gsdlhome}/cgi-bin).
521 If you use the Greenstone default you will need to configure
522 your webserver to treat this directory as a cgi executable
523 directory. For the Apache webserver you use the ScriptAlias
524 directive to do this (details of how to configure your webserver
525 will be displayed at the end of this installation procedure)."
526echo "$msg"
527echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
528if [ "$logname" != "root" ]; then
529 msg=" Note that you will probably need help from your system
530 administrator to reconfigure your webserver."
531 echo "$msg"
532 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
533fi
534msg=" 2. An existing cgi-bin directory. Normally a cgi-bin directory
535 is created when your webserver is installed. Typically, this
536 might be /home/httpd/cgi-bin, or /usr/local/apache/cgi-bin, or
537 /var/lib/apache/cgi-bin."
538echo "$msg"
539echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
540if [ "$logname" != "root" ]; then
541 msg=" Many systems also allow individual users to have their own
542 cgi-bin in /home/username/public_html/cgi-bin."
543 echo "$msg"
544 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
545fi
546found=no
547remind_cgi="no"
548remind_cgi_nomove="no"
549while [ "$found" = "no" ]; do
550 msg="Enter \"[1]\" or \"2\""
551 echo "$msg"
552 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
553 printf "%s" "> "
554 read ans
555 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
556 if [ "$ans" = "" ] || [ "$ans" = "1" ]; then
557 found="option1"
558 cgi_bin="${gsdlhome}/cgi-bin"
559 # default gsdl cgi-bin, do nothing
560 msg="
561Don'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 elif [ "$ans" = "2" ]; then
569 found="option2"
570 # external cgi-bin
571 msg="
572Enter existing cgi executable directory [/usr/local/apache/cgi-bin]"
573 echo "$msg"
574 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
575 printf "%s" "> "
576 read ans
577 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
578 if [ "$ans" = "" ]; then
579 cgi_bin="/usr/local/apache/cgi-bin"
580 else
581 cgi_bin="$ans"
582 fi
583 if [ ! -d "$cgi_bin" ]; then
584 msg="Warning: The ${cgi_bin} directory does not exist.
585Create it? [y]"
586 echo "$msg"
587 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
588 printf "%s" "> "
589 read ans
590 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
591 if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
592 msg="--> Install.sh: [$cmd_mkdir \"$cgi_bin\"]"
593 echo "$msg"
594 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
595 $cmd_mkdir "$cgi_bin"
596 if [ -d "$cgi_bin" ]; then
597 msg="Don't forget to configure your webserver to treat $cgi_bin
598as a cgi executable directory. Don't worry, you'll be
599reminded of this again at the end of the installation
600procedure"
601 echo "$msg"
602 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
603 remind_cgi="yes"
604 else
605 msg="ERROR: failed to create $cgi_bin directory
606Greenstone installation failed.
607Run the uninstall script (${gsdlhome}/Uninstall.sh)
608to clean up the partial installation."
609 echo "$msg"
610 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
611 exit 1
612 fi
613 fi
614 fi
615
616 if [ ! -w "$cgi_bin" ]; then
617 msg="
618Unable to write to $cgi_bin directory. You will need
619to copy the contents of ${gsdlhome}/cgi-bin
620to $cgi_bin after this installation is completed.
621You'll be reminded of this again at the end of the
622installation procedure."
623 echo "$msg"
624 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
625 remind_cgi_nomove="yes"
626 else
627 # install cgi-bin stuff (update the uninstall script first)
628 cd "$gsdlhome"
629 echo "#!/bin/sh" > Uninstall.sh
630 echo "" >> Uninstall.sh
631 echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> Uninstall.sh
632 echo "$cmd_rm \"${cgi_bin}/library\"" >> Uninstall.sh
633 echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh
634 echo "read ans" >> Uninstall.sh
635 echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh
636 echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh
637 echo "fi" >> Uninstall.sh
638 $cmd_chmod u+x Uninstall.sh
639 cd "$thisdir"
640
641 msg="
642Installing Greenstone cgi programs in $cgi_bin
643--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/gsdlsite.cfg\" \"$cgi_bin\"]"
644 echo "$msg"
645 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
646 $cmd_mv "${gsdlhome}/cgi-bin/gsdlsite.cfg" "$cgi_bin"
647 msg="--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/library\" \"$cgi_bin\"]"
648 echo "$msg"
649 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
650 $cmd_mv "${gsdlhome}/cgi-bin/library" "$cgi_bin"
651 fi
652 fi
653done
654
655# web address of cgi-bin
656web_cgi="http://${hostname}/cgi-bin"
657if [ "$found" = "option1" ]; then
658 web_cgi="http://${hostname}/gsdl/cgi-bin"
659fi
660msg="
661Please enter the web address of the $cgi_bin
662directory. Typically this might be http://localhost/cgi-bin,
663or http://127.0.0.1/cgi-bin, or http://your-computer-name/cgi-bin,
664or http://nnn.nnn.nnn.nn/cgi-bin. [$web_cgi]"
665echo "$msg"
666echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
667printf "%s" "> "
668read ans
669echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
670if [ "$ans" != "" ]; then
671 web_cgi="$ans"
672fi
673
674# get public_html directory
675msg="
676
677In order for Greenstone to run, the $gsdlhome
678directory and all it contains must be accessible from the web.
679To make this happen you may either:
680 1. Configure your webserver so that $gsdlhome
681 is itself accessible from the web."
682echo "$msg"
683echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
684if [ "$logname" != "root" ]; then
685 msg=" Note that you will probably need help from your system
686 administrator to reconfigure your webserver."
687 echo "$msg"
688 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
689fi
690msg=" 2. Provide an existing web accessible directory from which
691 a symbolic link (ln -s) will be made to $gsdlhome.
692 When your server was installed a web accessible directory
693 will have been created (the Apache webserver uses the
694 DocumentRoot directive to define this directory). Typically
695 this directory might be /home/httpd/html, or /usr/local/apache/htdocs,
696 or /var/lib/apache/htdocs."
697echo "$msg"
698echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
699if [ "$logname" != "root" ]; then
700 msg=" Many systems also allow individual users to have their own
701 web accessible directory in /home/username/public_html."
702 echo "$msg"
703 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
704fi
705msg=" Note that your web server will need to be configured to allow
706 symbolic links from within this directory. For the Apache
707 server that means this directory must be configured with
708 the SymLinksIfOwnerMatch or FollowSymLinks option (most Apache
709 installations are configured this way by default)."
710echo "$msg"
711echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
712found="no"
713remind_ph="no"
714remind_ph_nolink="no"
715while [ "$found" = "no" ]; do
716 msg="Enter \"[1]\" or \"2\""
717 echo "$msg"
718 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
719 printf "%s" "> "
720 read ans
721 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
722 if [ "$ans" = "" ] || [ "$ans" = "1" ]; then
723 found="yes"
724 public_html="$gsdlhome"
725 # no link
726 msg="
727Don't forget to configure your webserver to make $gsdlhome
728accessible from the web. You'll be reminded of this again
729at the end of this installation procedure."
730 echo "$msg"
731 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
732 remind_ph="yes"
733 elif [ "$ans" = "2" ]; then
734 found="yes"
735 # external public_html
736 echo
737 public_html="/home/${logname}/public_html"
738 if [ "$logname" = "root" ]; then
739 public_html="/usr/local/apache/htdocs"
740 fi
741 msg="Enter directory that is also accessible from the web [${public_html}]"
742 echo "$msg"
743 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
744 printf "%s" "> "
745 read ans
746 echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
747 if [ "$ans" != "" ]; then
748 public_html="$ans"
749 fi
750 # create link to gsdl (and update Uninstall.sh)
751 if [ -w "$public_html" ]; then
752 cd "$gsdlhome"
753 echo "#!/bin/sh" > Uninstall.sh
754 echo "" >> Uninstall.sh
755 echo "$cmd_rm \"$public_html/gsdl\"" >> Uninstall.sh
756 echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> Uninstall.sh
757 echo "$cmd_rm \"${cgi_bin}/library\"" >> Uninstall.sh
758 echo "echo \"remove ${gsdlhome} directory? [y]\"" >> Uninstall.sh
759 echo "read ans" >> Uninstall.sh
760 echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> Uninstall.sh
761 echo " $cmd_rmr \"$gsdlhome\"" >> Uninstall.sh
762 echo "fi" >> Uninstall.sh
763 $cmd_chmod u+x Uninstall.sh
764 cd "$thisdir"
765
766 msg="--> Install.sh: [cd \"$public_html\"]"
767 echo "$msg"
768 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
769 cd "$public_html"
770 msg="--> Install.sh: [$cmd_ln \"$gsdlhome\" gsdl]"
771 echo "$msg"
772 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
773 $cmd_ln "$gsdlhome" gsdl
774 msg="--> Install.sh: [cd \"$thisdir\"]"
775 echo "$msg"
776 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
777 cd "$thisdir"
778 else
779 msg="
780Unable to write to $public_html directory. You will need
781to create a link called gsdl from $public_html to
782$gsdlhome after this installation is completed. You'll be
783reminded of this again at the end of the installation
784procedure."
785 echo "$msg"
786 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
787 old_ph=$public_html
788 remind_ph_nolink="yes"
789 fi
790 public_html="${public_html}/gsdl"
791 fi
792done
793
794
795# get httpprefix
796msg="
797Enter the web address of the $public_html directory.
798This may be a relative url (e.g. \"/gsdl\") or a
799complete url (e.g. \"http://${hostname}/gsdl\") [/gsdl]"
800echo "$msg"
801echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
802printf "%s" ">"
803httpprefix="/gsdl"
804read ans
805echo "> $ans" >> "${gsdlhome}/INSTALL_RECORD"
806if [ "$ans" != "" ]; then
807 httpprefix="$ans"
808fi
809
810# get initial password
811msg="
812In order to use end-user collection building or to access certain
813parts of the administration pages you must have a password.
814A user with the username \"admin\" will be created for you with
815the password you provide (i.e. to enter any pages requiring user
816authentication enter the \"admin\" username and the password you
817set here).\n";
818echo "$msg"
819echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
820pw=`${gsdlhome}/bin/${gsdlos}/getpw`
821tmp="[admin]
822<comment>
823<enabled>true
824<groups>administrator,colbuilder
825<password>${pw}
826<username>admin
827----------------------------------------------------------------------"
828echo "$tmp" | ${gsdlhome}/bin/${gsdlos}/txt2db "${gsdlhome}/etc/users.db"
829$cmd_chmod a+rw "${gsdlhome}/etc/users.db"
830
831# edit gsdlsite.cfg
832cd "$cgi_bin"
833sed "s|\(gsdlhome *\)[^ ]*|\1${gsdlhome}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
834sed "s|#*\(httpprefix *\)[^ ]*|\1${httpprefix}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
835sed "s|\(httpimg *\)[^ ]*|\1${httpprefix}/images|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
836
837msg="
838
839Greenstone installation completed successfully."
840echo "$msg"
841echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
842if [ "$remind_cgi" = "yes" ]; then
843 msg=" * Don't forget to configure your webserver to treat
844 $cgi_bin as a cgi executable directory."
845 echo "$msg"
846 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
847
848 apache_web_cgi=`echo "$web_cgi" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"`
849 cgi_bin_slash=`echo "$cgi_bin" | sed "s|/*$|/|"`
850 cgi_bin_noslash=`echo "$cgi_bin" | sed "s|/*$||"`
851
852 msg=" For the Apache webserver this means adding the following
853 ScriptAlias directive to your httpd.conf configuration file.
854
855 ScriptAlias ${apache_web_cgi} \"${cgi_bin_slash}\"
856 <Directory \"${cgi_bin_noslash}\">
857 AllowOverride None
858 Options None
859 Order allow,deny
860 Allow from all
861 </Directory>
862"
863 echo "$msg"
864 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
865fi
866if [ "$remind_cgi_nomove" = "yes" ]; then
867 msg=" * Don't forget to move the contents of ${gsdlhome}/cgi-bin
868 to $cgi_bin
869"
870 echo "$msg"
871 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
872fi
873if [ "$remind_ph" = "yes" ]; then
874 msg=" * Don't forget to configure your webserver to treat
875 $gsdlhome as a web accessible directory."
876 echo "$msg"
877 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
878
879 apache_httpprefix=`echo "$httpprefix" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"`
880 public_html_slash=`echo "$public_html" | sed "s|/*$|/|"`
881 public_html_noslash=`echo "$public_html" | sed "s|/*$||"`
882
883 msg=" For the Apache webserver this means adding the following
884 Alias directive to your httpd.conf configuration file.
885
886 Alias ${apache_httpprefix} \"${public_html_slash}\"
887 <Directory \"${public_html_noslash}\">
888 Options Indexes MultiViews FollowSymLinks
889 AllowOverride None
890 Order allow,deny
891 Allow from all
892 </Directory>
893"
894 echo "$msg"
895 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
896fi
897if [ "$remind_ph_nolink" = "yes" ]; then
898 msg=" * Don't forget to create a link called gsdl from $old_ph
899 to ${gsdlhome}.
900"
901 echo "$msg"
902 echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
903fi
904msg="The output of this script has been recorded for you at
905${gsdlhome}/INSTALL_RECORD.
906You may remove Greenstone from your system at any time by running
907the ${gsdlhome}/Uninstall.sh script.
908Access Greenstone by pointing a web browser at
909${web_cgi}/library
910"
911echo "$msg"
912echo "$msg" >> "${gsdlhome}/INSTALL_RECORD"
913
914exit 0
Note: See TracBrowser for help on using the repository browser.