| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/bin/bash
- # Fingerprint verification via the Wine sandbox + hacked winusb + vendor driver.
- # Usage: fp-verify.sh (touch the sensor when the log says it waits)
- # Exit codes: 0 = MATCH (enrolled "Unicorn" record returned), 1 = no match, 2 = error/timeout
- set -u
- export PATH=/usr/local/bin:/usr/bin:/bin
- ROOT=/home/nebulon/projects/fingerprint
- SANDBOX=$ROOT/work/synaWudfBioUsb-sandbox
- export HOME="${HOME:-/home/nebulon}"
- export WINEPREFIX=$ROOT/work/wineprefix-48
- export WINEDEBUG=-all
- export USB_SCRIPT=$ROOT/work/debug/usb-verify-$(date +%s).txt
- export USB_PLAYBACK=""
- touch "$USB_SCRIPT"
- mkdir -p /tmp/opencode 2>/dev/null
- LOG=/tmp/opencode/fp-verify-last.log
- cd "$SANDBOX" || exit 2
- # self-heal: the device spec the driver reads (sandbox copy + Wine C: drive)
- [ -f usb.txt ] || echo "06cb:0081" > usb.txt
- USB_TXT="$WINEPREFIX/drive_c/usb.txt"
- if [ ! -f "$USB_TXT" ]; then
- mkdir -p "$(dirname "$USB_TXT")" 2>/dev/null
- echo "06cb:0081" > "$USB_TXT" 2>/dev/null || true
- fi
- [ "${FP_VERIFY_QUIET:-0}" = "1" ] || echo "Fingerprint: touch the reader (or wait for the password prompt)..."
- timeout -k 5 "${FP_VERIFY_TIMEOUT:-90}" \
- "$ROOT/work/wine-build/install/bin/wine64" verify.exe > "$LOG" 2>&1
- rc=$?
- if grep -q "556e69636f726e" "$LOG"; then # hex of "Unicorn"
- echo "Fingerprint matched."
- exit 0
- elif [ "$rc" -eq 124 ] || [ "$rc" -eq 137 ]; then
- echo "No fingerprint detected - falling back to password."
- exit 2
- else
- echo "Fingerprint did not match - falling back to password."
- exit 1
- fi
|