jitty-scripts/rtlwifi-setup.sh

46 lines
988 B
Bash
Raw Normal View History

#!/bin/bash
pkgname="rtlwifi"
pkgurl="https://github.com/cilynx/rtl88x2bu.git"
tmpdir="/tmp"
_fetch_deps(){
if [ -f /usr/bin/apt ];then
2021-10-17 10:50:20 -07:00
apt install git dnsmasq hostapd bc build-essential dkms wget unzip rsync
elif [ -f /usr/bin/dnf ];then
2021-10-17 10:50:20 -07:00
dnf group install "Development Tools"
dnf install unzip dnsmasq hostapd bc dkms kernel-headers rsync wget
else
echo "No supported package manager"
fi
}
_download(){
if [ ! -d ${tmpdir}/${pkgname} ];then
git clone ${pkgurl} ${tmpdir}/${pkgname}
fi
}
2020-10-01 23:20:13 -07:00
_apply_patch(){
wget https://github.com/cilynx/rtl88x2bu/pull/58.patch
git apply 58.patch
}
_install(){
cd ${tmpdir}/${pkgname}
2020-10-01 23:20:13 -07:00
_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
}
_fetch_deps
_download
_install