diff --git a/run_onchange_after_install_main_deps.sh.tmpl b/run_onchange_after_install_main_deps.sh.tmpl index 05a0a19..3b9a7ba 100644 --- a/run_onchange_after_install_main_deps.sh.tmpl +++ b/run_onchange_after_install_main_deps.sh.tmpl @@ -35,17 +35,12 @@ $Green""######################################################################## " read -{{ if eq .chezmoi.osRelease.id "almalinux" -}} - echo "Installing prerequestative ncurses for this script's interface"|awk '{print $Gray$0$NC}'|sed "s/^/$PADDING/" - - sudo dnf install ncurses -y 2>&1|awk '{print $Gray$0$NC}'|sed "s/^/$PADDING/" - -{{ end -}} #Setup -TERM_WIDTH_BASE=$(tput cols) -LINES=$(tput lines) +TERM_WIDTH_BASE=$(stty size|awk '{print $2}') +PADDING=$(printf "%${PAD_LEN}s") # 4 spaces of padding +TERM_WIDTH=$(($TERM_WIDTH_BASE - $PAD_LEN)) USER=$(whoami) STEP=1 @@ -90,14 +85,20 @@ new_line () { } pad() { - local PADDING=$(printf "%${PAD_LEN}s") # 4 spaces of padding - local TERM_WIDTH=$(($TERM_WIDTH_BASE - $PAD_LEN)) while IFS= read -r line; do echo -e $Gray$line$NC | fold -s -w $TERM_WIDTH | sed "s/^/$PADDING/" done } +{{ if eq .chezmoi.osRelease.id "almalinux" -}} + echo "Installing prerequestative ncurses for this script's interface"|pad + + sudo dnf install ncurses -y 2>&1|pad + +{{ end -}} + +LINES=$(tput lines) print_block