1 | #!/bin/sh
|
---|
2 |
|
---|
3 | ## Install.sh -- Install Greenstone
|
---|
4 |
|
---|
5 | cmd_cp="cp"
|
---|
6 | cmd_cpr="cp -r"
|
---|
7 | cmd_chmod="chmod"
|
---|
8 | cmd_mkdir="mkdir -p"
|
---|
9 | cmd_ln="ln -s"
|
---|
10 | cmd_mv="mv"
|
---|
11 | cmd_rm="rm -i"
|
---|
12 | cmd_rmr="rm -r"
|
---|
13 |
|
---|
14 | thisdir=`pwd`
|
---|
15 | cd ..
|
---|
16 | cd_dir=`pwd`
|
---|
17 | cd "$thisdir"
|
---|
18 |
|
---|
19 | # script must be run from within cdrom/unix directory
|
---|
20 | if [ ! -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
|
---|
24 | fi
|
---|
25 |
|
---|
26 | # check that various important directories are on the cd
|
---|
27 | if [ ! -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
|
---|
32 | fi
|
---|
33 | if [ ! -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
|
---|
38 | fi
|
---|
39 |
|
---|
40 |
|
---|
41 | # install to /usr/local by default if user is "root", otherwise
|
---|
42 | # default to users home directory
|
---|
43 | gsdlos=`uname | tr A-Z a-z`
|
---|
44 | if [ "$gsdlos" = "linux" ]; then
|
---|
45 | logname=`whoami`
|
---|
46 | else
|
---|
47 | logname=""
|
---|
48 | fi
|
---|
49 | if [ "$logname" = "" ]; then
|
---|
50 | logname=`logname`
|
---|
51 | fi
|
---|
52 | gsdlhome="/home/${logname}"
|
---|
53 | if [ "$logname" = "root" ]; then
|
---|
54 | gsdlhome="/usr/local"
|
---|
55 | fi
|
---|
56 |
|
---|
57 | # get gsdlhome
|
---|
58 | echo
|
---|
59 | echo "This script will install Greenstone on your system. You may want"
|
---|
60 | echo "to skim through the Install.pdf document that resides in the docs"
|
---|
61 | echo "directory of this cd-rom before continuing with the installation."
|
---|
62 | echo
|
---|
63 | echo "Note that when prompted for input, hitting \"enter\" will select"
|
---|
64 | echo "the default (given in square brackets [] at the end of each question)."
|
---|
65 | echo
|
---|
66 | echo "Note also that Install.sh prints out information on any commands"
|
---|
67 | echo "it runs on your system in the form \"--> Install.sh: [command]\"."
|
---|
68 | echo
|
---|
69 | echo "It is assumed throughout this installation procedure that you"
|
---|
70 | echo "have a webserver installed on your system."
|
---|
71 | echo
|
---|
72 | echo "For later reference the output of this install script will be"
|
---|
73 | echo "recorded in a file called INSTALL_RECORD in the directory into"
|
---|
74 | echo "which you choose to install Greenstone."
|
---|
75 | echo
|
---|
76 | echo "Continue? [y]"
|
---|
77 | printf "%s" "> "
|
---|
78 | read ans
|
---|
79 | if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
|
---|
80 | echo "Greenstone was not installed"
|
---|
81 | exit 0
|
---|
82 | fi
|
---|
83 |
|
---|
84 | echo
|
---|
85 | echo "Enter directory to install Greenstone into. A gsdl directory"
|
---|
86 | echo "will be created in this directory. [${gsdlhome}]"
|
---|
87 | printf "%s" "> "
|
---|
88 | read ans
|
---|
89 | if [ "$ans" != "" ]; then
|
---|
90 | gsdlhome="$ans"
|
---|
91 | fi
|
---|
92 |
|
---|
93 | if [ ! -d "$gsdlhome" ]; then
|
---|
94 | echo "Warning: The ${gsdlhome} directory does not exist."
|
---|
95 | echo "Create it? [y]"
|
---|
96 | printf "%s" "> "
|
---|
97 | read ans
|
---|
98 | if [ "$ans" = "" ]; then
|
---|
99 | ans="y"
|
---|
100 | fi
|
---|
101 | if [ "$ans" = "y" ]; then
|
---|
102 | echo "--> Install.sh: [$cmd_mkdir \"$gsdlhome\"]"
|
---|
103 | $cmd_mkdir "$gsdlhome"
|
---|
104 | if [ ! -d "$gsdlhome" ]; then
|
---|
105 | echo "ERROR: failed to create $gsdlhome directory"
|
---|
106 | echo "Greenstone was not installed"
|
---|
107 | exit 1
|
---|
108 | fi
|
---|
109 | else
|
---|
110 | echo "Greenstone was not installed"
|
---|
111 | exit 0
|
---|
112 | fi
|
---|
113 | fi;
|
---|
114 |
|
---|
115 | # from now on $gsdlhome includes the "/gsdl"
|
---|
116 | gsdlhome="${gsdlhome}/gsdl"
|
---|
117 |
|
---|
118 | echo "--> Install.sh: [$cmd_mkdir \"${gsdlhome}\"]"
|
---|
119 | $cmd_mkdir "$gsdlhome"
|
---|
120 | if [ ! -d "$gsdlhome" ]; then
|
---|
121 | echo "ERROR: failed to create $gsdlhome directory"
|
---|
122 | echo "Greenstone was not installed"
|
---|
123 | exit 1
|
---|
124 | fi
|
---|
125 | # set permissions on gsdlhome directory (not that we should need to)
|
---|
126 | echo "--> Install.sh: [$cmd_chmod u+rwx \"${gsdlhome}\"]"
|
---|
127 | $cmd_chmod u+rwx "$gsdlhome"
|
---|
128 |
|
---|
129 | # start the INSTALL_RECORD script
|
---|
130 | echo
|
---|
131 | echo "** Starting installation record at ${gsdlhome}/INSTALL_RECORD **"
|
---|
132 | echo "Continue? [y]"
|
---|
133 | printf "%s" "> "
|
---|
134 | read ans
|
---|
135 | if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
|
---|
136 | echo "Greenstone was not installed"
|
---|
137 | exit 0
|
---|
138 | fi
|
---|
139 | script "${gsdlhome}/INSTALL_RECORD"
|
---|
140 |
|
---|
141 |
|
---|
142 | # create initial uninstall.sh
|
---|
143 | cd "$gsdlhome"
|
---|
144 | echo "#!/bin/sh" > uninstall.sh
|
---|
145 | echo "" >> uninstall.sh
|
---|
146 | echo "echo \"remove ${gsdlhome} directory? [y]\"" >> uninstall.sh
|
---|
147 | echo "read ans" >> uninstall.sh
|
---|
148 | echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> uninstall.sh
|
---|
149 | echo " $cmd_rmr \"$gsdlhome\"" >> uninstall.sh
|
---|
150 | echo "fi" >> uninstall.sh
|
---|
151 | $cmd_chmod u+x uninstall.sh
|
---|
152 | cd "$thisdir"
|
---|
153 |
|
---|
154 | echo
|
---|
155 | echo "If this installation fails or is cancelled, run the uninstall"
|
---|
156 | echo "script (${gsdlhome}/uninstall.sh) to clean up the partial"
|
---|
157 | echo "installation."
|
---|
158 | echo "Continue? [y]"
|
---|
159 | printf "%s" "> "
|
---|
160 | read ans
|
---|
161 | if [ "$ans" != "" ] && [ "$ans" != "y" ]; then
|
---|
162 | echo "Greenstone was not installed"
|
---|
163 | exit
|
---|
164 | exit 0
|
---|
165 | fi
|
---|
166 |
|
---|
167 | echo
|
---|
168 | echo "Installing Greenstone directory structure to ${gsdlhome}"
|
---|
169 | # copy gsdl directory across
|
---|
170 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/gsdl/\"* \"$gsdlhome\"]"
|
---|
171 | $cmd_cpr "${cd_dir}/gsdl/"* "$gsdlhome"
|
---|
172 |
|
---|
173 | # copy setup shell scripts across too
|
---|
174 | echo "--> Install.sh: [$cmd_cp \"${cd_dir}/src/Unix/setup.\"* \"$gsdlhome\"]"
|
---|
175 | $cmd_cp "${cd_dir}/src/Unix/setup."* "$gsdlhome"
|
---|
176 |
|
---|
177 | # create the tmp directory
|
---|
178 | echo "--> Install.sh: [$cmd_mkdir \"$gsdlhome/tmp\"]"
|
---|
179 | $cmd_mkdir "$gsdlhome/tmp"
|
---|
180 |
|
---|
181 | # make collect directory writable so we can install collections
|
---|
182 | echo "--> Install.sh: [$cmd_chmod u+rwx \"$gsdlhome/collect\"]"
|
---|
183 | $cmd_chmod u+rwx "$gsdlhome/collect"
|
---|
184 |
|
---|
185 | # which collections do we want
|
---|
186 | cd "${cd_dir}/collect"
|
---|
187 |
|
---|
188 | echo "The Greenstone demonstration collection has been installed. Would you"
|
---|
189 | echo "like to install any other collections from the installation cd-rom? [y]"
|
---|
190 | printf "%s" "> "
|
---|
191 | read ans
|
---|
192 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
193 |
|
---|
194 | echo "Install the greenstone archive (gsarch) - 1Mb? [y]"
|
---|
195 | printf "%s" "> "
|
---|
196 | read ans
|
---|
197 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
198 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/gsarch\" \"${gsdlhome}/collect\"]"
|
---|
199 | $cmd_cpr "${cd_dir}/collect/gsarch" "${gsdlhome}/collect"
|
---|
200 | fi
|
---|
201 |
|
---|
202 | echo "Install the MSWord and PDF demonstration collection (wordpdf) - 3Mb? [y]"
|
---|
203 | printf "%s" "> "
|
---|
204 | read ans
|
---|
205 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
206 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/wordpdf\" \"${gsdlhome}/collect\"]"
|
---|
207 | $cmd_cpr "${cd_dir}/collect/wordpdf" "${gsdlhome}/collect"
|
---|
208 | fi
|
---|
209 |
|
---|
210 | echo "Install the Chinese demonstration collection (chinese) - 1Mb? [y]"
|
---|
211 | printf "%s" "> "
|
---|
212 | read ans
|
---|
213 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
214 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/chinese\" \"${gsdlhome}/collect\"]"
|
---|
215 | $cmd_cpr "${cd_dir}/collect/chinese" "${gsdlhome}/collect"
|
---|
216 | fi
|
---|
217 |
|
---|
218 | echo "Install the food and nutrition library (fnl) - 175 Mb? [y]"
|
---|
219 | printf "%s" "> "
|
---|
220 | read ans
|
---|
221 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
222 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/fnl\" \"${gsdlhome}/collect\"]"
|
---|
223 | $cmd_cpr "${cd_dir}/collect/fnl" "${gsdlhome}/collect"
|
---|
224 | fi
|
---|
225 |
|
---|
226 | echo "Install the language extraction demonstration collection (folktale) - 2Mb? [y]"
|
---|
227 | printf "%s" "> "
|
---|
228 | read ans
|
---|
229 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
230 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/collect/folktale\" \"${gsdlhome}/collect\"]"
|
---|
231 | $cmd_cpr "${cd_dir}/collect/folktale" "${gsdlhome}/collect"
|
---|
232 | fi
|
---|
233 | fi
|
---|
234 |
|
---|
235 | # set permissions
|
---|
236 | echo
|
---|
237 | echo "Setting permissions ..."
|
---|
238 | echo "--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]"
|
---|
239 | $cmd_chmod -R u+rw "$gsdlhome"
|
---|
240 | # gsdl/etc needs to be globally writable
|
---|
241 | echo "--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/etc\"]"
|
---|
242 | $cmd_chmod -R a+w "$gsdlhome/etc"
|
---|
243 |
|
---|
244 | # should gsdl/collect and gsdl/tmp be globally writable?
|
---|
245 | echo
|
---|
246 | echo "In order for end-user collection building to be enabled the"
|
---|
247 | echo "Greenstone cgi program must be able to write to the"
|
---|
248 | echo "${gsdlhome}/collect and ${gsdlhome}/tmp directories."
|
---|
249 | echo "On most systems this means they must be globally writable."
|
---|
250 | echo "Make these directories globally writable? [y]"
|
---|
251 | printf "%s" "> "
|
---|
252 | read ans
|
---|
253 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
254 | echo "--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/collect\"]"
|
---|
255 | $cmd_chmod -R a+w "$gsdlhome/collect"
|
---|
256 | echo "--> Install.sh: [$cmd_chmod -R a+w \"$gsdlhome/tmp\"]"
|
---|
257 | $cmd_chmod -R a+w "$gsdlhome/tmp"
|
---|
258 | fi
|
---|
259 |
|
---|
260 | # binaries or source code?
|
---|
261 | compile="yes"
|
---|
262 | if [ "$gsdlos" = "linux" ]; then
|
---|
263 | echo
|
---|
264 | echo "You may either install pre-compiled, statically linked linux [b]inaries"
|
---|
265 | echo "or install and [c]ompile the Greenstone source code"
|
---|
266 |
|
---|
267 | found=no
|
---|
268 | while [ "$found" = "no" ]; do
|
---|
269 | echo "Enter \"[b]\" or \"c\""
|
---|
270 | printf "%s" "> "
|
---|
271 | read ans
|
---|
272 | if [ "$ans" = "" ] || [ "$ans" = "b" ]; then
|
---|
273 | compile="no"
|
---|
274 | # install binaries
|
---|
275 | echo
|
---|
276 | echo "Installing linux binaries"
|
---|
277 | echo "--> Install.sh: [$cmd_cpr \"${cd_dir}/Unix/bin/linux\" \"${gsdlhome}/bin\" ]"
|
---|
278 | $cmd_cpr "${cd_dir}/Unix/bin/linux" "${gsdlhome}/bin"
|
---|
279 | echo "--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/bin/linux/\"*]"
|
---|
280 | $cmd_chmod a+x "${gsdlhome}/bin/linux/"*
|
---|
281 | echo "--> Install.sh: [$cmd_chmod -R u+rw \"${gsdlhome}/bin/linux\"]"
|
---|
282 | $cmd_chmod -R u+rw "${gsdlhome}/bin/linux"
|
---|
283 |
|
---|
284 | # move library executable to cgi-bin
|
---|
285 | echo "--> Install.sh: [$cmd_mv \"${gsdlhome}/bin/linux/library\" \"${gsdlhome}/cgi-bin\"]"
|
---|
286 | $cmd_mv "${gsdlhome}/bin/linux/library" "${gsdlhome}/cgi-bin"
|
---|
287 |
|
---|
288 | found="yes"
|
---|
289 | elif [ "$ans" = "c" ]; then
|
---|
290 | found="yes"
|
---|
291 | fi
|
---|
292 | done
|
---|
293 | fi
|
---|
294 |
|
---|
295 | if [ "$compile" = "yes" ]; then
|
---|
296 | # install source
|
---|
297 | echo
|
---|
298 | echo "Installing source code"
|
---|
299 | echo "--> Install.sh [$cmd_cpr \"${cd_dir}/src/lib\" \"$gsdlhome\"]"
|
---|
300 | $cmd_cpr "${cd_dir}/src/lib" "$gsdlhome"
|
---|
301 | echo "--> Install.sh [$cmd_cpr \"${cd_dir}/src/packages\" \"$gsdlhome\"]"
|
---|
302 | $cmd_cpr "${cd_dir}/src/packages" "$gsdlhome"
|
---|
303 | echo "--> Install.sh [$cmd_cpr \"${cd_dir}/src/src\" \"$gsdlhome\"]"
|
---|
304 | $cmd_cpr "${cd_dir}/src/src" "$gsdlhome"
|
---|
305 | echo "--> Install.sh [$cmd_cpr \"${cd_dir}/src/Unix/\"* \"$gsdlhome\"]"
|
---|
306 | $cmd_cpr "${cd_dir}/src/Unix/"* "$gsdlhome"
|
---|
307 | echo "--> Install.sh: [$cmd_chmod -R u+rw \"$gsdlhome\"]"
|
---|
308 | $cmd_chmod -R u+rw "$gsdlhome"
|
---|
309 | echo "--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/configure\"]"
|
---|
310 | $cmd_chmod a+x "${gsdlhome}/configure"
|
---|
311 | echo "--> Install.sh: [$cmd_chmod a+x \"${gsdlhome}/packages/yaz/configure\"]"
|
---|
312 | $cmd_chmod a+x "${gsdlhome}/packages/yaz/configure"
|
---|
313 |
|
---|
314 | # compile it
|
---|
315 | echo "--> Install.sh: [cd $gsdlhome]"
|
---|
316 | cd "$gsdlhome"
|
---|
317 | echo "configuring ..."
|
---|
318 | echo
|
---|
319 | echo "--> Install.sh: [./configure]"
|
---|
320 | ./configure
|
---|
321 | echo "compiling ..."
|
---|
322 | echo
|
---|
323 | echo "--> Install.sh: [make]"
|
---|
324 | make
|
---|
325 | echo "installing ..."
|
---|
326 | echo
|
---|
327 | echo "--> Install.sh: [make install]"
|
---|
328 | make install
|
---|
329 | echo "--> Install.sh: [cd $thisdir]"
|
---|
330 | cd "$thisdir"
|
---|
331 |
|
---|
332 | # check that things compiled ok
|
---|
333 | if [ ! -f "${gsdlhome}/cgi-bin/library" ]; then
|
---|
334 | echo
|
---|
335 | echo "ERROR: Compilation failed"
|
---|
336 | echo "Greenstone was not installed successfully"
|
---|
337 | echo "Run the uninstall script (${gsdlhome}/uninstall.sh)"
|
---|
338 | echo "to clean up the partial installation."
|
---|
339 | exit
|
---|
340 | exit 1
|
---|
341 | fi
|
---|
342 | fi
|
---|
343 |
|
---|
344 |
|
---|
345 | # try to find out hostname
|
---|
346 | if [ "$gsdlos" = "linux" ]; then
|
---|
347 | hostname=`hostname -f`
|
---|
348 | if [ "$hostname" = "" ]; then
|
---|
349 | hostname=`hostname -i`
|
---|
350 | fi
|
---|
351 | fi
|
---|
352 | if [ "$hostname" = "" ]; then
|
---|
353 | hostname=`hostname`
|
---|
354 | fi
|
---|
355 | if [ "$hostname" = "" ]; then
|
---|
356 | hostname="your-computer-name"
|
---|
357 | fi
|
---|
358 |
|
---|
359 |
|
---|
360 | # get cgi-bin directory
|
---|
361 | echo
|
---|
362 | echo
|
---|
363 | echo "Greenstone needs a valid cgi executable directory (normally called"
|
---|
364 | echo "cgi-bin on unix systems) from which to run."
|
---|
365 | echo "This may be either:"
|
---|
366 | echo " 1. The default Greenstone cgi-bin directory (${gsdlhome}/cgi-bin)."
|
---|
367 | echo " If you use the Greenstone default you will need to configure"
|
---|
368 | echo " your webserver to treat this directory as a cgi executable"
|
---|
369 | echo " directory. For the Apache webserver you use the ScriptAlias"
|
---|
370 | echo " directive to do this (details of how to configure your webserver"
|
---|
371 | echo " will be displayed at the end of this installation procedure)."
|
---|
372 | if [ "$logname" != "root" ]; then
|
---|
373 | echo " Note that you will probably need help from your system"
|
---|
374 | echo " administrator to reconfigure your webserver."
|
---|
375 | fi
|
---|
376 | echo " 2. An existing cgi-bin directory. Normally a cgi-bin directory"
|
---|
377 | echo " is created when your webserver is installed. Typically, this"
|
---|
378 | echo " might be /home/httpd/cgi-bin, or /usr/local/apache/cgi-bin, or"
|
---|
379 | echo " /var/lib/apache/cgi-bin."
|
---|
380 | if [ "$logname" != "root" ]; then
|
---|
381 | echo " Many systems also allow individual users to have their own"
|
---|
382 | echo " cgi-bin in /home/username/public_html/cgi-bin."
|
---|
383 | fi
|
---|
384 | found=no
|
---|
385 | remind_cgi="no"
|
---|
386 | remind_cgi_nomove="no"
|
---|
387 | while [ "$found" = "no" ]; do
|
---|
388 | echo "Enter \"[1]\" or \"2\""
|
---|
389 | printf "%s" "> "
|
---|
390 | read ans
|
---|
391 | if [ "$ans" = "" ] || [ "$ans" = "1" ]; then
|
---|
392 | found="option1"
|
---|
393 | cgi_bin="${gsdlhome}/cgi-bin"
|
---|
394 | # default gsdl cgi-bin, do nothing
|
---|
395 | echo
|
---|
396 | echo "Don't forget to configure your webserver to treat $cgi_bin"
|
---|
397 | echo "as a cgi executable directory. Don't worry, you'll be"
|
---|
398 | echo "reminded of this again at the end of the installation"
|
---|
399 | echo "procedure"
|
---|
400 | remind_cgi="yes"
|
---|
401 | elif [ "$ans" = "2" ]; then
|
---|
402 | found="option2"
|
---|
403 | # external cgi-bin
|
---|
404 | echo
|
---|
405 | echo "Enter existing cgi executable directory [/usr/local/apache/cgi-bin]"
|
---|
406 | printf "%s" "> "
|
---|
407 | read ans
|
---|
408 | if [ "$ans" = "" ]; then
|
---|
409 | cgi_bin="/usr/local/apache/cgi-bin"
|
---|
410 | else
|
---|
411 | cgi_bin="$ans"
|
---|
412 | fi
|
---|
413 | if [ ! -d "$cgi_bin" ]; then
|
---|
414 | echo "Warning: The ${cgi_bin} directory does not exist."
|
---|
415 | echo "Create it? [y]"
|
---|
416 | printf "%s" "> "
|
---|
417 | read ans
|
---|
418 | if [ "$ans" = "" ] || [ "$ans" = "y" ]; then
|
---|
419 | echo "--> Install.sh: [$cmd_mkdir \"$cgi_bin\"]"
|
---|
420 | $cmd_mkdir "$cgi_bin"
|
---|
421 | if [ -d "$cgi_bin" ]; then
|
---|
422 | echo "Don't forget to configure your webserver to treat $cgi_bin"
|
---|
423 | echo "as a cgi executable directory. Don't worry, you'll be"
|
---|
424 | echo "reminded of this again at the end of the installation"
|
---|
425 | echo "procedure"
|
---|
426 | remind_cgi="yes"
|
---|
427 | else
|
---|
428 | echo "ERROR: failed to create $cgi_bin directory"
|
---|
429 | echo "Greenstone installation failed."
|
---|
430 | echo "Run the uninstall script (${gsdlhome}/uninstall.sh)"
|
---|
431 | echo "to clean up the partial installation."
|
---|
432 | exit
|
---|
433 | exit 1
|
---|
434 | fi
|
---|
435 | fi
|
---|
436 | fi
|
---|
437 |
|
---|
438 | if [ ! -w "$cgi_bin" ]; then
|
---|
439 | echo
|
---|
440 | echo "Unable to write to $cgi_bin directory. You will need"
|
---|
441 | echo "to copy the contents of ${gsdlhome}/cgi-bin"
|
---|
442 | echo "to $cgi_bin after this installation is completed."
|
---|
443 | echo "You'll be reminded of this again at the end of the"
|
---|
444 | echo "installation procedure."
|
---|
445 | remind_cgi_nomove="yes"
|
---|
446 | else
|
---|
447 | # install cgi-bin stuff (update the uninstall script first)
|
---|
448 | cd "$gsdlhome"
|
---|
449 | echo "#!/bin/sh" > uninstall.sh
|
---|
450 | echo "" >> uninstall.sh
|
---|
451 | echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> uninstall.sh
|
---|
452 | echo "$cmd_rm \"${cgi_bin}/library\"" >> uninstall.sh
|
---|
453 | echo "echo \"remove ${gsdlhome} directory? [y]\"" >> uninstall.sh
|
---|
454 | echo "read ans" >> uninstall.sh
|
---|
455 | echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> uninstall.sh
|
---|
456 | echo " $cmd_rmr \"$gsdlhome\"" >> uninstall.sh
|
---|
457 | echo "fi" >> uninstall.sh
|
---|
458 | $cmd_chmod u+x uninstall.sh
|
---|
459 | cd "$thisdir"
|
---|
460 |
|
---|
461 | echo
|
---|
462 | echo "Installing Greenstone cgi programs in $cgi_bin"
|
---|
463 | echo "--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/gsdlsite.cfg\" \"$cgi_bin\"]"
|
---|
464 | $cmd_mv "${gsdlhome}/cgi-bin/gsdlsite.cfg" "$cgi_bin"
|
---|
465 | echo "--> Install.sh: [$cmd_mv \"${gsdlhome}/cgi-bin/library\" \"$cgi_bin\"]"
|
---|
466 | $cmd_mv "${gsdlhome}/cgi-bin/library" "$cgi_bin"
|
---|
467 | fi
|
---|
468 | fi
|
---|
469 | done
|
---|
470 |
|
---|
471 | # web address of cgi-bin
|
---|
472 | web_cgi="http://${hostname}/cgi-bin"
|
---|
473 | if [ "$found" = "option1" ]; then
|
---|
474 | web_cgi="http://${hostname}/gsdl/cgi-bin"
|
---|
475 | fi
|
---|
476 | echo
|
---|
477 | echo "Please enter the web address of the $cgi_bin"
|
---|
478 | echo "directory. Typically this might be http://localhost/cgi-bin,"
|
---|
479 | echo "or http://127.0.0.1/cgi-bin, or http://your-computer-name/cgi-bin,"
|
---|
480 | echo "or http://nnn.nnn.nnn.nn/cgi-bin. [$web_cgi]"
|
---|
481 | printf "%s" "> "
|
---|
482 | read ans
|
---|
483 | if [ "$ans" != "" ]; then
|
---|
484 | web_cgi="$ans"
|
---|
485 | fi
|
---|
486 |
|
---|
487 | # get public_html directory
|
---|
488 | echo
|
---|
489 | echo
|
---|
490 | echo "In order for Greenstone to run, the $gsdlhome"
|
---|
491 | echo "directory and all it contains must be accessible from the web."
|
---|
492 | echo "To make this happen you may either:"
|
---|
493 | echo " 1. Configure your webserver so that $gsdlhome"
|
---|
494 | echo " is itself accessible from the web."
|
---|
495 | if [ "$logname" != "root" ]; then
|
---|
496 | echo " Note that you will probably need help from your system"
|
---|
497 | echo " administrator to reconfigure your webserver."
|
---|
498 | fi
|
---|
499 | echo " 2. Provide an existing web accessible directory from which"
|
---|
500 | echo " a symbolic link will be made to $gsdlhome."
|
---|
501 | echo " When your server was installed a web accessible directory"
|
---|
502 | echo " will have been created (the Apache webserver uses the"
|
---|
503 | echo " DocumentRoot directive to define this directory). Typically"
|
---|
504 | echo " this directory might be /home/httpd/html, or /usr/local/apache/htdocs,"
|
---|
505 | echo " or /var/lib/apache/htdocs."
|
---|
506 | if [ "$logname" != "root" ]; then
|
---|
507 | echo " Many systems also allow individual users to have their own"
|
---|
508 | echo " web accessible directory in /home/username/public_html."
|
---|
509 | fi
|
---|
510 | echo " Note that your web server will need to be configured to allow"
|
---|
511 | echo " symbolic links from within this directory. For the Apache"
|
---|
512 | echo " server that means this directory must be configured with"
|
---|
513 | echo " the SymLinksIfOwnerMatch or FollowSymLinks option (most Apache"
|
---|
514 | echo " installations are configured this way by default)."
|
---|
515 | found="no"
|
---|
516 | remind_ph="no"
|
---|
517 | remind_ph_nolink="no"
|
---|
518 | while [ "$found" = "no" ]; do
|
---|
519 | echo "Enter \"[1]\" or \"2\""
|
---|
520 | printf "%s" "> "
|
---|
521 | read ans
|
---|
522 | if [ "$ans" = "" ] || [ "$ans" = "1" ]; then
|
---|
523 | found="yes"
|
---|
524 | public_html="$gsdlhome"
|
---|
525 | # no link
|
---|
526 | echo
|
---|
527 | echo "Don't forget to configure your webserver to make $gsdlhome"
|
---|
528 | echo "accessible from the web. You'll be reminded of this again"
|
---|
529 | echo "at the end of this installation procedure."
|
---|
530 | remind_ph="yes"
|
---|
531 | elif [ "$ans" = "2" ]; then
|
---|
532 | found="yes"
|
---|
533 | # external public_html
|
---|
534 | echo
|
---|
535 | public_html="/home/${logname}/public_html"
|
---|
536 | if [ "$logname" = "root" ]; then
|
---|
537 | public_html="/usr/local/apache/htdocs"
|
---|
538 | fi
|
---|
539 | echo "Enter directory that is also accessible from the web [${public_html}]"
|
---|
540 | printf "%s" "> "
|
---|
541 | read ans
|
---|
542 | if [ "$ans" != "" ]; then
|
---|
543 | public_html="$ans"
|
---|
544 | fi
|
---|
545 | # create link to gsdl (and update uninstall.sh)
|
---|
546 | if [ -w "$public_html" ]; then
|
---|
547 | cd "$gsdlhome"
|
---|
548 | echo "#!/bin/sh" > uninstall.sh
|
---|
549 | echo "" >> uninstall.sh
|
---|
550 | echo "$cmd_rm \"$public_html/gsdl\"" >> uninstall.sh
|
---|
551 | echo "$cmd_rm \"${cgi_bin}/gsdlsite.cfg\"" >> uninstall.sh
|
---|
552 | echo "$cmd_rm \"${cgi_bin}/library\"" >> uninstall.sh
|
---|
553 | echo "echo \"remove ${gsdlhome} directory? [y]\"" >> uninstall.sh
|
---|
554 | echo "read ans" >> uninstall.sh
|
---|
555 | echo "if [ \"\$ans\" = \"\" ] || [ \"\$ans\" = \"y\" ]; then" >> uninstall.sh
|
---|
556 | echo " $cmd_rmr \"$gsdlhome\"" >> uninstall.sh
|
---|
557 | echo "fi" >> uninstall.sh
|
---|
558 | $cmd_chmod u+x uninstall.sh
|
---|
559 | cd "$thisdir"
|
---|
560 |
|
---|
561 | echo "--> Install.sh: [cd \"$public_html\"]"
|
---|
562 | cd "$public_html"
|
---|
563 | echo "--> Install.sh: [$cmd_ln \"$gsdlhome\" gsdl]"
|
---|
564 | $cmd_ln "$gsdlhome" gsdl
|
---|
565 | echo "--> Install.sh: [cd \"$thisdir\"]"
|
---|
566 | cd "$thisdir"
|
---|
567 | else
|
---|
568 | echo
|
---|
569 | echo "Unable to write to $public_html directory. You will need"
|
---|
570 | echo "to create a link called gsdl from $public_html to"
|
---|
571 | echo "$gsdlhome after this installation is completed. You'll be"
|
---|
572 | echo "reminded of this again at the end of the installation"
|
---|
573 | echo "procedure."
|
---|
574 | old_ph=$public_html
|
---|
575 | remind_ph_nolink="yes"
|
---|
576 | fi
|
---|
577 | public_html="${public_html}/gsdl"
|
---|
578 | fi
|
---|
579 | done
|
---|
580 |
|
---|
581 |
|
---|
582 | # get httpprefix
|
---|
583 | echo
|
---|
584 | echo "Enter the web address of the $public_html directory."
|
---|
585 | echo "This may be a relative url (e.g. \"/gsdl\") or a"
|
---|
586 | echo "complete url (e.g. \"http://${hostname}/gsdl\") [/gsdl]"
|
---|
587 | printf "%s" ">"
|
---|
588 | httpprefix="/gsdl"
|
---|
589 | read ans
|
---|
590 | if [ "$ans" != "" ]; then
|
---|
591 | httpprefix="$ans"
|
---|
592 | fi
|
---|
593 |
|
---|
594 | # get initial password
|
---|
595 | echo
|
---|
596 | echo "In order to use end-user collection building or to access certain"
|
---|
597 | echo "parts of the administration pages you must have a password."
|
---|
598 | echo "A user with the username \"admin\" will be created for you with"
|
---|
599 | echo "the password you provide (i.e. to enter any pages requiring user"
|
---|
600 | echo "authentication enter the \"admin\" username and the password you"
|
---|
601 | echo "set here).\n";
|
---|
602 | pw=`${gsdlhome}/bin/${gsdlos}/getpw`
|
---|
603 | tmp="[admin]
|
---|
604 | <comment>
|
---|
605 | <enabled>true
|
---|
606 | <groups>administrator,colbuilder
|
---|
607 | <password>${pw}
|
---|
608 | <username>admin
|
---|
609 | ----------------------------------------------------------------------"
|
---|
610 | echo "Creating user database"
|
---|
611 | echo "--> Install.sh: [${gsdlhome}/bin/${gsdlos}/txt2db \"${gsdlhome}/etc/users.db\"]"
|
---|
612 | echo "$tmp" | ${gsdlhome}/bin/${gsdlos}/txt2db "${gsdlhome}/etc/users.db"
|
---|
613 | echo "--> Install.sh: [$cmd_chmod a+rw \"${gsdlhome}/etc/users.db\"]"
|
---|
614 | $cmd_chmod a+rw "${gsdlhome}/etc/users.db"
|
---|
615 |
|
---|
616 | # edit gsdlsite.cfg
|
---|
617 | cd "$cgi_bin"
|
---|
618 | $cmd_chmod a+rw gsdlsite.cfg
|
---|
619 | sed "s|\(gsdlhome *\)[^ ]*|\1${gsdlhome}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
|
---|
620 | $cmd_chmod a+rw gsdlsite.cfg
|
---|
621 | sed "s|#*\(httpprefix *\)[^ ]*|\1${httpprefix}|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
|
---|
622 | $cmd_chmod a+rw gsdlsite.cfg
|
---|
623 | sed "s|\(httpimg *\)[^ ]*|\1${httpprefix}/images|" gsdlsite.cfg > tmp123.txt && $cmd_mv tmp123.txt gsdlsite.cfg
|
---|
624 |
|
---|
625 | echo
|
---|
626 | echo
|
---|
627 | echo "Greenstone installation completed successfully."
|
---|
628 | if [ "$remind_cgi" = "yes" ]; then
|
---|
629 | echo " * Don't forget to configure your webserver to treat"
|
---|
630 | echo " $cgi_bin as a cgi executable directory."
|
---|
631 |
|
---|
632 | apache_web_cgi=`echo "$web_cgi" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"`
|
---|
633 | cgi_bin_slash=`echo "$cgi_bin" | sed "s|/*$|/|"`
|
---|
634 | cgi_bin_noslash=`echo "$cgi_bin" | sed "s|/*$||"`
|
---|
635 |
|
---|
636 | echo " For the Apache webserver this means adding the following"
|
---|
637 | echo " ScriptAlias directive to your httpd.conf configuration file."
|
---|
638 | echo
|
---|
639 | echo " ScriptAlias ${apache_web_cgi} \"${cgi_bin_slash}\""
|
---|
640 | echo " <Directory \"${cgi_bin_noslash}\">"
|
---|
641 | echo " AllowOverride None"
|
---|
642 | echo " Options None"
|
---|
643 | echo " Order allow,deny"
|
---|
644 | echo " Allow from all"
|
---|
645 | echo " </Directory>"
|
---|
646 | echo
|
---|
647 | fi
|
---|
648 | if [ "$remind_cgi_nomove" = "yes" ]; then
|
---|
649 | echo " * Don't forget to move the contents of ${gsdlhome}/cgi-bin"
|
---|
650 | echo " to $cgi_bin"
|
---|
651 | echo
|
---|
652 | fi
|
---|
653 | if [ "$remind_ph" = "yes" ]; then
|
---|
654 | echo " * Don't forget to configure your webserver to treat"
|
---|
655 | echo " $gsdlhome as a web accessible directory."
|
---|
656 |
|
---|
657 | apache_httpprefix=`echo "$httpprefix" | sed "s|[^/]*//[^/]*||" | sed "s|/*$|/|"`
|
---|
658 | public_html_slash=`echo "$public_html" | sed "s|/*$|/|"`
|
---|
659 | public_html_noslash=`echo "$public_html" | sed "s|/*$||"`
|
---|
660 |
|
---|
661 | echo " For the Apache webserver this means adding the following"
|
---|
662 | echo " Alias directive to your httpd.conf configuration file."
|
---|
663 | echo
|
---|
664 | echo " Alias ${apache_httpprefix} \"${public_html_slash}\""
|
---|
665 | echo " <Directory \"${public_html_noslash}\">"
|
---|
666 | echo " Options Indexes MultiViews FollowSymLinks"
|
---|
667 | echo " AllowOverride None"
|
---|
668 | echo " Order allow,deny"
|
---|
669 | echo " Allow from all"
|
---|
670 | echo " </Directory>"
|
---|
671 | echo
|
---|
672 | fi
|
---|
673 | if [ "$remind_ph_nolink" = "yes" ]; then
|
---|
674 | echo " * Don't forget to create a link called gsdl from $old_ph"
|
---|
675 | echo " to ${gsdlhome}."
|
---|
676 | echo
|
---|
677 | fi
|
---|
678 | echo "You may remove Greenstone from your system at any time by running"
|
---|
679 | echo "the ${gsdlhome}/uninstall.sh script."
|
---|
680 | echo "Access Greenstone by pointing a web browser at"
|
---|
681 | echo " ${web_cgi}/library"
|
---|
682 | echo
|
---|
683 |
|
---|
684 | exit
|
---|
685 | exit 0
|
---|