forked from shamhi/PocketFiBot
-
Notifications
You must be signed in to change notification settings - Fork 6
/
INSTALL.sh
48 lines (39 loc) · 1.37 KB
/
INSTALL.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
#!/bin/bash
install_python() {
echo "Select the Python version to install:"
echo "1) Python 3.10"
echo "2) Python 3.11"
echo "3) Python 3.12"
read -p "Enter the number of your choice: " choice
case $choice in
1) version="3.10" ;;
2) version="3.11" ;;
3) version="3.12" ;;
*) echo "Invalid choice"; exit 1 ;;
esac
if command -v apt-get &> /dev/null; then
sudo apt-get update
sudo apt-get install -y python$version python$version-venv python$version-pip
elif command -v yum &> /dev/null; then
sudo yum install -y https://repo.ius.io/ius-release-el$(rpm -E %{rhel}).rpm
sudo yum install -y python$version python$version-venv python$version-pip
elif command -v dnf &> /dev/null; then
sudo dnf install -y python$version python$version-venv python$version-pip
else
echo "Package manager not supported. Please install Python manually."
exit 1
fi
}
if ! command -v python3 &> /dev/null; then
install_python
fi
echo "Creating virtual environment..."
python3 -m venv venv
echo "Activating virtual environment..."
source venv/bin/activate
echo "Installing dependencies..."
pip install -r requirements.txt
echo "Copying .env-example to .env..."
cp .env-example .env
echo "Please edit the .env file to add your API_ID and API_HASH."
read -p "Press any key to continue..."