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.
66 lines
1.8 KiB
Bash
Executable File
66 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Reverse of install.sh. Leaves user data in ~/.config/sunshine/ alone unless --purge.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=lib/common.sh
|
|
source "$SCRIPT_DIR/lib/common.sh"
|
|
|
|
PURGE=0
|
|
KEEP_MOONLIGHT=0
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--purge) PURGE=1 ;;
|
|
--keep-moonlight) KEEP_MOONLIGHT=1 ;;
|
|
-h|--help)
|
|
cat <<EOF
|
|
Usage: $(basename "$0") [--purge] [--keep-moonlight]
|
|
|
|
--purge Also delete ~/.config/sunshine and ~/.local/share/sunshine
|
|
--keep-moonlight Do not uninstall moonlight-qt
|
|
EOF
|
|
exit 0 ;;
|
|
*) err "Unknown option: $1"; exit 2 ;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
require_not_root
|
|
|
|
step "Stopping Sunshine service"
|
|
systemctl --user disable --now sunshine.service 2>/dev/null || true
|
|
|
|
step "Removing user lingering (if enabled by us)"
|
|
if loginctl show-user "$USER" -p Linger --value 2>/dev/null | grep -qx yes; then
|
|
warn "Lingering is enabled. Leaving it on — other user services may rely on it."
|
|
warn "Disable manually with: sudo loginctl disable-linger $USER"
|
|
fi
|
|
|
|
step "Removing packages"
|
|
for pkg in sunshine sunshine-bin; do
|
|
if pacman -Qi "$pkg" >/dev/null 2>&1; then
|
|
as_root pacman -Rns --noconfirm "$pkg"
|
|
fi
|
|
done
|
|
if [[ $KEEP_MOONLIGHT -eq 0 ]]; then
|
|
for pkg in moonlight-qt moonlight-qt-bin; do
|
|
if pacman -Qi "$pkg" >/dev/null 2>&1; then
|
|
as_root pacman -Rns --noconfirm "$pkg"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
step "Removing udev rule (if we wrote one)"
|
|
if [[ -f /etc/udev/rules.d/60-uinput.rules ]]; then
|
|
as_root rm -f /etc/udev/rules.d/60-uinput.rules
|
|
as_root udevadm control --reload-rules
|
|
fi
|
|
|
|
if [[ $PURGE -eq 1 ]]; then
|
|
step "Purging Sunshine user data"
|
|
rm -rf "$HOME/.config/sunshine" "$HOME/.local/share/sunshine"
|
|
fi
|
|
|
|
ok "Uninstall complete. Firewall rules and 'input' group membership were left in place."
|