Files
omarchy/test/shell.d/fingerprint-driver-migration-test.sh
T
adcc96a782 Install libfprint-git for every fingerprint reader (#10442)
* Use updated libfprint-git for fingerprint setup on edge

* Pick the fingerprint driver from the reader, not the release channel

The channel gate blocked every edge and dev user until the newer
libfprint-git pin is published, misrouted dev checkouts on the stable
mirror, and left the stock-libfprint migration reverting the driver on
accounts without its marker. Key both the setup and the migration on
omarchy-hw-fingerprint-git, a USB ID table of readers stock libfprint
cannot drive, so the git snapshot only goes where it is needed on any
channel. Qualify the package with the omarchy repo, and skip pacman
entirely when the packages are already current so a rerun cannot become
a partial upgrade.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Install libfprint-git for every fingerprint reader

Stock libfprint lags upstream on new readers, and gating the git
snapshot per reader or per channel only added machinery to keep in sync
with the package repo. Install libfprint-git unconditionally instead:
the omarchy-pkgs pin is the single place a new reader gets enabled. The
migration that swapped it back to stock goes away with the policy it
enforced; late updaters keep the driver they have and pick up the new
pin as a normal package upgrade.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: powderluv <powderluv@powderluv.org>
Co-authored-by: David Heinemeier Hansson <david@hey.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 11:58:30 +02:00

61 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
#
# The fingerprint driver migration only repairs a machine an earlier version of
# it left with fprintd and no libfprint; any installed driver is left alone.
# The real package helpers run over a stubbed pacman.
set -euo pipefail
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
migration="$ROOT/migrations/1785090473.sh"
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT
mkdir -p "$scratch/bin"
export CALL_LOG="$scratch/calls"
export PATH="$scratch/bin:$ROOT/bin:$PATH"
cat > "$scratch/bin/sudo" <<'STUB'
#!/bin/bash
exec "$@"
STUB
# INSTALLED lists the installed package names, one per line; an install adds
# its packages to INSTALLED_LOG so omarchy-pkg-add's follow-up query sees them.
cat > "$scratch/bin/pacman" <<'STUB'
#!/bin/bash
case "$1" in
-Q) grep -qx "$2" <<< "${INSTALLED:-}" || grep -qx "$2" "$INSTALLED_LOG" ;;
-S)
printf 'pacman %s\n' "$*" >> "$CALL_LOG"
for arg in "$@"; do
[[ $arg == -* ]] || printf '%s\n' "$arg" >> "$INSTALLED_LOG"
done
;;
*) printf 'pacman %s\n' "$*" >> "$CALL_LOG" ;;
esac
STUB
chmod +x "$scratch/bin/"*
export INSTALLED_LOG="$scratch/installed"
run_migration() {
: > "$CALL_LOG"
: > "$INSTALLED_LOG"
bash -euo pipefail "$migration" > /dev/null
}
INSTALLED='fprintd' run_migration
grep -qx 'pacman -S --noconfirm --needed libfprint-git' "$CALL_LOG" || fail "fprintd without a library gets libfprint-git"
pass "fprintd without a library gets libfprint-git"
INSTALLED=$'libfprint-git\nfprintd' run_migration
[[ ! -s $CALL_LOG ]] || fail "an installed libfprint-git is left alone" "$(<"$CALL_LOG")"
pass "an installed libfprint-git is left alone"
INSTALLED=$'libfprint\nfprintd' run_migration
[[ ! -s $CALL_LOG ]] || fail "an installed stock libfprint is left alone" "$(<"$CALL_LOG")"
pass "an installed stock libfprint is left alone"
INSTALLED='' run_migration
[[ ! -s $CALL_LOG ]] || fail "a machine without fprintd is left alone" "$(<"$CALL_LOG")"
pass "a machine without fprintd is left alone"