From 2ad87524e4769a1df569bb3b969323e6d805f891 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Mon, 24 Aug 2026 13:04:00 +0200 Subject: [PATCH] Stop a non-interactive install aborting on the service prompt The systemd-service question was a bare `read -rp`. Under `set -euo pipefail` a read that hits EOF returns non-zero, so every caller without a TTY -- install_core_system.sh, CI, `vm run` -- aborted the installer with exit 1 at that line, after the Python deps were already in place. That made the module permanently un-installable from its documented install path. It now defaults to "n" when stdin is not a terminal and says how to add the service later; STEAM_ENFORCER_INSTALL_SERVICE=y opts in non-interactively. The interactive path is unchanged. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp --- install.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 8e624cb..98e921d 100755 --- a/install.sh +++ b/install.sh @@ -33,7 +33,22 @@ else fi # Install systemd service (system-level, runs as root). -read -rp "Install systemd enforce service? [y/N] " ans +# +# Non-interactive callers (install_core_system.sh, CI, `vm run`) have no stdin, +# where a bare `read` fails and -- under `set -e` -- aborts this whole installer +# with exit 1 after the Python deps are already in place. That made the module +# permanently un-installable from the documented install path. Default to "no" +# when there is no terminal, and let STEAM_ENFORCER_INSTALL_SERVICE=y opt in. +ans="${STEAM_ENFORCER_INSTALL_SERVICE:-}" +if [[ -z $ans ]]; then + if [[ -t 0 ]]; then + read -rp "Install systemd enforce service? [y/N] " ans + else + ans="n" + echo "No terminal: skipping the systemd enforce service." + echo "(Install it later with: sudo STEAM_ENFORCER_INSTALL_SERVICE=y bash install.sh)" + fi +fi if [[ "${ans,,}" == "y" ]]; then if [[ $EUID -ne 0 ]]; then echo "Error: systemd service install needs root. Re-run with sudo."