Files
gtk-ahfail/scripts/uninstall-macos.sh
Asger Geel Weirsøe 8ecc1501a1
All checks were successful
Test / test (push) Successful in 6m3s
feat: add uninstall scripts for X11 and macOS
scripts/uninstall-linux-x11.sh — strips ahfail from common PAM service
files and removes binaries (via ninja uninstall or known paths).

scripts/uninstall-macos.sh — strips ahfail from screensaverui/screensaver
and removes /usr/local/lib/ahfail/.

README: add Uninstall section covering all four cases (X11, Wayland,
Homebrew macOS, manual macOS).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 16:08:59 +02:00

37 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# uninstall-macos.sh — remove ahfail from macOS (manual/script install)
# For Homebrew installs: brew uninstall ahfail, then run this to clean up PAM.
set -euo pipefail
INSTALL_DIR="/usr/local/lib/ahfail"
BOLD=$(tput bold 2>/dev/null || true)
RESET=$(tput sgr0 2>/dev/null || true)
step() { echo "${BOLD}==> $*${RESET}"; }
[[ "$(uname)" == "Darwin" ]] || { echo "This script is for macOS only." >&2; exit 1; }
# ── 1. Remove PAM config line ─────────────────────────────────────────────────
step "Removing ahfail from PAM configuration..."
removed_pam=0
for pam_file in /etc/pam.d/screensaverui /etc/pam.d/screensaver; do
if [[ -f "$pam_file" ]] && grep -q "ahfail" "$pam_file"; then
echo " Patching ${pam_file}..."
sudo sed -i '' '/ahfail/d' "$pam_file"
removed_pam=1
fi
done
[[ $removed_pam -eq 0 ]] && echo " No ahfail PAM entries found."
# ── 2. Remove binaries ────────────────────────────────────────────────────────
step "Removing binaries..."
if [[ -d "$INSTALL_DIR" ]]; then
sudo rm -rf "$INSTALL_DIR"
echo " Removed ${INSTALL_DIR}."
else
echo " ${INSTALL_DIR} not found — skipping."
fi
echo ""
echo "${BOLD}Done.${RESET}"