-
Notifications
You must be signed in to change notification settings - Fork 14
/
setup_linux.sh
executable file
·72 lines (62 loc) · 1.53 KB
/
setup_linux.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
#!/bin/bash
usage() { echo "Usage: $0 -c{clean}" 1>&2; exit 1; }
while getopts "ch?:" opt; do
case "${opt}" in
c)
clean="TRUE"
;;
h)
usage
;;
?)
usage
;;
esac
done
if [[ "$VIRTUAL_ENV" != "" ]]; then
echo "Deactivitate the existing virtual enviroment before running this script."
echo "This can be done with the \"deactivate\" command."
exit 53
fi
command -v pip 2>&1 >/dev/null
if [ $? != 0 ]; then
echo "Pip not available"
exit 555
fi
command -v virtualenv 2>&1 >/dev/null
if [ $? != 0 ]; then
echo "virtualenv not available"
exit 444
fi
echo "----Checking for and create a virtual environment----"
CREATE_VENV="TRUE"
if [ -d "venv" ]; then
if [ "$clean" == "TRUE" ]; then
rm -rf venv && CREATE_VENV="TRUE"
else
CREATE_VENV="FALSE"
fi
fi
if [ $CREATE_VENV == "TRUE" ]; then
virtualenv venv
if [ $? != 0 ]; then
echo "Virutal environment failed"
exit 59
fi
fi
source venv/bin/activate
if [[ "$VIRTUAL_ENV" == "" ]]; then
echo "FAILURE: Virutal environment creation failed"
exit 666
fi
python -m pip install -r requirements.txt
if [ $? != 0 ]; then
echo "Requirements install failed"
exit 59
fi
echo "----Setting up virtual environment----"
SETUP_TMP="setup_tmp"
echo ""
echo "-----------------------------------"
echo "Enviroment setup complete and seemingly successful."
echo "You can start the enviroment with the command\"source venv/bin/activate\""