Files
Omarchy-Stream/uninstall.sh
Levi Woodard e18187362c Clean up sunshine-bin-debug too when falling back to source build
When sunshine-bin trips the ldd check and we switch to the source build,
the prior install left sunshine-bin-debug behind. The source package
includes its own sunshine-debug which collides on
/usr/lib/debug/usr/bin/sunshine.debug, so pacman refuses the install.

Remove both sunshine-bin and sunshine-bin-debug before yay -S sunshine.
uninstall.sh similarly drops all four variants.
2026-05-18 11:07:59 -06:00

86 lines
2.7 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
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 <<EOF
Usage: $(basename "$0") [--purge] [--keep-moonlight] [--remove-ca-trust]
--purge Also delete ~/.config/sunshine and ~/.local/share/sunshine
--keep-moonlight Do not uninstall moonlight-qt
--remove-ca-trust Remove the omarchy-stream CA from /etc/ca-certificates
(default: leave it — other hosts/services may rely on it)
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"
# Remove -debug siblings first so they don't collide with re-installation later.
for pkg in sunshine-debug sunshine-bin-debug 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