You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TU_Assignment/install.sh

38 lines
745 B

#!/bin/bash
# Please edit the python path:
PYTHON3_PATH=python3
cd "$(dirname "$0")"
version=$($PYTHON3_PATH -V 2>&1 | grep -Po '(?<=Python )(.+)')
if [[ -z "$version" ]]
then
echo "Given PYTHON3_PATH is no Python3! Please edit paths.config"
exit 1
fi
parsedVersion=$(echo "${version//./}")
if [[ "$parsedVersion" -lt "330" ]]
then
echo "Python version must be >=3.3"
exit 1
fi
echo "Creating virtual enviroment"
python3 -m venv venv
if [[ $? -eq 0 ]]; then
echo "Successfully created virtual enviroment"
else
exit 1
fi
echo "Installing dependencies"
venv/bin/pip install flask
if [[ $? -eq 0 ]]; then
echo "Successfully installed webserver"
echo "Start webserver with \"venv/bin/python main.py\""
else
exit 1
fi