From d25c213346fc1c5c7d56c918e844ec4c162b3b99 Mon Sep 17 00:00:00 2001 From: Andrei Smaliak Date: Sat, 6 Jun 2026 07:46:48 +0400 Subject: [PATCH] Added qt libs missed --- install_iomatex_edge.sh | 42 +++++-- stage_env/stage_env_install_no_pulse.sh | 136 ++++++++++++++++++++--- stage_itscreen/stage_itscreen_install.sh | 73 ++++++++++-- 3 files changed, 220 insertions(+), 31 deletions(-) diff --git a/install_iomatex_edge.sh b/install_iomatex_edge.sh index daa285e..fafe354 100755 --- a/install_iomatex_edge.sh +++ b/install_iomatex_edge.sh @@ -32,24 +32,52 @@ spinner() { local msg="$2" local spin='|/-\' local i=0 + local start_ts=0 + local elapsed=0 + local last_heartbeat=0 + local spinner_tty=0 - if [[ ! -t 1 ]]; then - wait "$pid" - return $? + start_ts="$(date +%s)" + + if [[ -w /dev/tty ]]; then + spinner_tty=1 + fi + + if command -v tput >/dev/null 2>&1 && [[ "$spinner_tty" -eq 1 ]]; then + tput civis >/dev/tty 2>/dev/null || true fi while kill -0 "$pid" 2>/dev/null; do - i=$(( (i + 1) % 4 )) - printf '\r[%c] %s' "${spin:$i:1}" "$msg" + i=$(((i + 1) % 4)) + elapsed=$(( $(date +%s) - start_ts )) + if [[ "$spinner_tty" -eq 1 ]]; then + printf '\r[%c] %s... %ss' "${spin:$i:1}" "$msg" "$elapsed" >/dev/tty + fi + if (( elapsed >= last_heartbeat + 15 )); then + log "HEARTBEAT: ${msg} still running (${elapsed}s)" + last_heartbeat="$elapsed" + fi sleep 0.2 done + if command -v tput >/dev/null 2>&1 && [[ "$spinner_tty" -eq 1 ]]; then + tput cnorm >/dev/tty 2>/dev/null || true + fi + wait "$pid" local rc=$? if [[ "$rc" -eq 0 ]]; then - printf '\r[OK] %s%*s\n' "$msg" $(( 60 - ${#msg} )) "" + if [[ "$spinner_tty" -eq 1 ]]; then + printf '\r[OK] %s. \n' "$msg" >/dev/tty + else + echo "[OK] $msg" + fi else - printf '\r[FAIL:%s] %s%*s\n' "$rc" "$msg" $(( 54 - ${#msg} )) "" + if [[ "$spinner_tty" -eq 1 ]]; then + printf '\r[FAIL:%s] %s. \n' "$rc" "$msg" >/dev/tty + else + echo "[FAIL:$rc] $msg" + fi fi return "$rc" } diff --git a/stage_env/stage_env_install_no_pulse.sh b/stage_env/stage_env_install_no_pulse.sh index 81c8271..7bb1297 100644 --- a/stage_env/stage_env_install_no_pulse.sh +++ b/stage_env/stage_env_install_no_pulse.sh @@ -151,6 +151,7 @@ apt_repair_state() { apt_install_missing() { local pkgs=("$@") local missing=() + local failed=() local pkg for pkg in "${pkgs[@]}"; do @@ -173,12 +174,47 @@ apt_install_missing() { apt_update_if_needed - run_long "Install packages" 1800 \ + if run_long "Install packages" 1800 \ /usr/bin/env DEBIAN_FRONTEND=noninteractive \ /usr/bin/apt-get -y \ -o Dpkg::Options::="--force-confdef" \ -o Dpkg::Options::="--force-confold" \ - install "${missing[@]}" + install "${missing[@]}"; then + return 0 + fi + + log "Bulk package install failed; repairing APT/DPKG state and retrying packages one by one" + echo "[!] Bulk package install failed; retrying packages one by one (see $LOG)" + + apt_repair_state || true + + for pkg in "${missing[@]}"; do + if package_installed "$pkg"; then + log "Package installed during bulk attempt: $pkg" + continue + fi + + if run_long "Install package ${pkg}" 900 \ + /usr/bin/env DEBIAN_FRONTEND=noninteractive \ + /usr/bin/apt-get -y \ + -o Dpkg::Options::="--force-confdef" \ + -o Dpkg::Options::="--force-confold" \ + install "$pkg"; then + continue + fi + + failed+=("$pkg") + apt_repair_state || true + done + + if [ "${#failed[@]}" -eq 0 ]; then + log "Packages installed after one-by-one retry: ${missing[*]}" + return 0 + fi + + log "Failed packages after one-by-one retry: ${failed[*]}" + echo "[!] Failed packages after one-by-one retry: ${failed[*]} (see $LOG)" + return 1 } apt_package_available() { @@ -424,35 +460,101 @@ spinner() { local msg="${2:-Working}" local spin='|/-\' local i=0 + local start_ts=0 + local elapsed=0 + local last_heartbeat=0 + local spinner_tty=0 + + start_ts="$(date +%s)" + + if [[ -w /dev/tty ]]; then + spinner_tty=1 + fi + + if command -v tput >/dev/null 2>&1 && [[ "$spinner_tty" -eq 1 ]]; then + tput civis >/dev/tty 2>/dev/null || true + fi - command -v tput >/dev/null 2>&1 && tput civis || true while kill -0 "$pid" 2>/dev/null; do - i=$(( (i+1) % 4 )) - printf "\r[%c] %s..." "${spin:$i:1}" "$msg" + i=$(((i+1) % 4)) + elapsed=$(( $(date +%s) - start_ts )) + if [[ "$spinner_tty" -eq 1 ]]; then + printf "\r[%c] %s... %ss" "${spin:$i:1}" "$msg" "$elapsed" >/dev/tty + fi + if (( elapsed >= last_heartbeat + 15 )); then + log "HEARTBEAT: ${msg} still running (${elapsed}s)" + last_heartbeat="$elapsed" + fi sleep 0.2 done - if [ -t 1 ]; then - printf "\r%-80s\r" "" + + if [[ "$spinner_tty" -eq 1 ]]; then + printf "\r%-80s\r" "" >/dev/tty + fi + if command -v tput >/dev/null 2>&1 && [[ "$spinner_tty" -eq 1 ]]; then + tput cnorm >/dev/tty 2>/dev/null || true fi - command -v tput >/dev/null 2>&1 && tput cnorm || true } run_long() { local msg="$1" local timeout_s="$2" local rc + local pid + local spin='|/-\' + local i=0 + local start_ts=0 + local elapsed=0 + local last_heartbeat=0 + local spinner_tty=0 + local timed_out=0 shift 2 log "RUN: $msg :: $*" - if command -v timeout >/dev/null 2>&1; then - ( timeout "$timeout_s" "$@" >>"$LOG" 2>&1 ) & - else - ( "$@" >>"$LOG" 2>&1 ) & - fi - local pid=$! + ( "$@" >>"$LOG" 2>&1 ) & + pid=$! + start_ts="$(date +%s)" - spinner "$pid" "$msg" + if [[ -w /dev/tty ]]; then + spinner_tty=1 + fi + + if command -v tput >/dev/null 2>&1 && [[ "$spinner_tty" -eq 1 ]]; then + tput civis >/dev/tty 2>/dev/null || true + fi + + while kill -0 "$pid" 2>/dev/null; do + i=$(((i + 1) % 4)) + elapsed=$(( $(date +%s) - start_ts )) + + if [[ "$spinner_tty" -eq 1 ]]; then + printf "\r[%c] %s... %ss" "${spin:$i:1}" "$msg" "$elapsed" >/dev/tty + fi + + if (( elapsed >= last_heartbeat + 15 )); then + log "HEARTBEAT: ${msg} still running (${elapsed}s)" + last_heartbeat="$elapsed" + fi + + if (( timeout_s > 0 && elapsed >= timeout_s )); then + timed_out=1 + log "TIMEOUT(${timeout_s}s): ${msg}; terminating pid=${pid}" + kill "$pid" >/dev/null 2>&1 || true + sleep 2 + kill -9 "$pid" >/dev/null 2>&1 || true + break + fi + + sleep 0.2 + done + + if [[ "$spinner_tty" -eq 1 ]]; then + printf "\r%-80s\r" "" >/dev/tty + fi + if command -v tput >/dev/null 2>&1 && [[ "$spinner_tty" -eq 1 ]]; then + tput cnorm >/dev/tty 2>/dev/null || true + fi if wait "$pid"; then rc=0 @@ -460,6 +562,10 @@ run_long() { rc=$? fi + if [ "$timed_out" -eq 1 ]; then + rc=124 + fi + if [ "$rc" -eq 0 ]; then log "OK: $msg" echo "[OK] $msg" diff --git a/stage_itscreen/stage_itscreen_install.sh b/stage_itscreen/stage_itscreen_install.sh index 4ca3483..d465a8b 100755 --- a/stage_itscreen/stage_itscreen_install.sh +++ b/stage_itscreen/stage_itscreen_install.sh @@ -226,22 +226,77 @@ run_long() { local msg="$1" local timeout_s="$2" local rc + local pid + local spin='|/-\\' + local i=0 + local start_ts=0 + local elapsed=0 + local last_heartbeat=0 + local spinner_tty=0 + local timed_out=0 shift 2 + log "RUN: $msg :: $*" - ( timeout "$timeout_s" "$@" >>"$LOG" 2>&1 ) & - local pid=$! - spinner "$pid" "$msg" + + ( "$@" >>"$LOG" 2>&1 ) & + pid=$! + start_ts="$(date +%s)" + + if [[ -w /dev/tty ]]; then + spinner_tty=1 + fi + + if command -v tput >/dev/null 2>&1 && [[ "$spinner_tty" -eq 1 ]]; then + tput civis >/dev/tty 2>/dev/null || true + fi + + while kill -0 "$pid" 2>/dev/null; do + i=$(((i + 1) % 4)) + elapsed=$(( $(date +%s) - start_ts )) + + if [[ "$spinner_tty" -eq 1 ]]; then + printf "\r[%c] %s... %ss" "${spin:$i:1}" "$msg" "$elapsed" >/dev/tty + fi + + if (( elapsed >= last_heartbeat + 15 )); then + log "HEARTBEAT: ${msg} still running (${elapsed}s)" + last_heartbeat="$elapsed" + fi + + if (( timeout_s > 0 && elapsed >= timeout_s )); then + timed_out=1 + log "TIMEOUT(${timeout_s}s): ${msg}; terminating pid=${pid}" + kill "$pid" >/dev/null 2>&1 || true + sleep 2 + kill -9 "$pid" >/dev/null 2>&1 || true + break + fi + + sleep 0.2 + done + + if [[ "$spinner_tty" -eq 1 ]]; then + printf "\r%-80s\r" "" >/dev/tty + fi + if command -v tput >/dev/null 2>&1 && [[ "$spinner_tty" -eq 1 ]]; then + tput cnorm >/dev/tty 2>/dev/null || true + fi + wait "$pid" rc=$? + if [[ "$timed_out" -eq 1 ]]; then + rc=124 + fi + if [[ "$rc" -eq 0 ]]; then - if [[ -t 1 ]]; then - printf "\r[OK] %s. \n" "$msg" + if [[ "$spinner_tty" -eq 1 ]]; then + printf "\r[OK] %s. \n" "$msg" >/dev/tty else echo "[OK] $msg" fi else - if [[ -t 1 ]]; then - printf "\r[FAIL:%s] %s. \n" "$rc" "$msg" + if [[ "$spinner_tty" -eq 1 ]]; then + printf "\r[FAIL:%s] %s. \n" "$rc" "$msg" >/dev/tty else echo "[FAIL:$rc] $msg" fi @@ -317,7 +372,6 @@ install_base_packages() { require_cmd apt-get require_cmd install - require_cmd timeout require_cmd flock require_cmd systemctl require_cmd visudo @@ -456,6 +510,7 @@ install_qt_packages() { install_packages_best_effort "Install Qt extras" 1800 \ gedit lxterminal clang qtcreator openbox wmctrl xdotool \ libqt5serialbus5-bin \ + qml-module-qtmultimedia \ qml-module-qtpositioning \ qml-module-qtquick-virtualkeyboard qtvirtualkeyboard-plugin \ qml-module-qtwebview \ @@ -1406,7 +1461,7 @@ post_install_self_test() { log "Self-test: uname -m=${arch_machine:-unknown}" log "Self-test: binary architecture check=${arch_status:-unknown} detail=${arch_detail:-unknown}" - for qt_pkg in qt-video-oes-plugins libqt5gui5-gles libqt5quick5-gles; do + for qt_pkg in qt-video-oes-plugins libqt5gui5-gles libqt5quick5-gles qml-module-qtmultimedia; do if dpkg-query -W -f='${Status}\n' "$qt_pkg" 2>/dev/null | grep -qx 'install ok installed'; then log "Self-test: package installed: ${qt_pkg}" else