#!/bin/sh echo "OK Pleased to meet you" while read line; do echo "GPG sent: $line" >> /tmp/pinentry-trace.log # Ignore empty lines [ -z "$line" ] && continue case "$line" in *GETPIN*) # Run menu and capture output # We use /dev/tty for input if needed, but wmenu usually handles its own window PIN=$(echo -n | menu -p "Passphrase: " -P) if [ $? -ne 0 ] || [ -z "$PIN" ]; then echo "CAN" else echo "D $PIN" echo "OK" fi ;; *BYE*) echo "OK" exit 0 ;; *) # For everything else (SETDESC, SETPROMPT, OPTION, etc.) # We MUST say OK or the agent thinks we crashed echo "OK" ;; esac done