-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup_rtl88x2bu.sh
executable file
·264 lines (199 loc) · 6.83 KB
/
setup_rtl88x2bu.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#!/usr/bin/env bash
#Credits:
# _ _ __
# | | | | / |
# | | _ _ _ ___ _ _ ___| | /_/ |____
# | || \| | | | /___) | | |/___) || \| | _ \
# | |_) ) |_| | |___ | |_| |___ | |_) ) | | | |
# |____/ \__ | (___/ \__ (___/|____/|_|_| |_|
# (____/ (____/
# Glitched Super-User verification, so please execute this script without sudo
#if [ "$EUID" != 0 ]; then
# echo -e "\n\e[1;31m[!] This script must be run as root!\e[0m\n"
# exit
#else
echo -e "\n\e[1;37m==========> CHECKING DEPENDENCIES <==========\e[0m\n"
# Checking if git is installed
echo -e "\e[1;33m[*] Checking if git is installed...\e[0m"
sleep 1
if [ -x "$(command -v git)" ]; then
echo -e "\e[1;32m[+] Git is installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Git isn't installed. Installing it...\e[0m"
sudo apt update -y -qq
sudo apt install git -y -qq
sleep 1
if [ -x "$(command -v git)" ]; then
echo -e "\e[1;32m[+] Git installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Git can't be installed. Verify if you're connected to Internet and try again later.\n\nExiting...\e[0m"
sleep 3
exit
fi
fi
sleep 1
# Checking if make is installed
echo -e "\e[1;33m[*] Checking if make is installed...\e[0m"
sleep 1
if [ -x "$(command -v make)" ]; then
echo -e "\e[1;32m[+] Make is installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Make isn't installed. Installing it...\e[0m"
sudo apt update -y -qq
sudo apt install $(apt search $(uname -r) | grep -i "linux-headers" | cut -d "/" -f 1) -y -qq
sudo apt install build-essential -y -qq
sleep 1
if [ -x "$(command -v make)" ]; then
echo -e "\e[1;32m[+] Make installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Make can't be installed. Verify if you're connected to Internet and try again later.\n\nExiting...\e[0m"
sleep 3
exit
fi
fi
sleep 1
# Checking if lsusb is installed
echo -e "\e[1;33m[*] Checking if lsusb is installed...\e[0m"
sleep 1
if [ -x "$(command -v lsusb)" ]; then
echo -e "\e[1;32m[+] Lsusb is installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Lsusb isn't installed. Installing it...\e[0m"
sudo apt update -y -qq
sudo apt install usbutils -y -qq
sleep 1
if [ -x "$(command -v lsusb)" ]; then
echo -e "\e[1;32m[+] Lsusb installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Lsusb can't be installed. Verify if you're connected to Internet and try again later.\n\nExiting...\e[0m"
sleep 3
exit
fi
fi
sleep 1
# Checking if bc is installed
echo -e "\e[1;33m[*] Checking if bc is installed...\e[0m"
sleep 1
if [ -x "$(command -v bc)" ]; then
echo -e "\e[1;32m[+] Bc is installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Bc isn't installed. Installing it...\e[0m"
sudo apt update -y -qq
sudo apt install bc -y -qq
sleep 1
if [ -x "$(command -v bc)" ]; then
echo -e "\e[1;32m[+] Bc installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Bc can't be installed. Verify if you're connected to Internet and try again later.\n\nExiting...\e[0m"
sleep 3
exit
fi
fi
sleep 1
# Checking if network-manager is installed
echo -e "\e[1;33m[*] Checking if network-manager is installed...\e[0m"
sleep 1
if [ -d "/etc/network-manager" -o -d "/etc/NetworkManager" ]; then
echo -e "\e[1;32m[+] Network-manager is installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Network-manager isn't installed. Installing it...\e[0m"
sudo apt update -y -qq
sudo apt install network-manager -y -qq
sleep 1
if [ -d "/etc/network-manager" -o -d "/etc/NetworkManager" ]; then
echo -e "\e[1;32m[+] Network-manager installed.\e[0m\n"
else
echo -e "\e[1;31m[!] Network-manager can't be installed. Verify if you're connected to Internet and try again later.\n\nExiting...\e[0m"
sleep 3
exit
fi
fi
sleep 1
# Checking if RTL88x2BU driver is downloaded
echo -e "\e[1;33m[*] Checking if RTL88x2BU driver is downloaded...\e[0m"
sleep 1
driver=$HOME/.RTL88x2BU-Linux-Driver/
if [ -d "$driver" ]; then
echo -e "\e[1;32m[+] RTL88x2BU driver is downloaded.\e[0m\n"
else
echo -e "\e[1;31m[!] RTL88x2BU driver isn't downloaded. Downloading it...\e[0m"
git clone https://github.com/RinCat/RTL88x2BU-Linux-Driver -q
mv RTL88x2BU-Linux-Driver $HOME/.RTL88x2BU-Linux-Driver/
sleep 1
if [ -d "$driver" ]; then
echo -e "\e[1;32m[+] RTL88x2BU driver downloaded.\e[0m\n"
else
echo -e "\e[1;31m[!] RTL88x2BU driver can't be downloaded. Verify if you're connected to Internet and try again later.\n\nExiting...\e[0m"
sleep 3
exit
fi
fi
sleep 1
echo -e "\e[1;37m==========> INSTALLING DRIVER <==========\e[0m\n"
echo -e -n "\e[1;34m[i] Please, plug your RTL88x2BU in any USB port. After do that, press [ENTER] to continue.\e[0m\n"
read
# Listing USB devices
check_devices() {
echo -e "\e[1;33m[*] Checking if RTL88x2BU is connected...\e[0m"
sleep 1
lsusb | grep -i "rtl"
echo -e -n "\e[1;34m[i] Is the device showed above your RTL88x2BU? [y/n]\e[1;37m >>> "
read option
case $option in
y|Y|yes|YES) ;;
n|N|no|NO) echo -e "\n\e[1;34m[i] Please, try plug your RTL88x2BU in another USB port. After do that, press [ENTER] to continue.\e[0m"
sleep 1
read
check_devices;;
*) echo -e "\e[1;31m[!] '$yn' is an invalid option!\e[0m\n"
check_devices;;
esac
}
check_devices
# Building RTL88x2BU driver
echo -e "\n\e[1;34m[i] Press [ENTER] to start installation. NOTE: This can take several minutes!\e[0m"
read
cd $driver
sudo make > /dev/null &
PID=$!
cnt=1
spin="|/-\\"
echo -e -n "\e[1;33m[*] Building driver... "
while [ -d /proc/$PID ]; do
echo -e -n "\b${spin:cnt++%${#spin}:1}"
sleep 0.25
done
echo -e -n "\bDONE!\e[0m\n"
# Installing RTL88x2BU driver
sudo make install > /dev/null &
PID=$!
cnt=1
spin="|/-\\"
echo -e -n "\e[1;33m[*] Installing driver... "
while [ -d /proc/$PID ]; do
echo -e -n "\b${spin:cnt++%${#spin}:1}"
sleep 0.25
done
echo -e -n "\bDONE!\e[0m\n"
cd - > /dev/null
# Starting RTL88x2BU driver and restarting network-manager
echo -e "\n\e[1;34m[i] Press [ENTER] to activate your RTL88x2BU. NOTE: Your network connection will be restarted and this can take some seconds!"
read
sudo modprobe 88x2bu
if [ -d "/etc/network-manager" ]; then
sudo service network-manager restart
else
sudo service NetworkManager restart
fi
sleep 5
echo -e "\e[1;34m[i] Setup completed successfully!\e[0m"
sleep 1
# Driver developers credits
echo -e "\n\e[1;37m==========> SUPPORT DRIVER CREATORS!!!!!! <==========\e[0m\n"
echo -e "\e[1;31m[❤️]\e[1;37m Please, \e[1;36mcontribute\e[1;37m, send so much \e[1;31mlove <3\e[1;37m and \e[1;32msupport\e[1;37m \e[1;34mRin Cat\e[1;37m and \e[1;34mMatin Lotfaliee\e[1;37m (RTL88x2BU driver developers)!!!!\e[0m\n"
echo -e "\e[1;37;44m ·Driver project repo ---------> https://github.com/RinCat/RTL88x2BU-Linux-Driver \e[0m"
echo -e "\e[1;37;44m ·Rin Cat GitHub page ---------> https://github.com/RinCat \e[0m"
echo -e "\e[1;37;44m ·Matin Lotfaliee GitHub page -> https://github.com/matinlotfali \e[0m"
echo -e "\e[0m"
sleep 2
#End of script :p