-
Notifications
You must be signed in to change notification settings - Fork 10
/
update-driver-after-kernel-upgrade
executable file
·36 lines (36 loc) · 2.05 KB
/
update-driver-after-kernel-upgrade
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
#!/bin/bash
cd "$(dirname $0)" #move to the directory where this file is located
echo
echo "This will recompile the RT28XX/RT539X Wireless Network driver for your current Linux kernel."
echo "You need to do this after upgrading the kernel and restarting the computer."
echo "If your wireless stopped working after restarting after installing an Ubuntu update, that's probably what you did."
echo "Conversely, if your wireless is still working, you probably haven't restarted yet. If that's the case, you should not run this now."
echo "Basically, DON'T RUN THIS IF YOUR WIRELESS NETWORK ADAPTER IS STILL WORKING!"
echo
echo "If you've made any manual changes to the code in $(dirname $0) you will want to abort this now, as any changes will be wiped."
echo "Unless you've modified the Makefile or modified the code in any other way, don't worry about the above warning."
echo "Best of luck, and hopefully the Open Source driver will work properly soon, so we can avoid this nonsense!"
echo "- Ronny Ager-Wick"
echo
echo "If you do NOT want to continue, press Ctrl-C now."
read -n1 -r -p "Press any key to continue..." key
echo
sudo apt-get -y install git linux-headers-$(uname -r) build-essential dkms fakeroot
if [ $? -eq 0 ]; then // kernel and requirements installed.
sudo apt-get -y purge $(dpkg -l linux-headers-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')") # remove all non-current headers
git checkout master
git reset --hard # remove any changes to existing files
git clean -f # remove any new files
git pull origin master # https://github.com/agerwick/RT28XX-RT539X-Linux-driver
sudo make
sudo make install
echo
echo "If there are any errors above, this will not work. Warnings are fine."
echo
sudo modprobe -v rt5390sta
echo
echo "Your wireless network adapter should start working in a few seconds. If not, try restarting."
else
echo "Some of the requirements are not installed. We need an internet connection in order to download them."
echo "Please connect the laptop using a LAN cable and try again."
fi