From 03cbf4806726813e47dd31f116e26b66e2f9be80 Mon Sep 17 00:00:00 2001 From: alexveebee Date: Sat, 9 Dec 2023 22:59:02 +0000 Subject: [PATCH] Display the GPU name better. --- install.sh | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index d0e81fd..735c145 --- a/install.sh +++ b/install.sh @@ -141,7 +141,31 @@ log_message() { ;; esac } +boxDrawingText() +{ + local string=$1 + local maxwidth=$2 + # empty string + local color= + if [ $# -eq 3 ]; then + color=$3 + fi + + local stringlength=${#string} + + # stringlength < maxwidth ? maxwidth : stringlength + local width=$((stringlength < maxwidth ? maxwidth : stringlength)) + + local topL="╔" + local bottomL="╚" + local topR="╗" + local bottomR="╝" + local middle="║" + local space=" " + + echo -e "$color$middle$string$(printf ' %.0s' $(seq 1 $((width - stringlength))))$middle" +} # Log your messages test window #log_message "INFO" "Something has been launched." #log_message "WARN" "${yellow_fg_strong}Something is not installed on this system.${reset}" @@ -623,11 +647,11 @@ install_extras() { done < <(lspci | grep VGA | cut -d ':' -f3) echo "" - echo -e "${blue_bg}╔════ GPU INFO ═════════════════════════════════╗${reset}" - echo -e "${blue_bg}║ ║${reset}" - echo -e "${blue_bg}║* ${gpu_info:1} ║${reset}" - echo -e "${blue_bg}║ ║${reset}" - echo -e "${blue_bg}╚═══════════════════════════════════════════════╝${reset}" + echo -e "${blue_bg}╔════ GPU INFO ═════════════════════════════════════════════════════════════╗${reset}" + boxDrawingText "" 75 $blue_bg + boxDrawingText "* ${gpu_info:1}" 75 $blue_bg + boxDrawingText "" 75 $blue_bg + echo -e "${blue_bg}╚═══════════════════════════════════════════════════════════════════════════╝${reset}" echo "" # Prompt for GPU choice