Files
Omarchy-Stream/lib/verify.sh
Levi Woodard d6b0919149 Optimize installer: preflight checks, tuned conf, doctor, faster default
Layers a few things on top of the initial scaffold:

- Default to sunshine-bin (precompiled, ~seconds) instead of building from
  source. --from-source restores the old behavior.
- Add lib/preflight.sh: catches the gotchas before any work is done —
  Wayland session, NVIDIA driver responsive, nvidia-drm.modeset, amdgpu
  loaded, pipewire-pulse present, SSH-without-session warning.
- Add lib/config.sh: writes a tuned ~/.config/sunshine/sunshine.conf with
  per-vendor encoder settings (NVENC P1+ll+cbr, VAAPI ultralowlatency,
  QuickSync veryfast), KMS capture, pulse audio sink. Uses a
  "# managed-by: omarchy-moonlight" marker; removing it hands ownership
  back to the user and the installer won't touch the file again.
- Add lib/verify.sh: post-install verification of every step
  (cap_sys_admin set, group resolves, udev rule present, /dev/uinput
  exists, encoder reachable, service active, :47990 listening). Same
  checks are reachable standalone via --doctor.
- Install runtime helpers (pipewire-pulse, vulkan-tools, libva-utils)
  alongside Sunshine for diagnostics + audio.
- Uninstall handles both sunshine + sunshine-bin and the -bin moonlight
  variant.
- README documents the tuning table, the new flags, and the modeset
  troubleshooting path.
2026-05-18 10:17:11 -06:00

88 lines
2.7 KiB
Bash

#!/usr/bin/env bash
# Post-install verification — confirm each piece is actually wired up.
# Prints a checklist; non-fatal so the user sees the whole picture.
VERIFY_FAILURES=0
_check() {
local name="$1"; shift
if "$@" >/dev/null 2>&1; then
ok "$name"
else
err "$name"
VERIFY_FAILURES=$((VERIFY_FAILURES + 1))
fi
}
verify_install() {
step "Verifying install"
_check "sunshine binary on PATH" command -v sunshine
local bin
bin="$(command -v sunshine 2>/dev/null || true)"
if [[ -n "$bin" ]]; then
bin="$(readlink -f "$bin")"
if getcap "$bin" 2>/dev/null | grep -q cap_sys_admin; then
ok "sunshine has cap_sys_admin (KMS capture ready)"
else
err "sunshine missing cap_sys_admin — KMS capture will fail"
VERIFY_FAILURES=$((VERIFY_FAILURES + 1))
fi
fi
if id -nG "$USER" | tr ' ' '\n' | grep -qx input; then
ok "user '$USER' resolves with 'input' group in current shell"
else
warn "user '$USER' is NOT in 'input' group in this shell session."
warn " /etc/group is correct; you need to log out + back in (or 'newgrp input')."
fi
if grep -rqs 'KERNEL=="uinput"' /etc/udev/rules.d /usr/lib/udev/rules.d /run/udev/rules.d 2>/dev/null; then
ok "uinput udev rule present"
else
err "uinput udev rule missing"
VERIFY_FAILURES=$((VERIFY_FAILURES + 1))
fi
if [[ -c /dev/uinput ]]; then
ok "/dev/uinput exists"
else
warn "/dev/uinput not present yet — may appear on next reboot or 'modprobe uinput'"
fi
case "$GPU_VENDOR" in
nvidia)
if nvidia-smi --query-gpu=encoder.stats.sessionCount --format=csv,noheader >/dev/null 2>&1; then
ok "NVENC interface reachable via nvidia-smi"
else
warn "Could not query NVENC via nvidia-smi (driver may need a reboot after install)"
fi
;;
amd)
if command -v vainfo >/dev/null 2>&1 && vainfo 2>/dev/null | grep -qi 'VAEntrypointEncSlice\|VAProfileH264'; then
ok "VAAPI encoder profiles available"
else
warn "VAAPI encoder profiles not confirmed (install libva-utils to verify with 'vainfo')"
fi
;;
esac
if systemctl --user is-active --quiet sunshine.service; then
ok "sunshine.service is active"
if ss -ltn 2>/dev/null | grep -q ':47990 '; then
ok "web UI listening on :47990"
else
warn "web UI port 47990 not yet listening (service may still be starting)"
fi
else
warn "sunshine.service is not active"
warn " Inspect: journalctl --user -u sunshine -n 50 --no-pager"
fi
if [[ $VERIFY_FAILURES -gt 0 ]]; then
warn "$VERIFY_FAILURES check(s) failed — see ${BOLD}README.md${RESET}${YELLOW} 'Diagnostics' for fixes."
else
ok "All checks passed."
fi
}