Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions bin/omarchy-setup-security-fingerprint
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,27 @@ if ! omarchy-hw-fingerprint; then
exit 1
fi


# libfprint-git tracks upstream ahead of the Arch release, so a new reader only
# needs a pin bump in omarchy-pkgs. It conflicts with stock libfprint, and
# --noconfirm answers that prompt with N; --ask 4 accepts the replacement in
# one transaction, so a failed install leaves the existing driver in place.
# We explicitly exempt foreign providers (e.g., libfprint-tod from AUR) from
# this replacement path to prevent breaking vendor-specific downstream packages.
if omarchy-pkg-missing libfprint-git fprintd usbutils; then
echo "Installing required packages..."
sudo pacman -S --needed --noconfirm --ask 4 -- libfprint-git fprintd usbutils
if pacman -Qqm libfprint &>/dev/null; then
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
# Only notify if missing framework packages actually need to be provisioned
if omarchy-pkg-missing fprintd usbutils; then
echo "Installing required framework packages..."
sudo pacman -S --needed --noconfirm -- fprintd usbutils
fi
else
echo "Installing required packages..."
sudo pacman -S --needed --noconfirm --ask 4 -- libfprint-git fprintd usbutils
fi
fi


# Enroll first fingerprint
# Authenticate sudo first, and say so: with fingerprint sudo already set up it
# asks for a touch of its own, which must not pass for the first sample.
Expand Down
21 changes: 21 additions & 0 deletions test/shell.d/fingerprint-package-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# two conflict, so the swap has to happen inside one --ask 4 transaction, and a
# rerun with everything installed must not touch pacman at all. The real
# omarchy-pkg-missing runs; pacman and the privileged calls are stubbed.
#
# Foreign providers (e.g., libfprint-tod from AUR) are explicitly exempted
# inside the transaction block to safeguard vendor-specific downstream drivers.

set -euo pipefail

Expand Down Expand Up @@ -43,6 +46,13 @@ case "$1" in
fi
grep -qx -- "$1" <<< "${INSTALLED:-}"
;;
-Qqm)
if [[ ${MOCK_FOREIGN_LIBFPRINT:-0} == "1" ]]; then
echo "libfprint-tod"
exit 0
fi
exit 1
;;
-S)
printf 'pacman %s\n' "$*" >> "$CALL_LOG"
exit "${INSTALL_STATUS:-0}"
Expand Down Expand Up @@ -114,6 +124,10 @@ assert_installs() {
(( $(grep -c '^pacman ' "$CALL_LOG") == 1 )) || fail "$1: one pacman transaction"
}

assert_framework_installs() {
grep -qx 'pacman -S --needed --noconfirm -- fprintd usbutils' "$CALL_LOG" || fail "$1"
(( $(grep -c '^pacman ' "$CALL_LOG") == 1 )) || fail "$1: one framework pacman transaction"
}
run_setup
assert_installs "a fresh machine installs libfprint-git, fprintd and usbutils"
grep -qx enroll "$CALL_LOG" || fail "installation is followed by enrollment"
Expand All @@ -130,6 +144,13 @@ fi
grep -qx enroll "$CALL_LOG" || fail "a rerun with everything installed reaches enrollment"
pass "a rerun with everything installed goes straight to enrollment"

# Test scenario: User has a custom foreign libfprint driver (e.g., libfprint-tod),
# but fprintd and usbutils are missing. The transaction must preserve the driver
# and only provision the missing framework.
MOCK_FOREIGN_LIBFPRINT=1 run_setup
assert_framework_installs "a machine with a foreign driver installs only missing framework packages"
pass "foreign libfprint providers are preserved and exempt from replacement"

INSTALL_STATUS=1 run_setup
if grep -qx enroll "$CALL_LOG"; then
fail "a failed package transaction prevents enrollment"
Expand Down