-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·60 lines (53 loc) · 1.52 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
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Check if script is run with sudo
if [ "$(id -u)" -ne 0 ]; then
echo "This script requires sudo. Please run as root."
exit 1
fi
# Function to install python3 and pip for Debian-based systems (e.g., Ubuntu)
install_debian() {
echo "Debian/Ubuntu detected. Installing python3 and pip..."
apt update
apt install -y python3 python3-pip
}
# Function to install python3 and pip for Arch-based systems
install_arch() {
echo "Arch Linux detected. Installing python3 and pip..."
pacman -Syu --noconfirm python python-pip
}
# Check if python3 and pip are installed
if ! command -v python3 &> /dev/null; then
echo "python3 not found. Installing..."
if [ -f /etc/debian_version ]; then
install_debian
elif [ -f /etc/arch-release ]; then
install_arch
else
echo "Unsupported distribution. Please install python3 manually."
exit 1
fi
else
echo "python3 is already installed."
fi
if ! command -v pip3 &> /dev/null; then
echo "pip3 not found. Installing..."
if [ -f /etc/debian_version ]; then
apt install -y python3-pip
elif [ -f /etc/arch-release ]; then
pacman -Syu --noconfirm python-pip
else
echo "Unsupported distribution. Please install pip3 manually."
exit 1
fi
else
echo "pip3 is already installed."
fi
# Install Python requirements from a text file
if [ -f "requirements.txt" ]; then
echo "Installing requirements from requirements.txt..."
pip3 install -r requirements.txt
else
echo "requirements.txt not found."
exit 1
fi
echo "Script completed successfully."