Add init file for setup. Move default venv to .venv
This commit is contained in:
parent
9e6a913442
commit
a5f451d1e6
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
|
NEEDS="needs to be installed through your distro's package manager"
|
||||||
|
|
||||||
|
if ! whereis python3 | grep "/"; then
|
||||||
|
echo "python3" $NEEDS
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! whereis pip3 | grep "/"; then
|
||||||
|
echo "pip3" $NEEDS
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! whereis pdflatex | grep "/"; then
|
||||||
|
echo "texlive" $NEEDS
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
commands=(
|
||||||
|
"python3 -m venv $SCRIPT_DIR/.venv"
|
||||||
|
"source .venv/bin/activate"
|
||||||
|
"pip3 install -r requirements.txt"
|
||||||
|
)
|
||||||
|
|
||||||
|
for com in "${commands[@]}"; do
|
||||||
|
if ! $com; then
|
||||||
|
echo "UnderCover Init Failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "UnderCover Init Succeeded!"
|
||||||
|
touch $SCRIPT_DIR/.undercover_init_successful
|
10
start
10
start
|
@ -1,9 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
|
|
||||||
if ! pip -V | grep "$SCRIPT_DIR/venv"; then
|
if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then
|
||||||
|
if ! $SCRIPT_DIR/init; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! pip -V | grep "$SCRIPT_DIR/.venv"; then
|
||||||
echo "Entering virtual environment..."
|
echo "Entering virtual environment..."
|
||||||
source $SCRIPT_DIR/venv/bin/activate
|
source $SCRIPT_DIR/.venv/bin/activate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" == "prod" ]]; then
|
if [[ "$1" == "prod" ]]; then
|
||||||
|
|
Loading…
Reference in New Issue