blob: 479c37411c0d5a08ffc007c26bbef99c3bfdec42 [file] [log] [blame]
Matteo Scandolo297eb262017-05-15 17:00:53 -07001#!/bin/bash
2
3BASEDIR=$(pwd)
4REQUIREMENTS=$BASEDIR/containers/xos/pip_requirements.txt
5VENVDIR=venv-xos
6
7echo $BASEDIR
8echo $REQUIREMENTS
9echo $VENVDIR
10
11# create venv if it's not yet there
12if [ ! -d "$BASEDIR/$VENVDIR" ]; then
13 echo "Setting up virtualenv for XOS"
14 virtualenv -q $BASEDIR/$VENVDIR --no-site-packages
15 pip install --upgrade pip
16 echo "Virtualenv created."
17fi
18
19# activate the virtual env
20if [ ! $VIRTUAL_ENV ]; then
21 source $BASEDIR/$VENVDIR/bin/activate
22 echo "Virtualenv activated."
23fi
24
25# install pip requirements
Matteo Scandolo56879722017-05-17 21:39:54 -070026if \
27pip install cryptography --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include" && \
28pip install -r $REQUIREMENTS && \
Matteo Scandolo4a99b2c2017-06-22 10:31:44 -070029cd $BASEDIR/lib/xos-config; python setup.py install && \
Matteo Scandolo67654fa2017-06-09 09:33:17 -070030
Matteo Scandolo4a99b2c2017-06-22 10:31:44 -070031#install xos-client
32cp -R $BASEDIR/containers/xos/tmp.chameleon $BASEDIR/xos/xos_client/xosapi/chameleon && \
33cd $BASEDIR/xos/xos_client/xosapi/chameleon/protos; VOLTHA_BASE=anything make && \
34cd $BASEDIR/xos/xos_client; python setup.py install && \
35chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/gw_gen.py && \
Matteo Scandolo67654fa2017-06-09 09:33:17 -070036chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/swagger_gen.py && \
37cd $BASEDIR/lib/xos-genx; python setup.py install
Matteo Scandolo297eb262017-05-15 17:00:53 -070038 then
39 echo "Requirements installed."
40 echo "Virtualenv ready"
41 else
42 echo "An error occurred"
43fi
Matteo Scandolo56879722017-05-17 21:39:54 -070044cd $BASEDIR