From 684c5fe3d3ae68f4d8e1197a7f87da91c34fb642 Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Tue, 11 Aug 2026 09:06:50 +0200 Subject: [PATCH] Install Volumio integration during updates --- README.md | 6 +++ scripts/restart_phoenix_services.sh | 65 +++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 28274e7..637f50e 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,12 @@ Kiosk-X-Server `tty1` exklusiv verwendet. Ohne die Maskierung können Getty und Xorg beim Booten um dasselbe virtuelle Terminal konkurrieren und eine Kiosk-Neustartschleife auslösen. +Nach dieser einmaligen Grundinstallation bringt der privilegierte +Volumio-Online-Updater bei jedem erfolgreichen Phoenix-Update auch die +mitgelieferten systemd-Units, den Update-Helfer und die sudo-Regel aus. Fehlen +diese Integrationsdateien in einem Update, wird es vor dem Austausch des +laufenden Projektbaums abgelehnt. + Um den lokalen Login-Prompt auf `tty1` wiederherzustellen, zuerst den Kiosk stoppen und Getty anschließend wieder freigeben: diff --git a/scripts/restart_phoenix_services.sh b/scripts/restart_phoenix_services.sh index 9c4422f..33ab5d7 100644 --- a/scripts/restart_phoenix_services.sh +++ b/scripts/restart_phoenix_services.sh @@ -209,6 +209,46 @@ build_volumio_candidate() { echo "staged Volumio build completed" } +validate_volumio_integration_candidate() { + local phoenix_dir="${1:-$STAGE_DIR}" + local required_path + local required_paths=( + "scripts/install_volumio_services.sh" + "scripts/restart_phoenix_services.sh" + "etc/systemd/system/analyzer-kiosk-volumio.service" + "etc/systemd/system/analyzer-web-volumio.service" + "etc/systemd/system/phoenix-update-volumio.service" + "etc/sudoers.d/phoenix-update-volumio" + ) + + for required_path in "${required_paths[@]}"; do + if [ ! -f "$phoenix_dir/$required_path" ]; then + echo "staged Volumio integration file missing: $phoenix_dir/$required_path" >&2 + return 1 + fi + done + bash -n \ + "$phoenix_dir/scripts/install_volumio_services.sh" \ + "$phoenix_dir/scripts/restart_phoenix_services.sh" +} + +install_volumio_integration() { + local phoenix_dir="${1:-$PHOENIX_ROOT}" + local installer="$phoenix_dir/scripts/install_volumio_services.sh" + + if [ "$(id -u)" -ne 0 ]; then + echo "Volumio integration update requires root" >&2 + return 1 + fi + if [ ! -f "$installer" ]; then + echo "Volumio integration installer missing: $installer" >&2 + return 1 + fi + + echo "installing Volumio system integration from $phoenix_dir" + /bin/bash "$installer" +} + start_all_services() { if is_volumio_install; then restart_if_present analyzer-web-volumio.service @@ -248,6 +288,12 @@ rollback_to_backup() { return 1 fi mv "$BACKUP_DIR" "$PHOENIX_ROOT" + if is_volumio_install && [ -f "$PHOENIX_ROOT/scripts/install_volumio_services.sh" ]; then + if ! install_volumio_integration "$PHOENIX_ROOT"; then + echo "backup files were restored but their Volumio integration could not be installed" >&2 + return 1 + fi + fi if ! wait_for_candidate_health "$PHOENIX_ROOT" "${PHOENIX_ROLLBACK_HEALTH_ATTEMPTS:-120}" 1; then echo "backup rollback restored files but Phoenix health did not recover" >&2 return 1 @@ -289,6 +335,7 @@ if [ ! -f "$STAGE_DIR/Cargo.toml" ] || [ ! -d "$STAGE_DIR/src" ] || [ ! -d "$STA fi if is_volumio_install; then + validate_volumio_integration_candidate "$STAGE_DIR" build_volumio_candidate "$STAGE_DIR" fi @@ -303,6 +350,17 @@ mv "$STAGE_DIR" "$PHOENIX_ROOT" health_attempts=45 health_delay=1 +if is_volumio_install; then + if ! install_volumio_integration "$PHOENIX_ROOT"; then + if ! rollback_to_backup; then + echo "new Volumio integration failed and rollback failed" >&2 + exit 1 + fi + echo "new Volumio integration failed; rolled back to backup" >&2 + exit 1 + fi +fi + if ! wait_for_candidate_health "$PHOENIX_ROOT" "$health_attempts" "$health_delay"; then if ! rollback_to_backup; then echo "new Phoenix version failed health check and rollback failed" >&2 @@ -312,11 +370,4 @@ if ! wait_for_candidate_health "$PHOENIX_ROOT" "$health_attempts" "$health_delay exit 1 fi -if is_volumio_install && [ "$(id -u)" -eq 0 ] && [ -f "$PHOENIX_ROOT/scripts/restart_phoenix_services.sh" ]; then - install -o root -g root -m 0755 \ - "$PHOENIX_ROOT/scripts/restart_phoenix_services.sh" \ - /usr/local/libexec/phoenix/restart_phoenix_services.sh - echo "Volumio privileged update helper refreshed" -fi - echo "=== $(date): restart_phoenix_services.sh OK ==="