-
Notifications
You must be signed in to change notification settings - Fork 9
/
setupenv.sh
31 lines (25 loc) · 919 Bytes
/
setupenv.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
#!/bin/bash
CURR_DIR=$(pwd)
# Check if the script is being run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run the script as root"
exit 1
fi
# setup virtualenv and PYTHONPATH
apt-get update
apt-get install -y python3-virtualenv pkg-config libtss-dev libtss2-dev
if [[ -d ${CURR_DIR}/venv ]]; then
echo "===========> Remove ${CURR_DIR}/venv and create a new one"
rm -rf {CURR_DIR}/venv
fi
python3 -m virtualenv -p python3 ${CURR_DIR}/venv
source ${CURR_DIR}/venv/bin/activate
python3 -m pip install "evidence_api @ git+https://github.com/cc-api/evidence-api.git#subdirectory=common/python"
python3 -m pip install -r $CURR_DIR/src/python/requirements.txt
if [ ! $? -eq 0 ]; then
echo "Failed to install python PIP packages, please check your proxy (https_proxy) or setup PyPi mirror."
deactivate
rm ${CURR_DIR}/venv -fr
return 1
fi
export PYTHONPATH=$PYTHONPATH:$CURR_DIR/src/python