diff --git a/rtlwifi-setup.sh b/rtlwifi-setup.sh index 71b7d09..9ba9564 100755 --- a/rtlwifi-setup.sh +++ b/rtlwifi-setup.sh @@ -1,17 +1,17 @@ #!/bin/bash -pkgname="rtlwifi" -pkgurl="https://github.com/cilynx/rtl88x2bu.git" -tmpdir="/tmp" +pkgname="rtl88x2bu-git" +pkgurl="https://github.com/RinCat/RTL88x2BU-Linux-Driver.git" +tmpdir="/usr/src" _fetch_deps(){ if [ -f /usr/bin/apt ];then - apt install git dnsmasq hostapd bc build-essential dkms wget unzip rsync + sudo apt install git dnsmasq hostapd bc build-essential dkms wget unzip rsync elif [ -f /usr/bin/dnf ];then - dnf group install "Development Tools" - dnf install unzip dnsmasq hostapd bc dkms kernel-headers rsync wget + 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 @@ -20,7 +20,7 @@ _fetch_deps(){ _download(){ if [ ! -d "${tmpdir}"/"${pkgname}" ];then - git clone "${pkgurl}" "${tmpdir}"/"${pkgname}" + sudo git clone "${pkgurl}" "${tmpdir}"/"${pkgname}" fi } @@ -30,14 +30,10 @@ _apply_patch(){ } _install(){ - cd "${tmpdir}"/"${pkgname}" || exit 1 - #_apply_patch - VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf) - rsync -rvhP ./ /usr/src/rtl88x2bu-"${VER}" - dkms add -m rtl88x2bu -v "${VER}" - dkms build -m rtl88x2bu -v "${VER}" - dkms install -m rtl88x2bu -v "${VER}" - modprobe 88x2bu + 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