From 38e42a9d39fd2590024b67d366a78b82e6efc5f3 Mon Sep 17 00:00:00 2001 From: Krystie Date: Sat, 28 Mar 2026 16:49:45 -0700 Subject: [PATCH] Fix: Skip systemctl enable/start commands in non-systemd environments The installer was failing when systemctl enable/start commands ran in test containers where systemd isn't running as PID 1. Wrap all service management commands in a check for systemd availability. --- setup/install.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/setup/install.sh b/setup/install.sh index 85fd5c1..e72e8ed 100644 --- a/setup/install.sh +++ b/setup/install.sh @@ -120,18 +120,22 @@ systemctl daemon-reload || log "Warning: systemctl daemon-reload failed (non-sys # ── enable & start ─────────────────────────────────────────────────────────── -log "Enabling services..." -systemctl enable tor.service -systemctl enable tripi-backend.service -[[ -f /usr/local/bin/trianglesd ]] && systemctl enable trianglesd.service +if command -v systemctl >/dev/null 2>&1 && systemctl is-system-running >/dev/null 2>&1; then + log "Enabling services..." + systemctl enable tor.service + systemctl enable tripi-backend.service + [[ -f /usr/local/bin/trianglesd ]] && systemctl enable trianglesd.service -log "Starting services..." -systemctl restart tor.service -systemctl start tripi-backend.service -if [[ -f /usr/local/bin/trianglesd ]]; then - systemctl start trianglesd.service + log "Starting services..." + systemctl restart tor.service + systemctl start tripi-backend.service + if [[ -f /usr/local/bin/trianglesd ]]; then + systemctl start trianglesd.service + else + log "Skipping trianglesd start (binary not installed)." + fi else - log "Skipping trianglesd start (binary not installed)." + log "Skipping service enable/start (systemd not available or not running as init)." fi # ── summary ──────────────────────────────────────────────────────────────────