加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
install-driver.sh 2.04 KB
一键复制 编辑 原始数据 按行查看 历史
morrownr 提交于 2021-04-07 13:45 . various updates
#!/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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化