1
0
mirror of https://github.com/morrownr/8821cu-20210916.git synced 2024-10-31 16:55:24 +00:00

Test for ${EDITOR} or fall-back to nano for text file editing

This commit is contained in:
Miles Goodhew 2023-01-15 13:15:28 +11:00
parent 6e027bf541
commit e5c1d42247
4 changed files with 27 additions and 10 deletions

View File

@ -546,7 +546,7 @@ dtoverlay=disable-wifi
#### Step 1: Edit wpa_supplicant.conf
```
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
sudo ${EDITOR} /etc/wpa_supplicant/wpa_supplicant.conf
```
#### Step 2: Delete the relevant WiFi network block (including the 'network=' and opening/closing braces.

View File

@ -29,7 +29,7 @@ How do I Enable Concurrent Mode?
Edit the `Makefile` with a text editor:
```
nano Makefile
${EDITOR} Makefile
```
Change the following line:

View File

@ -20,7 +20,20 @@ then
exit 1
fi
nano /etc/modprobe.d/${OPTIONS_FILE}
# Check if ${EDITOR} is an executable or try to default to nano or finally complain if it's not installed.
if ! [ -x "${EDITOR}" ]
then
EDITOR="$(which nano 2>/dev/null)"
if ! [ -x "${EDITOR}" ]
then
echo "No text editor found (default: nano)."
echo "Please install one and set the EDITOR variable to point to it."
echo "When you have an editor, please run \"sudo ./${SCRIPT_NAME}\""
exit 1
fi
fi
${EDITOR} /etc/modprobe.d/${OPTIONS_FILE}
read -p "Do you want to apply the new options by rebooting now? [y/N] " -n 1 -r
echo # move to a new line

View File

@ -87,13 +87,17 @@ then
exit 1
fi
# check to ensure nano is installed
if ! command -v nano >/dev/null 2>&1
# Check if ${EDITOR} is an executable or try to default to nano or finally complain if it's not installed.
if ! [ -x "${EDITOR}" ]
then
echo "A required package is not installed."
echo "Please install the following package: nano"
echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\""
EDITOR="$(which nano 2>/dev/null)"
if ! [ -x "${EDITOR}" ]
then
echo "No text editor found (default: nano)."
echo "Please install one and set the EDITOR variable to point to it."
echo "When you have an editor, please run \"sudo ./${SCRIPT_NAME}\""
exit 1
fi
fi
# support for the NoPrompt option allows non-interactive use of this script
@ -353,7 +357,7 @@ then
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
nano /etc/modprobe.d/${OPTIONS_FILE}
${EDITOR} /etc/modprobe.d/${OPTIONS_FILE}
fi
read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r