#!/bin/bash pkgname="rtl88x2bu-git" pkgurl="https://github.com/RinCat/RTL88x2BU-Linux-Driver.git" tmpdir="/usr/src" _fetch_deps(){ if [ -f /usr/bin/apt ];then sudo apt install git dnsmasq hostapd bc build-essential dkms wget unzip rsync elif [ -f /usr/bin/dnf ];then sudo dnf group install "Development Tools" sudo dnf install unzip dnsmasq hostapd bc dkms kernel-headers rsync wget else echo "No supported package manager" fi } _download(){ if [ ! -d "${tmpdir}"/"${pkgname}" ];then sudo git clone "${pkgurl}" "${tmpdir}"/"${pkgname}" fi } _apply_patch(){ wget "https://github.com/cilynx/rtl88x2bu/pull/58.patch" git apply 58.patch } _install(){ sed -i 's/PACKAGE_VERSION="@PKGVER@"/PACKAGE_VERSION="git"/g' /usr/src/rtl88x2bu-git/dkms.conf sudo dkms add -m rtl88x2bu -v git sudo dkms autoinstall sudo modprobe 88x2bu } _fetch_deps _download _install