2021-07-28 23:25:29 -04:00
|
|
|
#!/bin/bash
|
2022-09-23 13:37:37 -04:00
|
|
|
|
2021-07-28 23:25:29 -04:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-07-28 23:33:13 -04:00
|
|
|
failed=false
|
|
|
|
|
|
|
|
if ! whereis python3 | grep "/" &> /dev/null; then
|
2022-09-23 13:37:37 -04:00
|
|
|
echo "python3 $NEEDS"
|
2021-07-28 23:33:13 -04:00
|
|
|
failed=true
|
2021-07-28 23:25:29 -04:00
|
|
|
fi
|
|
|
|
|
2021-07-28 23:33:13 -04:00
|
|
|
if ! whereis pip3 | grep "/" &> /dev/null; then
|
2022-09-23 13:37:37 -04:00
|
|
|
echo "pip3 $NEEDS"
|
2021-07-28 23:33:13 -04:00
|
|
|
failed=true
|
2021-07-28 23:25:29 -04:00
|
|
|
fi
|
|
|
|
|
2021-07-28 23:33:13 -04:00
|
|
|
if ! whereis pdflatex | grep "/" &> /dev/null; then
|
2022-09-23 13:37:37 -04:00
|
|
|
echo "texlive $NEEDS"
|
2021-07-28 23:33:13 -04:00
|
|
|
failed=true
|
|
|
|
fi
|
|
|
|
|
2021-07-31 17:38:32 -04:00
|
|
|
if ! whereis gs | grep "/" &> /dev/null; then
|
2022-09-23 13:37:37 -04:00
|
|
|
echo "ghostscript $NEEDS"
|
2021-07-31 17:38:32 -04:00
|
|
|
failed=true
|
|
|
|
fi
|
|
|
|
|
2021-07-28 23:33:13 -04:00
|
|
|
if $failed; then
|
2021-07-28 23:36:22 -04:00
|
|
|
fail
|
2021-07-28 23:25:29 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
commands=(
|
|
|
|
"python3 -m venv $SCRIPT_DIR/.venv"
|
|
|
|
"source .venv/bin/activate"
|
|
|
|
"pip3 install -r requirements.txt"
|
2022-09-24 17:20:38 -04:00
|
|
|
"mkdir -p $SCRIPT_DIR/outputs"
|
2021-07-28 23:25:29 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
for com in "${commands[@]}"; do
|
|
|
|
if ! $com; then
|
2021-07-28 23:36:22 -04:00
|
|
|
fail
|
2021-07-28 23:25:29 -04:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "UnderCover Init Succeeded!"
|
2022-09-23 13:37:37 -04:00
|
|
|
touch "$SCRIPT_DIR/.undercover_init_successful"
|