-
Notifications
You must be signed in to change notification settings - Fork 20
/
termux.sh
112 lines (89 loc) · 2.43 KB
/
termux.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
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
#!/bin/bash
# File containing the list of required packages
REQUIREMENTS_FILE="requirements.txt"
# Windows fails to install Tgcrypto, it shouldnt be
# added to the same requirements.txt file
install_tgcrypto() {
TGCRYPTO="TgCrypto"
if pip show "$TGCRYPTO" &> /dev/null; then
echo "$TGCRYPTO is installed."
else
echo "$TGCRYPTO is not installed, Trying to install ..."
fi
}
# Function to check and install Python 3
install_python() {
if command -v python3 &> /dev/null; then
echo "Python3 is installed."
else
echo "Python3 is not installed. Trying to install Python3 ..."
# Install Python 3
echo "Installing Python3 ..."
if apt install -y python3; then
echo "Python3 successfully installed."
else
echo "Failed to install Python3. Please check your package manager or permissions."
exit 1
fi
fi
}
install_numpy() {
MATHLIB="m" pkg install python-numpy
}
install_xml() {
apt install libxml2 libxslt
CFLAGS='-O0' python3 -m pip install lxml
}
install_psycopg2() {
apt install postgresql python make clang
python3 -m pip install psycopg2
}
install_pillow() {
apt install libjpeg-turbo
LDFLAGS="-L/system/lib/" CFLAGS="-I/data/data/com.termux/files/usr/include/"
python3 -m pip install pillow
}
install_ffmpeg() {
apt install ffmpeg
}
install_userbot_dependencies() {
# Check if the requirements file exists
if [ ! -f "$REQUIREMENTS_FILE" ]; then
echo "Requirements file not found!"
exit 1
fi
# Read each line from the requirements file
while IFS= read -r package
do
# Skip empty lines and comments
[[ "$package" =~ ^\s*$ || "$package" =~ ^\s*# ]] && continue
# Check if the package is installed
if pip show "$package" &> /dev/null; then
echo "$package is installed."
else
echo "$package is not installed, Trying to install ..."
fi
done < "$REQUIREMENTS_FILE"
}
update_terminal() {
echo "Updating package lists ..."
apt update
echo "Upgrading installed packages ..."
apt upgrade -y
echo "Updating system ..."
apt dist-upgrade -y
echo "Cleaning up ..."
apt autoremove -y
echo "Update complete."
clear
}
run_userbot() {
python3 -m main
}
main() {
update_terminal
install_python
install_userbot_dependencies
run_userbot
}
main