diff --git a/install/install.sh b/install/install.sh index d6030c3a..4cf4c869 100755 --- a/install/install.sh +++ b/install/install.sh @@ -170,6 +170,44 @@ else C_OK=""; C_ERR=""; C_WARN=""; C_BOLD=""; C_OFF="" fi +# Progress rendering tier. +# 2 a terminal that can draw: redraw a bar in place, with block characters +# 1 a terminal without colour or UTF-8: same bar, ASCII, still redrawn +# 0 not a terminal: one line per step, no escapes, no carriage returns +# +# Tier 0 is not a fallback, it is a requirement. Redirected output ends up in +# install.log, in CI transcripts and in bug reports, and control characters +# make all three unreadable. CI asserts that redirected output contains no +# escape sequence and no carriage return. +PROGRESS_TIER=0 +if [[ -t 1 && "$WANT_PROGRESS" == "1" && "${TERM:-}" != "dumb" ]]; then + if [[ -z "${NO_COLOR:-}" && "${LC_ALL:-${LC_CTYPE:-${LANG:-}}}" == *[Uu][Tt][Ff]* ]]; then + PROGRESS_TIER=2 + else + PROGRESS_TIER=1 + fi +fi + +if (( PROGRESS_TIER >= 2 )); then + BAR_FULL="━"; BAR_EMPTY="─" +else + BAR_FULL="#"; BAR_EMPTY="-" +fi + +# draw_bar