-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_and_run.sh
executable file
·63 lines (57 loc) · 1.86 KB
/
build_and_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
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Define function to determine the package manager
determinePackageManager() {
if command -v apt > /dev/null; then
PKG_MANAGER="apt"
UPDATE_CMD="sudo apt update"
INSTALL_CMD="sudo apt install -y"
elif command -v pacman > /dev/null; then
PKG_MANAGER="pacman"
UPDATE_CMD="sudo pacman -Syu"
INSTALL_CMD="sudo pacman -S --noconfirm"
elif command -v yum > /dev/null; then
PKG_MANAGER="yum"
UPDATE_CMD="sudo yum update -y"
INSTALL_CMD="sudo yum install -y"
else
echo "Unsupported package manager. Exiting."
exit 1
fi
}
# Update and install packages
installPackages() {
$UPDATE_CMD || true
$INSTALL_CMD ffmpeg scrot || true
}
# Clone repository and setup virtual environment
setupProject() {
python3 -m venv env || true
source env/bin/activate || true
pip3 install -r requirements.txt || true
}
# Prompt user to run the project
promptForProjectExecution() {
read -p "Would you like to run the project now? [y/n]: " run_now
if [[ "$run_now" == "y" ]]; then
cd src/ || true
echo "How would you like to run the project?"
echo "1. Greeting window"
echo "2. GUI Version"
echo "3. Console version"
echo "4. Settings"
read -p "Choose a number [1-4]: " choice
case $choice in
1) python3 main.py ;;
2) python3 main.py -g ;;
3) python3 main.py -c ;;
4) python3 main.py --settings ;;
*) echo "Invalid choice. Exiting." ;;
esac
fi
}
# Main execution
determinePackageManager
installPackages
setupProject
promptForProjectExecution
echo "Script has finished its work. Please ensure all dependencies, packages, etc. are correctly installed(sudo pacman -S tk, sudo pacman -S scrot, sudo apt install python3-tk, sudo apt install scrot)."