install.sh 767 Bytes
Newer Older
1
#!/bin/bash
okhin's avatar
okhin committed
2 3 4
# This schript is used to setup what needs to be (virtualenv and stuff)
# before running the pthon setup.py part
# We need those variables
5
if [ -z "$CI_PROJECT_DIR" ]
okhin's avatar
okhin committed
6
then
7
	echo "CI_PROJECT_DIR undefined"
okhin's avatar
okhin committed
8 9
	exit 1
fi
okhin's avatar
okhin committed
10

11 12
export CI_PROJECT_NAME=$(basename $CI_PROJECT_DIR)

okhin's avatar
okhin committed
13
if [ -z "$CI_BUILD_REPO" ]
okhin's avatar
okhin committed
14
then
okhin's avatar
okhin committed
15 16 17
	echo "CI_BUILD_REPO undefined"
	exit 1
fi
okhin's avatar
okhin committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

cd /srv/piphone
if [ -d $CI_PROJECT_NAME ]
then
	cd $CI_PROJECT_NAME
	git pull origin master
else
	git clone $CI_BUILD_REPO $CI_PROJECT_NAME
	cd $CI_PROJECT_NAME
fi
if [ ! -d ./.${CI_PROJECT_NAME}_env ]
then
	virtualenv --python=python3 .${CI_PROJECT_NAME}_env
fi
source .${CI_PROJECT_NAME}_env/bin/activate
pip install -r ./requirements.txt
okhin's avatar
okhin committed
34 35 36 37 38

if [ ! -e $SQLITE_DB ]
then
	sqlite3 $SQLITE_DB < database.sql 
fi