-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
52 lines (38 loc) · 1.04 KB
/
run.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
50
51
52
#!/bin/bash
check_python() {
command -v python3 >/dev/null 2>&1 || {
echo "Python 3 is required but it's not installed. Please install Python 3 and try again. Aborting."
exit 1
}
}
check_and_install_opencv() {
python3 -c "import cv2" 2>/dev/null || {
echo "OpenCV is not installed. Installing OpenCV..."
pip install opencv-python
}
}
setup_environment() {
echo "Setting up environment..."
}
check_dependencies() {
echo "Checking if all dependencies in requirements.txt are installed..."
installed_packages=$(pip freeze | cut -d'=' -f1)
while IFS= read -r package; do
[[ "$package" =~ ^#.*$ || -z "$package" ]] && continue
package_name=$(echo "$package" | sed 's/[><=].*//')
if echo "$installed_packages" | grep -i -q "^$package_name$"; then
echo "$package_name is already installed."
else
echo "$package_name is missing. Installing..."
pip install "$package_name"
fi
done <requirements.txt
}
main() {
check_python
check_and_install_opencv
setup_environment
check_dependencies
python3 src/start.py "$@"
}
main "$@"