#!/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 REMOVE_CA_TRUST=0 while [[ $# -gt 0 ]]; do case "$1" in --purge) PURGE=1 ;; --keep-moonlight) KEEP_MOONLIGHT=1 ;; --remove-ca-trust) REMOVE_CA_TRUST=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" 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 [[ $REMOVE_CA_TRUST -eq 1 ]]; then step "Removing omarchy-stream CA from system trust store" anchor="/etc/ca-certificates/trust-source/anchors/omarchy-stream-ca.pem" if [[ -f "$anchor" ]]; then as_root rm -f "$anchor" as_root update-ca-trust extract >/dev/null ok "Removed $anchor and refreshed trust store" else info "CA anchor not present; nothing to remove" fi 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." if [[ $REMOVE_CA_TRUST -eq 0 ]]; then info "The omarchy-stream CA was left in /etc/ca-certificates (--remove-ca-trust to drop it)." fi