dotfiles/.local/bin/scripts/ssh-askpass
2024-08-24 23:57:32 +03:00

30 lines
485 B
Bash
Executable file

#!/bin/bash
log() {
echo "$@" >> /home/wzray/out
}
exec {OUTPUT_PIPE}<> <(:)
DESC="${1:-"Please enter your authentication passphrase:"}"
CMD=$(cat <<-EOF
SETDESC $DESC
SETPROMPT
GETPIN
EOF
)
{
while read -r out <&$OUTPUT_PIPE; do
log "$out"
if [[ "$out" = "D "* ]]; then
echo "${out#"D "}"
break
fi
done
} &
pinentry-curses -T "${GPG_TTY}" -C "en_US.UTF-8" -M "en_US.UTF-8" -g <<<"$CMD" >&$OUTPUT_PIPE
# vim: ft=sh