#!/bin/bash
# This file is part of the PyWMS package (= program).
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
# author(s): Sebastian Holler
#
# Copyright (c)2008 by Sebastian Holler
# for document references, used in this source code: see
# Please run this script as root.
if [ "$(groups | grep root)" == "" ]; then
echo "Please run this script as root!"
exit
fi
#starting a subshell:
(
# exit immediately, if an error occurs:
set -e
echo "Step 1: Checking dependencies ..."
# TODO: improve this checking routine
echo -n " python -> "
if which python >/dev/null; then
echo "found."
else
echo "ERROR: NOT FOUND!"
exit -1
fi
echo -n " python-htmltmpl -> "
if python install/pyows_pymodules.py; then
echo "found."
else
echo "ERROR: NOT FOUND!"
exit -1
fi
for PYDEP in "apache2" "convert" "grass"
# "convert" is part of "imagemagick" package
do
echo -n " $PYDEP -> "
which $PYDEP >/dev/null && echo "found." || echo "WARNING: NOT FOUND!"
done
echo -n "Step 2: Compiling source code files (*.py -> *.pyc) ... "
python install/pyows_compile.py >/dev/null && echo "done."
echo -n "Step 3: Linking additional python site-packages ... "
PKGNAMES=("ows_server1" "ows_wms1_3_0")
for PKGNAME in ${PKGNAMES[*]}
do
SITEPKG="$(python install/pyows_getspdir.py)/$PKGNAME"
[ -e "$SITEPKG" ] && rm "$SITEPKG"
ln -s "$(pwd)/$PKGNAME" "$SITEPKG"
done
echo "done."
echo -n "Step 4: Compiling template files (*.tmpl -> *.tmplc) ... "
# compiling inside site-package directory is necessary, because
# this step sets the absolute path of the templates; the automatic
# compilation at first client request would fail because you must be
# root in order to do this
python install/pyows_compile-tmpl.py \
"$(python install/pyows_getspdir.py)/ows_wms1_3_0" && echo "done"
echo -n "Step 5: Creating and linking the configuration file ..."
cp install/pyows_wms.cfg-dist pyows_wms.cfg
[ -e "/etc/pyows_wms.cfg" ] && rm /etc/pyows_wms.cfg
ln -s "$(pwd)/pyows_wms.cfg" /etc/pyows_wms.cfg
chmod a+rw pyows_wms.cfg && echo "done."
)
echo
if [ $? -ne 0 ]; then
echo "Installation failed."
else
echo "Installation successful."
echo "Please copy the main cgi script (wms.py) to your cgi-bin directory and"
echo "adjust the config file before you use this program."
fi