Added qt libs missed

This commit is contained in:
Andrei Smaliak 2026-06-06 07:46:48 +04:00
parent 2005272a23
commit d25c213346
3 changed files with 220 additions and 31 deletions

View File

@ -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"
}

View File

@ -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"

View File

@ -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