forked from datature/portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·49 lines (39 loc) · 1.17 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/bash
# exit when any command fails
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "Exiting shell: \"${last_command}\" command failed with exit code $?."' EXIT
declare -a FILES_NEEDED=(./src/engine/run.py)
missing_files="false"
check_if_file_exists() {
if ! test -f $1; then
missing_files="true"
echo "$1 does not exist."
fi
}
echo "Running setup bash job!"
for file in "${FILES_NEEDED[@]}"
do
check_if_file_exists $file
done
if [[ "$missing_files" == "true" ]]; then
echo "Quitting bash job due to missing files. Ensure you have the required files before continuing."
exit 0
fi
echo "Copying related engine files to portal_build..."
cp -R ./src/engine/server ./portal_build
cp ./src/engine/run.py ./portal_build
echo "Installing Python Environment in portal_build..."
echo "$OSTYPE"
if [[ "$OSTYPE" == "msys" ]]; then
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
else
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
fi
cd ../..
echo "Ending setup bash job in 10 secs..."
sleep 10