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