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