Files
Omarchy-Stream/lib/service.sh
Levi Woodard 7bfaa3a498 Auto-recover from sunshine-bin library drift; reset-failed before service start
Two robustness fixes for failures hit on a real install.

lib/packages.sh
- After installing $SUNSHINE_PKG, run ldd against the binary and check for
  "not found" entries. sunshine-bin ships against whichever ICU was current
  at AUR-build time; on rolling Arch (jarvis is on ICU 78, package built
  against ICU 76) this leaves libicuuc.so.76 unresolved and sunshine exits
  127 on every start, eventually tripping the systemd start-limit.
- If sunshine-bin has unresolved deps, remove it and fall back to the
  source build (AUR 'sunshine'), then re-verify. If the user explicitly
  chose --from-source and it still fails, bail with the ldd diagnostic.

lib/service.sh
- systemctl --user reset-failed before restart, so a previous attempt that
  hit start-limit-hit doesn't immediately reject the new start request.
  (Re-running install.sh after a broken first attempt was failing because
  systemd remembered the prior rate-limit trip.)
2026-05-18 10:47:50 -06:00

39 lines
1.4 KiB
Bash

#!/usr/bin/env bash
# Enable Sunshine as a systemd --user service and turn on lingering so it
# runs at boot without a graphical login.
enable_sunshine_service() {
if ! systemctl --user list-unit-files sunshine.service >/dev/null 2>&1; then
err "sunshine.service not found in user systemd units. Did the package install correctly?"
return 1
fi
if ! loginctl show-user "$USER" -p Linger --value 2>/dev/null | grep -qx yes; then
info "Enabling user lingering (loginctl enable-linger $USER)"
as_root loginctl enable-linger "$USER"
else
ok "User lingering already enabled"
fi
info "Enabling sunshine.service (user)"
systemctl --user enable sunshine.service >/dev/null
# Clear any prior start-limit state from a failed run so this attempt isn't
# immediately rejected with "Start request repeated too quickly."
systemctl --user reset-failed sunshine.service 2>/dev/null || true
info "Starting sunshine.service (user)"
# Restart so a re-run picks up new config / new caps. Tolerate first-launch races.
systemctl --user restart sunshine.service || systemctl --user start sunshine.service || {
err "Failed to start sunshine.service. Check: journalctl --user -u sunshine"
return 1
}
sleep 1
if systemctl --user is-active --quiet sunshine.service; then
ok "sunshine.service is active"
else
warn "sunshine.service did not stay active. Inspect: journalctl --user -u sunshine -n 50"
fi
}