diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 3a1d361..f96b0d3 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -51,7 +51,7 @@ jobs: xorriso -indev "$iso" -report_el_torito plain 2>/dev/null | tee /dev/stderr | grep -q "UEFI" xorriso -osirrox on -indev "$iso" -extract /autoinstall.yaml autoinstall.yaml -extract /boot/grub/grub.cfg grub.cfg python3 -c "import yaml; d = yaml.safe_load(open('autoinstall.yaml')); assert d['autoinstall']['version'] == 1" - grep -q "Install Virtuality" grub.cfg + grep -q "Установить Virtuality" grub.cfg # Ubuntu server ISOs are larger than the 2 GB GitHub release asset limit, # so images are published as workflow artifacts. - uses: actions/upload-artifact@v4 diff --git a/install_virtuality_node.sh b/install_virtuality_node.sh index 6eb7057..fb93c54 100644 --- a/install_virtuality_node.sh +++ b/install_virtuality_node.sh @@ -22,6 +22,8 @@ MIN_RAM_MB="${VIRTUALITY_MIN_RAM_MB:-4096}" MIN_CPU_CORES="${VIRTUALITY_MIN_CPU_CORES:-2}" SKIP_REQUIREMENTS="${VIRTUALITY_SKIP_REQUIREMENTS:-0}" export DEBIAN_FRONTEND=noninteractive +# Keep existing configuration files without asking: there is nobody to answer on first boot. +APT_OPTS=(-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold) ESC="\033" RESET="${ESC}[0m" @@ -74,15 +76,18 @@ run_logged() { 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" + # The spinner only makes sense on a terminal; first boot writes this output to a log. + if [[ -t 1 ]]; then + 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" + fi sleep 1 i=$((i + 1)) done - wait "$pid" - code=$? - printf "\r%*s\r" 120 "" + code=0 + wait "$pid" || code=$? + [[ -t 1 ]] && printf "\r%*s\r" 120 "" if [[ "$code" -eq 0 ]]; then ok "$description" else @@ -103,7 +108,7 @@ install_available() { warn "Пакет ${pkg} недоступен в этом дистрибутиве, пропускаю" fi done - run_logged "$description" apt install -y "${available[@]}" + run_logged "$description" apt-get install -y "${APT_OPTS[@]}" "${available[@]}" } service_state() { systemctl is-active "$1" 2>/dev/null || echo "inactive"; } @@ -164,7 +169,9 @@ else fi step "Обновляем apt cache" -run_logged "apt update выполнен" apt update +run_logged "apt update выполнен" apt-get update +# A previous attempt may have stopped half way (power loss, a question from dpkg): finish it first. +run_logged "Незавершённые установки пакетов доделаны" dpkg --configure -a --force-confdef --force-confold step "Устанавливаем базовые утилиты и зависимости диагностики" install_available "Базовые пакеты и диагностические утилиты установлены" \ diff --git a/scripts/install_web_panel.sh b/scripts/install_web_panel.sh index 1d8546e..45c14ed 100644 --- a/scripts/install_web_panel.sh +++ b/scripts/install_web_panel.sh @@ -136,7 +136,7 @@ if [[ "$PANEL_ONLY" == "1" ]]; then ok "Пропущено (VIRTUALITY_PANEL_ONLY=1): пакеты поставит установщик ноды" elif command -v apt-get >/dev/null 2>&1; then run_logged "apt update выполнен" apt-get update - run_logged "Пакеты панели установлены" apt-get install -y python3 python3-venv rsync openssl curl nftables novnc python3-websockify qemu-utils virtinst libvirt-clients cloud-image-utils + run_logged "Пакеты панели установлены" apt-get install -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold python3 python3-venv rsync openssl curl nftables novnc python3-websockify qemu-utils virtinst libvirt-clients cloud-image-utils else warn "apt не найден — пакеты не устанавливались" fi diff --git a/scripts/virtuality-ctl b/scripts/virtuality-ctl index 404e3d7..62d01ec 100755 --- a/scripts/virtuality-ctl +++ b/scripts/virtuality-ctl @@ -253,12 +253,16 @@ ${LOG_DIR}/*.log { EOF # Guests shut down gracefully with the host instead of being killed (Proxmox behaviour). - cat > /etc/default/libvirt-guests < /etc/default/libvirt-guests </dev/null 2>&1 || true diff --git a/scripts/virtuality_firstboot.sh b/scripts/virtuality_firstboot.sh index 47988ae..9f9c599 100755 --- a/scripts/virtuality_firstboot.sh +++ b/scripts/virtuality_firstboot.sh @@ -156,7 +156,7 @@ say "source: ${SOURCE_DIR}, panel user: ${AUTH_USER}, port: ${VIRTUALITY_WEB_POR cd "$SOURCE_DIR" # unattended-upgrades often holds the dpkg lock right after the first boot. -printf 'DPkg::Lock::Timeout "900";\n' > "$APT_LOCK_CONF" +printf 'DPkg::Lock::Timeout "900";\nDPkg::Options { "--force-confdef"; "--force-confold"; };\n' > "$APT_LOCK_CONF" cat > "$ISSUE_FILE" <<'EOF' Virtuality настраивается. Ход установки: sudo journalctl -fu virtuality-firstboot