mirror of
https://github.com/morrownr/8821cu-20210916.git
synced 2024-11-01 01:05:25 +00:00
Addressed whines from "shellcheck -s sh"
This commit is contained in:
parent
5fd204f3df
commit
c0281e1d05
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Purpose: Remove Realtek out-of-kernel USB WiFi adapter drivers.
|
# Purpose: Remove Realtek out-of-kernel USB WiFi adapter drivers.
|
||||||
#
|
#
|
||||||
@ -33,11 +33,10 @@ KARCH="$(uname -m)"
|
|||||||
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
||||||
|
|
||||||
DRV_NAME="rtl${MODULE_NAME}"
|
DRV_NAME="rtl${MODULE_NAME}"
|
||||||
DRV_DIR="$(pwd)"
|
|
||||||
OPTIONS_FILE="${MODULE_NAME}.conf"
|
OPTIONS_FILE="${MODULE_NAME}.conf"
|
||||||
|
|
||||||
# check to ensure sudo was used
|
# check to ensure sudo was used
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "You must run this script with superuser (root) privileges."
|
echo "You must run this script with superuser (root) privileges."
|
||||||
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
||||||
exit 1
|
exit 1
|
||||||
@ -66,28 +65,28 @@ echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
|
|||||||
|
|
||||||
# check for and remove non-dkms installations
|
# check for and remove non-dkms installations
|
||||||
# standard naming
|
# standard naming
|
||||||
if [[ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]]; then
|
if [ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]; then
|
||||||
echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko"
|
echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko"
|
||||||
rm -f ${MODDESTDIR}${MODULE_NAME}.ko
|
rm -f "${MODDESTDIR}${MODULE_NAME}.ko"
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for and remove non-dkms installations
|
# check for and remove non-dkms installations
|
||||||
# with rtl added to module name (PClinuxOS)
|
# with rtl added to module name (PClinuxOS)
|
||||||
if [[ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]]; then
|
if [ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]; then
|
||||||
echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko"
|
echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko"
|
||||||
rm -f ${MODDESTDIR}rtl${MODULE_NAME}.ko
|
rm -f "${MODDESTDIR}rtl${MODULE_NAME}.ko"
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for and remove non-dkms installations
|
# check for and remove non-dkms installations
|
||||||
# with compressed module in a unique non-standard location (Armbian)
|
# with compressed module in a unique non-standard location (Armbian)
|
||||||
# Example: /usr/lib/modules/5.15.80-rockchip64/kernel/drivers/net/wireless/rtl8821cu/8821cu.ko.xz
|
# Example: /usr/lib/modules/5.15.80-rockchip64/kernel/drivers/net/wireless/rtl8821cu/8821cu.ko.xz
|
||||||
# Dear Armbiam, this is a really bad idea.
|
# Dear Armbiam, this is a really bad idea.
|
||||||
if [[ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]]; then
|
if [ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]; then
|
||||||
echo "Removing a non-dkms installation: /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz"
|
echo "Removing a non-dkms installation: /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz"
|
||||||
rm -f /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz
|
rm -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz"
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# information that helps with bug reports
|
# information that helps with bug reports
|
||||||
@ -109,8 +108,8 @@ if command -v dkms >/dev/null 2>&1; then
|
|||||||
# RESULT will be 3 if there are no instances of module to remove
|
# RESULT will be 3 if there are no instances of module to remove
|
||||||
# however we still need to remove various files or the install script
|
# however we still need to remove various files or the install script
|
||||||
# may complain.
|
# may complain.
|
||||||
if [[ ("$RESULT" = "0")||("$RESULT" = "3") ]]; then
|
if [ "$RESULT" = "0" ] || [ "$RESULT" = "3" ]; then
|
||||||
if [[ ("$RESULT" = "0") ]]; then
|
if [ "$RESULT" = "0" ]; then
|
||||||
echo "${DRV_NAME}/${DRV_VERSION} has been removed"
|
echo "${DRV_NAME}/${DRV_VERSION} has been removed"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -130,9 +129,10 @@ echo "You may now delete the driver directory if desired."
|
|||||||
|
|
||||||
# if NoPrompt is not used, ask user some questions
|
# if NoPrompt is not used, ask user some questions
|
||||||
if [ $NO_PROMPT -ne 1 ]; then
|
if [ $NO_PROMPT -ne 1 ]; then
|
||||||
read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r
|
echo "Do you want to reboot now? (recommended) [y/N]"
|
||||||
|
read -r REPLY
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
if [ "$REPLY" = y ] || [ "$REPLY" = Y ]; then
|
||||||
reboot
|
reboot
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/dash
|
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
SCRIPT_NAME="save-log.sh"
|
SCRIPT_NAME="save-log.sh"
|
||||||
|
Loading…
Reference in New Issue
Block a user