From e19834da2ed64bafdf21c2cd7f40b482bf237429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asger=20Geel=20Weirs=C3=B8e?= Date: Wed, 6 May 2026 15:24:17 +0200 Subject: [PATCH] feat: add ahfail formula v0.1.0 --- Formula/ahfail.rb | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Formula/ahfail.rb diff --git a/Formula/ahfail.rb b/Formula/ahfail.rb new file mode 100644 index 0000000..5c74455 --- /dev/null +++ b/Formula/ahfail.rb @@ -0,0 +1,48 @@ +class Ahfail < Formula + desc "Plays 'ah ah ah, you didn't say the magic word' on failed screen lock attempts" + homepage "https://gitea.weircon.dk/agw/gtk-ahfail" + url "https://gitea.weircon.dk/agw/gtk-ahfail/archive/v0.1.0.tar.gz" + sha256 "d693e27933007023cfcbc1882187084e186435261c78461353457d5e765a9045" + license "AGPL-3.0-only" + + depends_on "meson" => :build + depends_on "ninja" => :build + depends_on "rust" => :build + depends_on "gtk+3" + depends_on "gstreamer" + depends_on "gst-plugins-base" + depends_on "gst-plugins-good" + depends_on :macos + + def install + # Pass libdir so the PAM module has DEFAULT_PATH baked in correctly for + # both Intel (/usr/local/lib) and Apple Silicon (/opt/homebrew/lib). + system "meson", "setup", "builddir", + "--buildtype=release", + "-Dlibdir=#{lib}" + system "meson", "compile", "-C", "builddir" + (lib/"ahfail").install "builddir/libahfail_pam.so" + (lib/"ahfail").install "builddir/ahfail-display" + end + + def caveats + pam_file = if MacOS.version >= :ventura + "/etc/pam.d/screensaverui" + else + "/etc/pam.d/screensaver" + end + <<~EOS + Add this line to #{pam_file} after the existing auth entries (requires sudo): + + auth optional #{lib}/ahfail/libahfail_pam.so + + After upgrading ahfail, re-run `brew install ahfail` and update the path + in #{pam_file} if it changed. + EOS + end + + test do + assert_predicate lib/"ahfail/libahfail_pam.so", :exist? + assert_predicate lib/"ahfail/ahfail-display", :exist? + end +end