diff --git a/readme.md b/readme.md index 3326ac5..a5e8a81 100644 --- a/readme.md +++ b/readme.md @@ -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: diff --git a/scripts/uninstall-linux-x11.sh b/scripts/uninstall-linux-x11.sh new file mode 100755 index 0000000..4901f25 --- /dev/null +++ b/scripts/uninstall-linux-x11.sh @@ -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}" diff --git a/scripts/uninstall-macos.sh b/scripts/uninstall-macos.sh new file mode 100755 index 0000000..5315f84 --- /dev/null +++ b/scripts/uninstall-macos.sh @@ -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}"