Files
Omarchy-Stream/lib/packages.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

71 lines
2.5 KiB
Bash

#!/usr/bin/env bash
# Install Sunshine, Moonlight, and GPU-specific hardware-encode dependencies.
# Default to the precompiled AUR build for a fast install (~seconds instead of
# the ~10 minute source compile). Override with SUNSHINE_PKG=sunshine to build
# from source.
: "${SUNSHINE_PKG:=sunshine-bin}"
: "${MOONLIGHT_PKG:=moonlight-qt}"
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() {
yay_install "$MOONLIGHT_PKG"
}
install_gpu_encoder_packages() {
case "$GPU_VENDOR" in
nvidia)
# NVENC works through the proprietary driver. libva-nvidia-driver lets some
# apps use VAAPI on NVIDIA; not strictly required for Sunshine NVENC but useful.
yay_install nvidia-utils libva-nvidia-driver
;;
amd)
# VAAPI (mesa) + Vulkan for AMD hardware encode paths.
yay_install libva-mesa-driver mesa-vdpau vulkan-radeon
;;
intel)
yay_install intel-media-driver vulkan-intel
;;
*)
info "Unknown GPU vendor; skipping vendor-specific encoder packages."
;;
esac
}