This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
cumulus-install.sh
executable file
·151 lines (134 loc) · 3.6 KB
/
cumulus-install.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#! /bin/bash
if ([ "X$1" == "X--help" ] || [ "X$1" == "X-h" ]); then
echo "cumulus-install.sh <installation directory> [<path to python install directory>]"
echo " The python path should be the path to the install. ./bin/python and ./bin/pip will be appened."
echo " If not path to python is specified a virtual environment will be created"
exit 0
fi
installdir=$1
start_dir=`pwd`
source_dir=`dirname $0`
cd $source_dir
source_dir=`pwd`
# if no
if [ "X$2" == "X" ]; then
PYTHON=`which python`
$PYTHON -c "import sys; sys.exit(sys.version_info < (2,5))"
if [ $? -ne 0 ]; then
echo "ERROR: Your system must have Python version 2.5 or later."
exit 1
fi
if [ "X$PYTHON" == "X" ]; then
echo "you must have python in your system path for installation"
exit 1
fi
if [ -e $installdir ]; then
echo "----- WARNING -----"
echo "Target directory already exists"
bkup_dir="$installdir".`date +%s`
echo "moving existing directory to $bkup_dir"
mv $installdir $bkup_dir
fi
echo "Making the Python virtual environment."
echo ""
$PYTHON $source_dir/virtualenv.py -p $PYTHON $installdir
if [ $? -ne 0 ]; then
echo "The virtural env installation failed"
exit 1
fi
PYVE=$installdir/bin/python
PYVEDIR=$installdir
PIP=$installdir/bin/pip
else
use_py=$2
echo "Using provided Python environment: $use_py"
echo ""
PYVEDIR=$use_py
PYVE=$use_py/bin/python
PIP=$use_py/bin/pip
$PYVE -c "import sys; sys.exit(sys.version_info < (2,5))"
if [ $? -ne 0 ]; then
echo $use_py
$use_py --version
echo "ERROR: Your system must have Python version 2.5 or later."
exit 1
fi
fi
source $PYVEDIR/bin/activate
cd $source_dir/deps
if [ $? -ne 0 ]; then
echo "Could not change to the deps directory"
exit 1
fi
./get-em.sh
if [ $? -ne 0 ]; then
echo "get-em failed"
exit 1
fi
if [ ! -e $PIP ]; then
cd $source_dir
tar -zxf pip-0.7.2.tar.gz
if [ $? -ne 0 ]; then
echo "unable to untar pip-0.7.2.tar.gz"
exit 1
fi
cd $source_dir/pip-0.7.2
$PYVE setup.py install
if [ $? -ne 0 ]; then
echo "pip was not installed correctly"
exit 1
fi
fi
echo ""
echo "-----------------------------------------------------------------"
echo "Installing Cumulus dependencies"
echo "-----------------------------------------------------------------"
echo ""
# install deps
cd $source_dir
$PIP install --requirement=reqs.txt
if [ $? -ne 0 ]; then
echo "$PIP failed to install deps"
exit 1
fi
echo "installing authz"
echo "----------------"
cd authz
$PYVE setup.py install
if [ $? -ne 0 ]; then
echo "$PIP failed to install authz"
exit 1
fi
cd $source_dir
echo "installing cb"
echo "-------------"
cd cb
$PYVE setup.py install
if [ $? -ne 0 ]; then
echo "$PIP failed to install authz"
exit 1
fi
echo ""
echo "-----------------------------------------------------------------"
echo "Configuring the environment"
echo "-----------------------------------------------------------------"
echo ""
cd $source_dir/conf
./configure --prefix=$installdir --with-ve=$PYVEDIR
if [ $? -ne 0 ]; then
echo "configure failed"
exit 1
fi
make install
if [ $? -ne 0 ]; then
echo "make install failed"
exit 1
fi
echo ""
echo "-----------------------------------------------------------------"
echo "Finalizing the Cumulus install"
echo "-----------------------------------------------------------------"
echo ""
cd $source_dir
cp -r $source_dir/tests $installdir
cp -r $source_dir/docs $installdir