feat: add uninstall scripts for X11 and macOS
All checks were successful
Test / test (push) Successful in 6m3s

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:
Asger Geel Weirsøe
2026-05-06 16:08:59 +02:00
parent a6de85650d
commit 8ecc1501a1
3 changed files with 127 additions and 0 deletions

View File

@@ -151,6 +151,43 @@ auth optional /usr/local/lib/ahfail/libahfail_pam.so
---
## Uninstall
### Linux — X11
```bash
bash scripts/uninstall-linux-x11.sh
```
Removes the `ahfail` line from common PAM service files (`/etc/pam.d/i3lock`, `xscreensaver`, `lightdm`, etc.) and removes the installed binaries. If `builddir` is present it uses `ninja uninstall`; otherwise it removes the known paths manually.
### Linux — Wayland
No PAM config was modified. Just stop passing the module to gtklock and optionally remove the file:
```bash
sudo rm -f /usr/lib/gtklock/ahfail-module.so # --prefix=/usr install
# or
sudo rm -f /usr/local/lib/gtklock/ahfail-module.so
```
### macOS — Homebrew
```bash
sudo sed -i '' '/ahfail/d' /etc/pam.d/screensaverui # or screensaver on macOS 12
brew uninstall ahfail
```
### macOS — manual / script install
```bash
bash scripts/uninstall-macos.sh
```
Removes the `ahfail` line from the screensaver PAM file and deletes `/usr/local/lib/ahfail/`.
---
## Customization
The sprite is the author's face on Nedry's body. To use your own:

54
scripts/uninstall-linux-x11.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# uninstall-linux-x11.sh — remove ahfail PAM module from X11 screen lockers
# Run from the repository root (uses ninja uninstall if builddir is present).
set -euo pipefail
BOLD=$(tput bold 2>/dev/null || true)
RESET=$(tput sgr0 2>/dev/null || true)
step() { echo "${BOLD}==> $*${RESET}"; }
[[ "$(uname)" == "Linux" ]] || { echo "This script is for Linux only." >&2; exit 1; }
# ── 1. Remove PAM config lines ────────────────────────────────────────────────
step "Removing ahfail from PAM service files..."
removed_pam=0
for pam_file in /etc/pam.d/i3lock /etc/pam.d/xscreensaver /etc/pam.d/lightdm \
/etc/pam.d/gdm /etc/pam.d/sddm /etc/pam.d/gtklock; 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 in common service files."
# ── 2. Remove installed files ─────────────────────────────────────────────────
step "Removing installed files..."
# Prefer meson's own uninstall if the builddir is still present
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILDDIR="${SCRIPT_DIR}/../builddir"
if [[ -f "${BUILDDIR}/build.ninja" ]]; then
echo " Running meson uninstall..."
sudo ninja -C "$BUILDDIR" uninstall
else
echo " builddir not found — removing known paths manually..."
for dir in /usr/lib/ahfail /usr/local/lib/ahfail \
/usr/lib64/ahfail /usr/lib/x86_64-linux-gnu/ahfail; do
if [[ -d "$dir" ]]; then
sudo rm -rf "$dir"
echo " Removed ${dir}."
fi
done
for f in /usr/lib/gtklock/ahfail-module.so \
/usr/local/lib/gtklock/ahfail-module.so; do
if [[ -f "$f" ]]; then
sudo rm -f "$f"
echo " Removed ${f}."
fi
done
fi
echo ""
echo "${BOLD}Done.${RESET}"

36
scripts/uninstall-macos.sh Executable file
View File

@@ -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}"