Files
gtk-ahfail/scripts/uninstall-linux-x11.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

55 lines
2.1 KiB
Bash
Executable File

#!/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}"