Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nu11secur1ty
GitHub Repository: nu11secur1ty/Kali-Linux
Path: blob/master/ALFA-W1F1/RTL8814AU/edit-options.sh
1306 views
1
#!/bin/sh
2
3
# Purpose: Make it easier to edit the correct driver options file.
4
#
5
# Flexible editor support.
6
#
7
# To make this file executable:
8
#
9
# $ chmod +x edit-options.sh
10
#
11
# To execute this file:
12
#
13
# $ sudo ./edit-options.sh
14
#
15
# Copyright(c) 2023 Nick Morrow
16
#
17
# This program is free software; you can redistribute it and/or modify
18
# it under the terms of version 2 of the GNU General Public License as
19
# published by the Free Software Foundation.
20
#
21
# This program is distributed in the hope that it will be useful, but
22
# WITHOUT ANY WARRANTY; without even the implied warranty of
23
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
# GNU General Public License for more details.
25
26
SCRIPT_NAME="edit-options.sh"
27
# SCRIPT_VERSION="20230126"
28
OPTIONS_FILE="8814au.conf"
29
30
# check to ensure sudo was used to start the script
31
if [ "$(id -u)" -ne 0 ]; then
32
echo "You must run this script with superuser (root) privileges."
33
echo "Try: \"sudo ./${SCRIPT_NAME}\""
34
exit 1
35
fi
36
37
DEFAULT_EDITOR="$(cat default-editor.txt)"
38
# try to find the user's default text editor through the EDITORS_SEARCH array
39
for TEXT_EDITOR in "${VISUAL}" "${EDITOR}" "${DEFAULT_EDITOR}" vi; do
40
command -v "${TEXT_EDITOR}" >/dev/null 2>&1 && break
41
done
42
# failure message if no editor was found
43
if ! command -v "${TEXT_EDITOR}" >/dev/null 2>&1; then
44
echo "No text editor was found (default: ${DEFAULT_EDITOR})."
45
echo "Please install ${DEFAULT_EDITOR} or edit the file 'default-editor.txt' to specify your editor."
46
echo "Once complete, please run \"sudo ./${SCRIPT_NAME}\""
47
exit 1
48
fi
49
50
${TEXT_EDITOR} /etc/modprobe.d/${OPTIONS_FILE}
51
52
printf "Do you want to apply the new options by rebooting now? (recommended) [y/N] "
53
read -r REPLY
54
case "$REPLY" in
55
[yY]*) reboot ;;
56
esac
57
58