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.
This commit is contained in:
Krystie
2026-03-28 16:49:45 -07:00
parent b21b0bea5a
commit 38e42a9d39
+14 -10
View File
@@ -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 ──────────────────────────────────────────────────────────────────