From 222234df8348d3bff5d4109f3fd2e30a24b3be3d Mon Sep 17 00:00:00 2001 From: morrownr Date: Tue, 14 Dec 2021 07:09:23 -0600 Subject: [PATCH] minor updates --- README.md | 6 +++--- install-driver.sh | 25 +++++++++++++++-------- remove-driver.sh | 52 +++++++++++++++++++++++++++-------------------- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 62e8f6b..3872831 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ #### Problem reports should include the information obtained with the following command: ``` -$ sudo uname -a && mokutil --sb-state && lsusb && rfkill list all && dkms status && iw dev +$ sudo uname -a; mokutil --sb-state; lsusb; rfkill list all; dkms status; iw dev ``` ----- @@ -96,7 +96,7 @@ the Installation Steps can be improved. - openSUSE Tumbleweed (rolling) (kernel 5.15) -- Raspberry Pi OS (2021-10-30 (ARM 32 bit) (kernel 5.10) +- Raspberry Pi OS (2021-10-30) (ARM 32 bit) (kernel 5.10) - Raspberry Pi Desktop (x86 32 bit) (kernel 4.19) @@ -156,7 +156,7 @@ a good idea as to whether you need to remove a previously installed driver by running the following: ``` -sudo dkms status +dkms status ``` The installation instructions are for the novice user. Experienced users are welcome to alter the installation to meet their needs. diff --git a/install-driver.sh b/install-driver.sh index 3784d74..fc838c6 100755 --- a/install-driver.sh +++ b/install-driver.sh @@ -1,7 +1,7 @@ #!/bin/bash SCRIPT_NAME="install-driver.sh" -SCRIPT_VERSION="20211204" +SCRIPT_VERSION="20211212" DRV_NAME="rtl88x2bu" DRV_VERSION="5.13.1" @@ -10,12 +10,13 @@ OPTIONS_FILE="88x2bu.conf" DRV_DIR="$(pwd)" KRNL_VERSION="$(uname -r)" -NO_PROMPT=0 - clear echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" -# Get the options +# support for NoPrompt allows non-interactive use of this script +NO_PROMPT=0 + +# get the options while [ $# -gt 0 ] do case $1 in @@ -43,7 +44,7 @@ fi 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 "You will need to run the following before reattempting installation." echo "$ sudo ./remove-driver.sh" exit 1 fi @@ -62,6 +63,8 @@ if [[ "$RESULT" != "0" ]] then echo "An error occurred. dkms add error = ${RESULT}" echo "Please report this error." + echo "You will need to run the following before reattempting installation." + echo "$ sudo ./remove-driver.sh" exit $RESULT fi @@ -72,6 +75,8 @@ if [[ "$RESULT" != "0" ]] then echo "An error occurred. dkms build error = ${RESULT}" echo "Please report this error." + echo "You will need to run the following before reattempting installation." + echo "$ sudo ./remove-driver.sh" exit $RESULT fi @@ -82,24 +87,28 @@ if [[ "$RESULT" != "0" ]] then echo "An error occurred. dkms install error = ${RESULT}" echo "Please report this error." + echo "You will need to run the following before reattempting installation." + echo "$ sudo ./remove-driver.sh" exit $RESULT fi echo "The driver was installed successfully." +# unblock wifi rfkill unblock wlan +# if NoPrompt is not used, ask user some questions to complete installation if [ $NO_PROMPT -ne 1 ] then read -p "Do you want to edit the driver options file now? [y/N] " -n 1 -r - echo # move to a new line + echo if [[ $REPLY =~ ^[Yy]$ ]] then nano /etc/modprobe.d/${OPTIONS_FILE} fi - read -p "Do you want to reboot now? [y/N] " -n 1 -r - echo # move to a new line + read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r + echo if [[ $REPLY =~ ^[Yy]$ ]] then reboot diff --git a/remove-driver.sh b/remove-driver.sh index a083197..aed40ba 100755 --- a/remove-driver.sh +++ b/remove-driver.sh @@ -1,34 +1,42 @@ #!/bin/bash SCRIPT_NAME="remove-driver.sh" -SCRIPT_VERSION="20211204" +SCRIPT_VERSION="20211212" DRV_NAME="rtl88x2bu" DRV_VERSION="5.13.1" OPTIONS_FILE="88x2bu.conf" +DRV_DIR="$(pwd)" +KRNL_VERSION="$(uname -r)" + +clear +echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" + +# support for NoPrompt allows non-interactive use of this script NO_PROMPT=0 -# Get the options +# get the options while [ $# -gt 0 ] do - case $1 in - NoPrompt) - NO_PROMPT=1 ;; - *h|*help|*) - echo "Syntax $0 " - echo " NoPrompt - noninteractive mode" - echo " -h|--help - Show help" - exit 1 - ;; - esac - shift + case $1 in + NoPrompt) + NO_PROMPT=1 ;; + *h|*help|*) + echo "Syntax $0 " + echo " NoPrompt - noninteractive mode" + echo " -h|--help - Show help" + exit 1 + ;; + esac + shift done +# 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}\"" + echo "Try: \"sudo ./${SCRIPT_NAME}\"" exit 1 fi @@ -47,7 +55,7 @@ then echo "Deleting source files from /usr/src/${DRV_NAME}-${DRV_VERSION}" rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION} echo "The driver was removed successfully." - echo "Info: You may now delete the driver directory if desired." + echo "You may now delete the driver directory if desired." else echo "An error occurred. dkms remove error = ${RESULT}" echo "Please report this error." @@ -55,13 +63,13 @@ else fi if [ $NO_PROMPT -ne 1 ] - then - read -p "Are you ready to reboot now? [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - reboot - fi +then + read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]] + then + reboot + fi fi exit 0