#!/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 </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."