-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec.sh
More file actions
executable file
·116 lines (92 loc) · 2.01 KB
/
exec.sh
File metadata and controls
executable file
·116 lines (92 loc) · 2.01 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#! /bin/sh
DEBUG=false
NULL="/dev/null"
PRINT_NULL="> $NULL 2> $NULL"
if $DEBUG; then
echo ""
whoami
echo "says hello world!"
echo "from Docker!"
echo ""
lsb_release -a
uname -a
echo ""
cat /etc/os-release
echo ""
fi
os_id=$(grep "^\(ID\|id\)=" /etc/os-release | awk -F= '{print $2}')
if $DEBUG; then
echo "Detected OS ID: $os_id"
fi
env_dir=env-$os_id
if $DEBUG; then
echo "System Python 3:"
python3 --version
fi
if [ -d $env_dir ] ; then
rm_env="rm -rdv $env_dir"
if [ -d $env_dir/bin ]; then
if [ -f $env_dir/bin/python3 ]; then
if $DEBUG; then
echo "VirtualEnv Python 3:"
$env_dir/bin/python3 --version
fi
else
if $DEBUG; then
echo "No VirtualEnv Python"
eval $rm_env
else
eval "$rm_env $PRINT_NULL"
fi
fi
else
if $DEBUG; then
echo "No VirtualEnv Bin"
eval $rm_env
else
eval "$rm_env $PRINT_NULL"
fi
fi
else
if $DEBUG; then
echo "No VirtualEnv"
fi
fi
if $DEBUG; then
echo ""
echo "=========================="
echo "| VirtualEnv Management: |"
echo "=========================="
fi
if [ ! -d $env_dir ]; then
if $DEBUG; then
echo "Creating VirtualEnv..."
echo "----------------------"
fi
create_virtualenv="virtualenv --python=python3 $env_dir"
if $DEBUG; then
eval $create_virtualenv
else
eval "$create_virtualenv $PRINT_NULL"
fi
if $DEBUG; then
echo "-----------------------------------"
fi
fi
if $DEBUG; then
echo "Installing Dependencies with Pip..."
echo "-----------------------------------"
fi
pip_install="$env_dir/bin/pip3 install -r requirements.txt"
if $DEBUG; then
eval $pip_install
else
eval "$pip_install $PRINT_NULL"
fi
if $DEBUG; then
echo ""
echo "====================="
echo "| Executing Python: |"
echo "====================="
fi
$env_dir/bin/python3 main.py