ForgeServ-API/start.sh
2025-06-14 15:04:02 -05:00

28 lines
739 B
Shell
Executable file

#!/bin/bash
# Get an absolute path to the script
basedir=$(dirname $0)
absdir=$(realpath -s "${PWD}/${basedir}")
if [ -d "${absdir}/.venv" ]; then
echo "${absdir}/.venv exists - removing and resetting"
rm -rf "${absdir}/.venv"
fi
pythoncmd=$(command -v python) || $(command -v python3)
$pythoncmd -m venv "${absdir}/.venv"
echo "Made venv successfully"
source "${absdir}/.venv/bin/activate"
echo "Activated venv successfully"
# Re-assess the python command now that we're in the venv
pythoncmd=$(command -v python) || $(command -v python3)
$pythoncmd -m pip install -r "${absdir}/requirements.txt" >/dev/null 2>&1
echo "Installed Python requirements successfully"
cd "${absdir}/src"
echo "Starting up.."
$pythoncmd __main__.py