Fix bashisms (#512)

Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com>
This commit is contained in:
Nyx 2024-09-19 12:39:09 -04:00 committed by GitHub
parent c3eea0dfff
commit 7bd9f8aee8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 23 additions and 16 deletions

View File

@ -52,7 +52,7 @@ installDriver() {
$ESCALATION_TOOL dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y
printf "%b\n" "${YELLOW}Building the drivers may take upto 5 minutes. Please don't kill the script!\n If the build failed try running the script again, select \"Remove Nvidia Drivers\" and reboot the system, then try installing drivers again.${RC}"
for i in {1..5}; do
for i in $(seq 1 5); do
if checkDriverInstallation; then
printf "%b\n" "${GREEN}Driver installed successfully.${RC}"
printf "%b\n" "${GREEN}Installed driver version $(modinfo -F version nvidia)${RC}"
@ -91,4 +91,4 @@ printf "%b\n" "${YELLOW}Warning! This script will enable Nvidia non-free reposit
checkEnv
checkEscalationTool
userConfirmation
userConfirmation

View File

@ -54,8 +54,8 @@ encrypt_file() {
echo "Enter the path for the encrypted file or directory:"
read -r OUTPUT_PATH
echo "Enter the encryption password:"
read -s -r PASSWORD
printf "Enter the encryption password: "
read -r PASSWORD
if [ -d "$INPUT_PATH" ]; then
# Encrypt each file in the directory
@ -99,8 +99,8 @@ decrypt_file() {
echo "Enter the path for the decrypted file or directory:"
read -r OUTPUT_PATH
echo "Enter the decryption password:"
read -s -r PASSWORD
printf "Enter the decryption password: "
read -r PASSWORD
if [ -d "$INPUT_PATH" ]; then
# Decrypt each file in the directory
@ -145,8 +145,8 @@ main(){
*) echo "Invalid choice. Please try again." ;;
esac
echo "Press [Enter] to continue..."
read -r
printf "Press [Enter] to continue..."
read -r dummy
done
}

View File

@ -25,7 +25,8 @@ checkGroupAvailabe "$groups" "$available_groups" || exit 1
groups_to_add=$(echo "$groups" | tr ' ' ',')
read -p "Are you sure you want to add user $username to $groups_to_add? [Y/N]: " confirm
printf "Are you sure you want to add user $username to $groups_to_add? [Y/N]: "
read -r confirm
confirmAction || exit 1
$ESCALATION_TOOL usermod -aG $groups_to_add "$username"

View File

@ -10,7 +10,8 @@ printf "%b\n" "${YELLOW}=================${RC}"
username=$(promptUsername "" "root") || exit 1
password=$(promptPassword) || exit 1
read -p "Are you sure you want to change password for $username? [Y/N]: " confirm
printf "Are you sure you want to change password for $username? [Y/N]: "
read -r confirm
confirmAction || exit 1
echo "$username:$password" | $ESCALATION_TOOL chpasswd

View File

@ -17,7 +17,8 @@ if [ "$username" = "$USER" ]; then
return
fi
read -p "Are you sure you want to delete user $username? [Y/N]: " confirm
printf "Are you sure you want to delete user $username? [Y/N]: "
read -r confirm
confirmAction || exit 1
$ESCALATION_TOOL userdel --remove "$username" 2>/dev/null

View File

@ -20,7 +20,8 @@ checkGroupAvailabe "$groups" "$user_groups" || exit 1
groups_to_remove=$(echo "$groups" | tr ' ' ',')
read -p "Are you sure you want to remove user $username from $groups_to_remove? [Y/N]: " confirm
printf "Are you sure you want to remove user $username from $groups_to_remove? [Y/N]: "
read -r confirm
confirmAction || exit 1
$ESCALATION_TOOL usermod -rG $groups_to_remove "$username"

View File

@ -4,7 +4,8 @@
# Prompt for username
promptUsername() {
read -p "Enter the username: " username
printf "Enter the username: "
read -r username
checkEmpty "$username";
@ -21,9 +22,11 @@ promptUsername() {
# Prompt for password
promptPassword() {
stty -echo
read -p "Enter the password (PASSWORD IS HIDDEN): " password1
printf "Enter the password (PASSWORD IS HIDDEN): "
read -r password1
echo >&2
read -p "Re-enter the password (PASSWORD IS HIDDEN): " password2
printf "Re-enter the password (PASSWORD IS HIDDEN): "
read -r password2
echo >&2
stty echo
@ -97,4 +100,4 @@ checkGroupAvailabe() {
}
checkEnv
checkEscalationTool
checkEscalationTool