Install Volumio integration during updates

This commit is contained in:
Mikei386
2026-08-11 09:06:50 +02:00
parent 07563c3b11
commit 684c5fe3d3
2 changed files with 64 additions and 7 deletions
+6
View File
@@ -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 Xorg beim Booten um dasselbe virtuelle Terminal konkurrieren und eine
Kiosk-Neustartschleife auslösen. 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 Um den lokalen Login-Prompt auf `tty1` wiederherzustellen, zuerst den Kiosk
stoppen und Getty anschließend wieder freigeben: stoppen und Getty anschließend wieder freigeben:
+58 -7
View File
@@ -209,6 +209,46 @@ build_volumio_candidate() {
echo "staged Volumio build completed" 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() { start_all_services() {
if is_volumio_install; then if is_volumio_install; then
restart_if_present analyzer-web-volumio.service restart_if_present analyzer-web-volumio.service
@@ -248,6 +288,12 @@ rollback_to_backup() {
return 1 return 1
fi fi
mv "$BACKUP_DIR" "$PHOENIX_ROOT" 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 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 echo "backup rollback restored files but Phoenix health did not recover" >&2
return 1 return 1
@@ -289,6 +335,7 @@ if [ ! -f "$STAGE_DIR/Cargo.toml" ] || [ ! -d "$STAGE_DIR/src" ] || [ ! -d "$STA
fi fi
if is_volumio_install; then if is_volumio_install; then
validate_volumio_integration_candidate "$STAGE_DIR"
build_volumio_candidate "$STAGE_DIR" build_volumio_candidate "$STAGE_DIR"
fi fi
@@ -303,6 +350,17 @@ mv "$STAGE_DIR" "$PHOENIX_ROOT"
health_attempts=45 health_attempts=45
health_delay=1 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 ! wait_for_candidate_health "$PHOENIX_ROOT" "$health_attempts" "$health_delay"; then
if ! rollback_to_backup; then if ! rollback_to_backup; then
echo "new Phoenix version failed health check and rollback failed" >&2 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 exit 1
fi 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 ===" echo "=== $(date): restart_phoenix_services.sh OK ==="