代码拉取完成,页面将自动刷新
#!/bin/bash
SCRIPT_NAME="install-driver.sh"
SCRIPT_VERSION="20210404"
DRV_NAME="rtl8812au"
DRV_VERSION="5.9.3.2"
OPTIONS_FILE="8812au.conf"
DRV_DIR="$(pwd)"
KRNL_VERSION="$(uname -r)"
clear
echo "${SCRIPT_NAME} version ${SCRIPT_VERSION}"
# check to ensure sudo was used
if [[ $EUID -ne 0 ]]
then
echo "You must run this script with superuser (root) privileges."
echo "Try: \"sudo ./${SCRIPT_NAME}\""
exit 1
fi
# check for previous installation
if [[ -d "/usr/src/${DRV_NAME}-${DRV_VERSION}" ]]
then
echo "It appears that this driver may already be installed."
echo "You will need to run the following before installing."
echo "$ sudo ./remove-driver.sh"
exit 1
fi
echo "This is a process that can take a considerable amount of time."
# the add command requires source in /usr/src/${DRV_NAME}-${DRV_VERSION}
echo "Copying source files to: /usr/src/${DRV_NAME}-${DRV_VERSION}"
cp -rf "${DRV_DIR}" /usr/src/${DRV_NAME}-${DRV_VERSION}
echo "Copying ${OPTIONS_FILE} to: /etc/modprobe.d"
cp -f ${OPTIONS_FILE} /etc/modprobe.d
echo "All required files have been copied to the proper places."
dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
# dkms add ${DRV_NAME}/${DRV_VERSION}
RESULT=$?
if [[ "$RESULT" != "0" ]]
then
echo "An error occurred while running: dkms add : ${RESULT}"
echo "Please report errors."
exit $RESULT
fi
dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
RESULT=$?
if [[ "$RESULT" != "0" ]]
then
echo "An error occurred while running: dkms build : ${RESULT}"
echo "Please report errors."
exit $RESULT
fi
dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
RESULT=$?
if [[ "$RESULT" != "0" ]]
then
echo "An error occurred while running: dkms install : ${RESULT}"
echo "Please report errors."
exit $RESULT
fi
echo "The driver was installed successfully."
read -p "Do you want edit the driver options file now? [y/n] " -n 1 -r
echo # move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
nano /etc/modprobe.d/${OPTIONS_FILE}
fi
read -p "Are you ready to reboot now? [y/n] " -n 1 -r
echo # move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
reboot
fi
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。