rtlwifi-setup.sh: pull git repo instead of zip

This commit is contained in:
mollusk 2020-09-04 12:44:21 -07:00
parent 61639c60a5
commit 2eb31d7a7b

View File

@ -1,8 +1,8 @@
#!/bin/bash
pkgname="master"
pkgurl="git@github.com:cilynx/rtl88x2bu/${pkgname}.zip"
pkgname="rtlwifi"
pkgurl="https://github.com/cilynx/rtl88x2bu.git"
installcmd="dnf install"
installcmdextra="dnf group install"
pkgdeps="wget unzip dnsmasq hostapd bc dkms kernel-headers rsync"
@ -10,20 +10,26 @@ pkgdepsextra='"Development Tools"'
tmpdir="/tmp"
_fetch_deps(){
${installcmd} ${pkgdeps}
${installcmdextra} ${pkgdepsextra}
if [ -f /usr/bin/apt ];then
apt install git dnsmasq hostapd bc build-essential dkms
elif [ -f /usr/bin/dnf ];then
dnf install unzip dnsmasq hostapd bc dkms kernel-headers rsync
else
echo "No supported package manager"
fi
}
_download(){
if [ ! -f ${tmpdir}/${pkgname}.zip ];then
wget ${pkgurl} -P ${tmpdir}
if [ ! -d ${tmpdir}/${pkgname} ];then
git clone ${pkgurl} ${tmpdir}/${pkgname}
fi
}
_extract(){
if [ -f $(which unzip) ];then
cd ${tmpdir}
unzip ${pkgname}.zip
cd ${tmpdir}/${pkgname}
else
echo "Install unzip"
fi
@ -31,15 +37,15 @@ _extract(){
}
_install(){
cd ${tmpdir}/rtl88x2BU_WiFi_linux_v5.3.1_27678.20180430_COEX20180427-5959-master
cd ${tmpdir}/${pkgname}
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
_extract
_install