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>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
1f0d42b24d
commit
f2e32fd057
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/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}"
|
||||
Reference in New Issue
Block a user