forked from stoqs/stoqs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·58 lines (49 loc) · 1.4 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# This script is executed following provisioning of a server with the
# prerequisite system software.
pushd $(dirname $0)
HOMEDIR=$(pwd)
if [ $1 ]; then
REQ="$HOMEDIR/requirements/$1.txt"
else
REQ="$HOMEDIR/requirements/development.txt"
fi
echo "Using pip requirements file: $REQ"
if [ -z $VIRTUAL_ENV ]; then
echo "Need to be in your virtual environment."
exit 1
else
VENV_NAME=$(basename $VIRTUAL_ENV)
VENV_DIR="$HOMEDIR/$VENV_NAME"
fi
# Put link to gdal-config in venv/bin
CONFIG=$(which gdal-config)
if [ $? -ne 0 ]; then
echo "gdal-config is not in PATH"
rm -rf $VENV_DIR
exit 1
fi
PG_CONFIG=$(locate --regex "bin/pg_config$")
# Pick last path if multiple versions of Postgresql installed
PG_CONFIG=`echo $PG_CONFIG | grep -o '[^ ]*$'`
echo "Using PG_CONFIG=$PG_CONFIG"
PATH=$(dirname $PG_CONFIG):$PATH
ln -s $CONFIG $VENV_DIR/bin/
# GDAL 1.9.2 pip install requires this environment variable
export LD_PRELOAD=/usr/lib64/libgdal.so.1
# Install everything in $REQ
if [ -f "$REQ" ]; then
pip install -r $REQ
if [ $? -ne 0 ] ; then
echo "*** pip install -r $REQ failed. ***"
exit 1
fi
fi
# NCAR's natgrid needed for contour plotting
cd /tmp
wget http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/natgrid-0.2/natgrid-0.2.1.tar.gz
tar -xzf natgrid-0.2.1.tar.gz
cd natgrid-0.2.1
python setup.py install
popd
echo "$0 finished."