Sets up bidirectional game streaming across Omarchy/Hyprland/Wayland machines (NVIDIA desktop and AMD Framework laptop), with the Macbook as an additional Moonlight client. The same install.sh runs on either machine; GPU vendor is detected at runtime and the appropriate hardware-encode packages are installed. Includes: - KMS capture setup (cap_sys_admin on sunshine, input group, uinput udev rule) - ufw / firewalld port opening when a firewall is active - systemd --user service + loginctl enable-linger for always-on hosting - uninstall.sh with --purge for user data removal - Flags to install host-only or client-only
62 lines
1.8 KiB
Bash
Executable File
62 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"
|
|
if pacman -Qi sunshine >/dev/null 2>&1; then
|
|
as_root pacman -Rns --noconfirm sunshine
|
|
elif pacman -Qi sunshine-bin >/dev/null 2>&1; then
|
|
as_root pacman -Rns --noconfirm sunshine-bin
|
|
fi
|
|
if [[ $KEEP_MOONLIGHT -eq 0 ]] && pacman -Qi moonlight-qt >/dev/null 2>&1; then
|
|
as_root pacman -Rns --noconfirm moonlight-qt
|
|
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."
|