Created
November 8, 2023 09:45
-
-
Save gustavorv86/2f51238b2781ced4b5c4a9b50f500725 to your computer and use it in GitHub Desktop.
Install Tp-Link wn821n rtl8192eu driver on GNU/Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
check_root() { | |
if [ $UID -ne 0 ]; then | |
echo "ERROR: run as root" | |
exit 1 | |
fi | |
} | |
install_packages() { | |
apt -y install git linux-headers-amd64 build-essential dkms | |
} | |
install_driver() { | |
mkdir -p /usr/local/src | |
cd /usr/local/src | |
if [ ! -d rtl8192eu-linux-driver ]; then | |
git clone https://github.com/Mange/rtl8192eu-linux-driver | |
fi | |
cd rtl8192eu-linux-driver | |
sed -i 's/REMAKE_INITRD="yes"/#REMAKE_INITRD="yes"/g' dkms.conf | |
dkms add . | |
dkms install rtl8192eu/1.0 | |
if [ ! -f /etc/modprobe.d/rtl8xxxu.conf ]; then | |
echo "blacklist rtl8xxxu" | sudo tee /etc/modprobe.d/rtl8xxxu.conf | |
fi | |
} | |
install() { | |
install_packages | |
install_driver | |
} | |
uninstall() { | |
dkms uninstall rtl8192eu/1.0 | |
dkms remove rtl8192eu/1.0 | |
rm -rf /usr/local/src/rtl8192eu-linux-driver | |
rm -f /etc/modprobe.d/rtl8xxxu.conf | |
} | |
main() { | |
check_root | |
if [ "$1" == "--uninstall" ]; then | |
uninstall | |
else | |
install | |
fi | |
dkms status | |
echo -e "\nDone. Reboot your computer.\n" | |
exit 0 | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment