#!/usr/bin/env bash
# Fix Wireless Driver on Lenovo IdeaPad Yoga 13
# Realtek Semiconductor Corp. RTL8723AU 802.11n WLAN Adapter
# SUCCESSFUL on Ubuntu 16.04.
# FAILED on Ubuntu 16.10, and 17.04.
# On 16.04, Wireless is (usually) able to connect, albeit at <1 Mbps.
# Enough to install git and clone the driver repo.
# If not, will have to use a good ol' USB drive.
sudo apt -y install git
git clone https://github.com/lwfinger/rtl8723au.git
# Make, Install
cd rtl8723au/
make
sudo make install
# Remove the faulty native driver module
sudo modprobe -r r8723au
# Add the new 8723au driver.
sudo modprobe 8723au
# Blacklist native drive from loading in the future
echo "blacklist r8723au" | sudo tee --append /etc/modprobe.d/blacklist-r8723au.conf > /dev/null
echo "Success? Restart to confirm."