From ea13bf3bd7f3991de5ab353e79aa05494a6cb959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Wed, 6 May 2026 20:28:41 +0900 Subject: [PATCH] Add live status pulse to node installer --- install_virtuality_node.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/install_virtuality_node.sh b/install_virtuality_node.sh index 34b76f0..e76b5b4 100644 --- a/install_virtuality_node.sh +++ b/install_virtuality_node.sh @@ -67,8 +67,24 @@ fail() { echo -e " ${RED}✗${RESET} $*"; log "ERROR: $*"; echo; echo -e "${RED run_logged() { local description="$1" shift + local start_ts pid code spinner elapsed symbol i log "RUN: $*" - if "$@" >> "$LOG_FILE" 2>&1; then + start_ts="$(date +%s)" + "$@" >> "$LOG_FILE" 2>&1 & + pid=$! + spinner=("⠋" "⠙" "⠹" "⠸" "⠼" "⠴" "⠦" "⠧" "⠇" "⠏") + i=0 + while kill -0 "$pid" 2>/dev/null; do + elapsed=$(( $(date +%s) - start_ts )) + symbol="${spinner[$((i % ${#spinner[@]}))]}" + printf "\r ${CYAN}%s${RESET} %s... ${GRAY}%ss${RESET} ${GRAY}(лог: %s)${RESET}" "$symbol" "$description" "$elapsed" "$LOG_FILE" + sleep 1 + i=$((i + 1)) + done + wait "$pid" + code=$? + printf "\r%*s\r" 120 "" + if [[ "$code" -eq 0 ]]; then ok "$description" else fail "$description"