Skip to content

Commit

Permalink
correct checks for pinentry
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromil committed May 12, 2024
1 parent cb37a5f commit 5eaa950
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tomb
Original file line number Diff line number Diff line change
Expand Up @@ -525,16 +525,18 @@ ask_password() {
fi
if [[ $pass_asked == 0 ]]; then
_verbose "no display detected"
_is_found "pinentry-curses" && {
if _is_found "pinentry-curses"; then
_verbose "using pinentry-curses with no display"
output=$(pinentry_assuan_getpass | pinentry-curses)
pass_asked=1
}
_is_found "pinentry-tty" && {
elif _is_found "pinentry-tty"; then
_verbose "using pinentry-tty with no display"
output=$(pinentry_assuan_getpass | pinentry-tty)
pass_asked=1
}
else
# TODO: fallback to asking password using read
_failure "Cannot find any pinentry and no DISPLAY detected."
fi
fi

[[ $pass_asked == 0 ]] &&
Expand Down Expand Up @@ -997,10 +999,11 @@ _ensure_dependencies() {
_failure "Missing required dependency ::1 command::. Please install it." $req; }
done
# Check for pinentry or at least pinentry-tty (which has no alias)
[[ ! command -v pinentry 1>/dev/null 2>/dev/null ]] &&
[[ ! command -v pinentry-tty 1>/dev/null 2>/dev/null ]] && {
_failure "Missing required dependency ::1 command::. Please install it." pinentry; }

if ! command -v pinentry 1>/dev/null 2>/dev/null; then
if ! command -v pinentry-tty 1>/dev/null 2>/dev/null; then
_failure "Missing required dependency ::1 command::. Please install it." pinentry
fi
fi
# Ensure system binaries are available in the PATH
path+=(/sbin /usr/sbin) # zsh magic

Expand Down

0 comments on commit 5eaa950

Please sign in to comment.