1 |
#!/bin/bash |
2 |
|
3 |
# This file is part of the PyWMS package (= program). |
4 |
# This program is free software: you can redistribute it and/or modify |
5 |
# it under the terms of the GNU General Public License as published by |
6 |
# the Free Software Foundation, either version 2 of the License, or |
7 |
# (at your option) any later version. |
8 |
# |
9 |
# This program is distributed in the hope that it will be useful, |
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
# GNU General Public License for more details. |
13 |
# |
14 |
# You should have received a copy of the GNU General Public License |
15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 |
# |
17 |
# author(s): Sebastian Holler <shgeo/at/online.de> |
18 |
# |
19 |
# Copyright (c)2008 by Sebastian Holler |
20 |
|
21 |
|
22 |
# for document references, used in this source code: see <README_dev> |
23 |
|
24 |
# Please run this script as root. |
25 |
|
26 |
|
27 |
if [ "$(groups | grep root)" == "" ]; then |
28 |
echo "Please run this script as root!" |
29 |
exit |
30 |
fi |
31 |
|
32 |
#starting a subshell: |
33 |
( |
34 |
# exit immediately, if an error occurs: |
35 |
set -e |
36 |
|
37 |
echo "Step 1: Checking dependencies ..." |
38 |
# TODO: improve this checking routine |
39 |
echo -n " python -> " |
40 |
if which python >/dev/null; then |
41 |
echo "found." |
42 |
else |
43 |
echo "ERROR: NOT FOUND!" |
44 |
exit -1 |
45 |
fi |
46 |
echo -n " python-htmltmpl -> " |
47 |
if python install/pyows_pymodules.py; then |
48 |
echo "found." |
49 |
else |
50 |
echo "ERROR: NOT FOUND!" |
51 |
exit -1 |
52 |
fi |
53 |
for PYDEP in "apache2" "convert" "grass" |
54 |
# "convert" is part of "imagemagick" package |
55 |
do |
56 |
echo -n " $PYDEP -> " |
57 |
which $PYDEP >/dev/null && echo "found." || echo "WARNING: NOT FOUND!" |
58 |
done |
59 |
|
60 |
echo -n "Step 2: Compiling source code files (*.py -> *.pyc) ... " |
61 |
python install/pyows_compile.py >/dev/null && echo "done." |
62 |
|
63 |
echo -n "Step 3: Linking additional python site-packages ... " |
64 |
PKGNAMES=("ows_server1" "ows_wms1_3_0") |
65 |
for PKGNAME in ${PKGNAMES[*]} |
66 |
do |
67 |
SITEPKG="$(python install/pyows_getspdir.py)/$PKGNAME" |
68 |
[ -e "$SITEPKG" ] && rm "$SITEPKG" |
69 |
ln -s "$(pwd)/$PKGNAME" "$SITEPKG" |
70 |
done |
71 |
echo "done." |
72 |
|
73 |
echo -n "Step 4: Compiling template files (*.tmpl -> *.tmplc) ... " |
74 |
# compiling inside site-package directory is necessary, because |
75 |
# this step sets the absolute path of the templates; the automatic |
76 |
# compilation at first client request would fail because you must be |
77 |
# root in order to do this |
78 |
python install/pyows_compile-tmpl.py \ |
79 |
"$(python install/pyows_getspdir.py)/ows_wms1_3_0" && echo "done" |
80 |
|
81 |
echo -n "Step 5: Creating and linking the configuration file ..." |
82 |
cp install/pyows_wms.cfg-dist pyows_wms.cfg |
83 |
[ -e "/etc/pyows_wms.cfg" ] && rm /etc/pyows_wms.cfg |
84 |
ln -s "$(pwd)/pyows_wms.cfg" /etc/pyows_wms.cfg |
85 |
chmod a+rw pyows_wms.cfg && echo "done." |
86 |
) |
87 |
|
88 |
echo |
89 |
if [ $? -ne 0 ]; then |
90 |
echo "Installation failed." |
91 |
else |
92 |
echo "Installation successful." |
93 |
echo "Please copy the main cgi script (wms.py) to your cgi-bin directory and" |
94 |
echo "adjust the config file <pyows_wms.cfg> before you use this program." |
95 |
fi |