Path: blob/master/ALFA-W1F1/RTL8814AU/edit-options.sh
1306 views
#!/bin/sh12# Purpose: Make it easier to edit the correct driver options file.3#4# Flexible editor support.5#6# To make this file executable:7#8# $ chmod +x edit-options.sh9#10# To execute this file:11#12# $ sudo ./edit-options.sh13#14# Copyright(c) 2023 Nick Morrow15#16# This program is free software; you can redistribute it and/or modify17# it under the terms of version 2 of the GNU General Public License as18# published by the Free Software Foundation.19#20# This program is distributed in the hope that it will be useful, but21# WITHOUT ANY WARRANTY; without even the implied warranty of22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the23# GNU General Public License for more details.2425SCRIPT_NAME="edit-options.sh"26# SCRIPT_VERSION="20230126"27OPTIONS_FILE="8814au.conf"2829# check to ensure sudo was used to start the script30if [ "$(id -u)" -ne 0 ]; then31echo "You must run this script with superuser (root) privileges."32echo "Try: \"sudo ./${SCRIPT_NAME}\""33exit 134fi3536DEFAULT_EDITOR="$(cat default-editor.txt)"37# try to find the user's default text editor through the EDITORS_SEARCH array38for TEXT_EDITOR in "${VISUAL}" "${EDITOR}" "${DEFAULT_EDITOR}" vi; do39command -v "${TEXT_EDITOR}" >/dev/null 2>&1 && break40done41# failure message if no editor was found42if ! command -v "${TEXT_EDITOR}" >/dev/null 2>&1; then43echo "No text editor was found (default: ${DEFAULT_EDITOR})."44echo "Please install ${DEFAULT_EDITOR} or edit the file 'default-editor.txt' to specify your editor."45echo "Once complete, please run \"sudo ./${SCRIPT_NAME}\""46exit 147fi4849${TEXT_EDITOR} /etc/modprobe.d/${OPTIONS_FILE}5051printf "Do you want to apply the new options by rebooting now? (recommended) [y/N] "52read -r REPLY53case "$REPLY" in54[yY]*) reboot ;;55esac565758