diff --git a/lib/packages.sh b/lib/packages.sh index 2120536..820a15e 100644 --- a/lib/packages.sh +++ b/lib/packages.sh @@ -11,6 +11,38 @@ install_sunshine() { # Ensure runtime deps useful for capture/diagnostics across vendors. yay_install pipewire-pulse vulkan-tools libva-utils jq yay_install "$SUNSHINE_PKG" + + # sunshine-bin is a precompiled AUR package; it breaks whenever Arch bumps a + # major shared library (most commonly ICU). Detect that and fall back to the + # source build, which links against whatever's currently installed. + if ! sunshine_runtime_deps_ok; then + if [[ "$SUNSHINE_PKG" == "sunshine-bin" ]]; then + warn "sunshine-bin has unresolved shared library deps (rolling-Arch library drift)." + warn "Falling back to the source build (AUR 'sunshine'). This takes ~5-10 minutes." + ldd "$(command -v sunshine)" 2>/dev/null | grep 'not found' | sed 's/^/ /' >&2 || true + as_root pacman -Rns --noconfirm sunshine-bin + SUNSHINE_PKG="sunshine" + yay_install sunshine + if ! sunshine_runtime_deps_ok; then + err "Source build also reports unresolved deps. Inspect: ldd \$(command -v sunshine)" + return 1 + fi + ok "Recovered with source build" + else + err "sunshine binary has unresolved shared library deps:" + ldd "$(command -v sunshine)" 2>/dev/null | grep 'not found' | sed 's/^/ /' >&2 || true + err "Try: SUNSHINE_PKG=sunshine ./install.sh" + return 1 + fi + fi +} + +# True if every shared library sunshine links against resolves on this system. +sunshine_runtime_deps_ok() { + local bin + bin="$(command -v sunshine 2>/dev/null || true)" + [[ -n "$bin" ]] || return 1 + ! ldd "$bin" 2>/dev/null | grep -q 'not found' } install_moonlight() { diff --git a/lib/service.sh b/lib/service.sh index a9281f2..fda6175 100644 --- a/lib/service.sh +++ b/lib/service.sh @@ -18,6 +18,10 @@ enable_sunshine_service() { 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 || {