UnderCover/init

51 lines
935 B
Plaintext
Raw Normal View History

#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
NEEDS="needs to be installed through your distro's package manager"
2021-07-28 23:36:22 -04:00
function fail {
echo "UnderCover Init Failed!"
exit 1
}
failed=false
if ! whereis python3 | grep "/" &> /dev/null; then
echo "python3" $NEEDS
failed=true
fi
if ! whereis pip3 | grep "/" &> /dev/null; then
echo "pip3" $NEEDS
failed=true
fi
if ! whereis pdflatex | grep "/" &> /dev/null; then
echo "texlive" $NEEDS
failed=true
fi
if ! whereis gs | grep "/" &> /dev/null; then
echo "ghostscript" $NEEDS
failed=true
fi
if $failed; then
2021-07-28 23:36:22 -04:00
fail
fi
commands=(
"python3 -m venv $SCRIPT_DIR/.venv"
"source .venv/bin/activate"
"pip3 install -r requirements.txt"
2021-07-28 23:39:47 -04:00
"mkdir $SCRIPT_DIR/outputs"
)
for com in "${commands[@]}"; do
if ! $com; then
2021-07-28 23:36:22 -04:00
fail
fi
done
echo "UnderCover Init Succeeded!"
touch $SCRIPT_DIR/.undercover_init_successful