Move clear commands into message function

This commit is contained in:
the-sane 2020-08-14 22:41:35 -04:00 committed by GitHub
parent cc2e9d6c84
commit b978c99e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,15 +76,18 @@ message() {
# those need to be handled specially in the code # those need to be handled specially in the code
if [ "$1" -eq 1 ]; then if [ "$1" -eq 1 ]; then
# info # info
clear
echo -e "\n$2\n" echo -e "\n$2\n"
read -n 1 -s -p "Press any key..." read -n 1 -s -p "Press any key..."
elif [ "$1" -eq 2 ]; then elif [ "$1" -eq 2 ]; then
# warning # warning
clear
echo -e "\n$2\n" echo -e "\n$2\n"
read -n 1 -s -p "Press any key..." read -n 1 -s -p "Press any key..."
return 0 return 0
elif [ "$1" -eq 3 ]; then elif [ "$1" -eq 3 ]; then
# question # question
clear
echo -e "$2" echo -e "$2"
while read -p "[y/n]: " yn; do while read -p "[y/n]: " yn; do
case "$yn" in case "$yn" in
@ -100,7 +103,7 @@ message() {
esac esac
done done
else else
echo -e "Invalid message type.\n\nText menus are not compatible with message types 4 and 5 (zenity radio lists)\nand require special handling.\n" echo -e "\nInvalid message type.\n\nText menus are not compatible with message types 4 and 5 (zenity radio lists)\nand require special handling.\n"
read -n 1 -s -p "Press any key..." read -n 1 -s -p "Press any key..."
fi fi
fi fi
@ -130,7 +133,6 @@ getdirs() {
fi fi
if [ -z "$wine_prefix" ] || [ -z "$game_path" ] || [ -z "$backup_path" ]; then if [ -z "$wine_prefix" ] || [ -z "$game_path" ] || [ -z "$backup_path" ]; then
clear
message 1 "You will now be asked to provide some directories needed by this script.\n\nThey will be saved for later use in:\n$conf_dir/$conf_subdir/" message 1 "You will now be asked to provide some directories needed by this script.\n\nThey will be saved for later use in:\n$conf_dir/$conf_subdir/"
if [ "$has_zen" -eq 1 ]; then if [ "$has_zen" -eq 1 ]; then
# Get the wine prefix directory # Get the wine prefix directory
@ -236,8 +238,6 @@ getdirs() {
# Save exported keybinds, wipe the USER directory, and restore keybinds # Save exported keybinds, wipe the USER directory, and restore keybinds
sanitize() { sanitize() {
clear
# Prompt user to back up the current keybinds in the game # Prompt user to back up the current keybinds in the game
message 1 "Before proceeding, please be sure you have\nexported your Star Citizen keybinds from within the game!\n\nTo do this, launch the game and go to:\nOptions->Keybindings->Control Profiles->Save Control Settings" message 1 "Before proceeding, please be sure you have\nexported your Star Citizen keybinds from within the game!\n\nTo do this, launch the game and go to:\nOptions->Keybindings->Control Profiles->Save Control Settings"
@ -298,7 +298,6 @@ check_map_count() {
# Check vm.max_map_count for the correct setting and let the user fix it if needed # Check vm.max_map_count for the correct setting and let the user fix it if needed
set_map_count() { set_map_count() {
clear
# If vm.max_map_count is already set, no need to do anything # If vm.max_map_count is already set, no need to do anything
if [ "$(cat /proc/sys/vm/max_map_count)" -ge 16777216 ]; then if [ "$(cat /proc/sys/vm/max_map_count)" -ge 16777216 ]; then
message 1 "vm.max_map_count is already set to the optimal value. You're all set!" message 1 "vm.max_map_count is already set to the optimal value. You're all set!"
@ -370,7 +369,6 @@ set_map_count() {
break break
;; ;;
"$manual") "$manual")
clear
if [ -d "/etc/sysctl.d" ]; then if [ -d "/etc/sysctl.d" ]; then
message 1 "To change the setting (a kernel parameter) until next boot, run:\n\nsudo sh -c 'sysctl -w vm.max_map_count=16777216'\n\nTo persist the setting between reboots, run:\n\nsudo sh -c 'echo \"vm.max_map_count = 16777216\" >> /etc/sysctl.d/20-max_map_count.conf && sysctl -p'" message 1 "To change the setting (a kernel parameter) until next boot, run:\n\nsudo sh -c 'sysctl -w vm.max_map_count=16777216'\n\nTo persist the setting between reboots, run:\n\nsudo sh -c 'echo \"vm.max_map_count = 16777216\" >> /etc/sysctl.d/20-max_map_count.conf && sysctl -p'"
else else