Skip to content

Commit

Permalink
add support for pinentry-tty
Browse files Browse the repository at this point in the history
fallback to pinentry-tty is supported, correct message working now
doesn't distinguishes between pinentry versions
  • Loading branch information
jaromil committed May 12, 2024
1 parent 44d7f5f commit 5870619
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 21 deletions.
4 changes: 2 additions & 2 deletions extras/translations/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ msgstr "Vorgang abgebrochen."

#: tomb:Safety functions:ask_password:536
#, fuzzy
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgstr "Kann 'pinentry-curses' nicht finden und es kein DISPLAY gefunden."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr "Kann 'pinentry' nicht finden und es kein DISPLAY gefunden."

#: tomb:Safety functions:ask_password:550
msgid "Pinentry error: ::1 error::"
Expand Down
4 changes: 2 additions & 2 deletions extras/translations/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ msgstr "Operación abortada."

#: tomb:Safety functions:ask_password:536
#, fuzzy
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgstr "No se puede encontrar pinentry-curses, y no se ha detectado DISPLAY."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr "No se puede encontrar pinentry, y no se ha detectado DISPLAY."

#: tomb:Safety functions:ask_password:550
msgid "Pinentry error: ::1 error::"
Expand Down
4 changes: 2 additions & 2 deletions extras/translations/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ msgstr "L'opération est interrompue."

#: tomb:Safety functions:ask_password:536
#, fuzzy
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr ""
"Impossible de trouver pinentry-curses et aucun DISPLAY n'a été détecté."
"Impossible de trouver pinentry et aucun DISPLAY n'a été détecté."

#: tomb:Safety functions:ask_password:550
msgid "Pinentry error: ::1 error::"
Expand Down
4 changes: 2 additions & 2 deletions extras/translations/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ msgstr "Operazione annullata."

#: tomb:Safety functions:ask_password:536
#, fuzzy
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgstr "Impossibile trovare pinentry-curses e nessun DISPLAY rilevato."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr "Impossibile trovare pinentry e nessun DISPLAY rilevato."

#: tomb:Safety functions:ask_password:550
msgid "Pinentry error: ::1 error::"
Expand Down
4 changes: 2 additions & 2 deletions extras/translations/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ msgid "Operation aborted."
msgstr "Operação abortada."

#: tomb:Safety functions:ask_password:536
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr ""
"Não foi possível encontrar qualquer pinentry-curses e nenhum DISPLAY foi "
"Não foi possível encontrar qualquer pinentry e nenhum DISPLAY foi "
"detectado."

#: tomb:Safety functions:ask_password:550
Expand Down
4 changes: 2 additions & 2 deletions extras/translations/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ msgstr "Операция отменена."

#: tomb:Safety functions:ask_password:536
#, fuzzy
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgstr "Не могу найти pinentry-curses и не задан DISPLAY."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr "Не могу найти pinentry и не задан DISPLAY."

#: tomb:Safety functions:ask_password:550
msgid "Pinentry error: ::1 error::"
Expand Down
4 changes: 2 additions & 2 deletions extras/translations/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ msgstr "Åtgärden är avbruten."

#: tomb:Safety functions:ask_password:536
#, fuzzy
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgstr "Kan ej hitta pinentry-curses och ingen DISPLAY detekterad."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr "Kan ej hitta pinentry och ingen DISPLAY detekterad."

#: tomb:Safety functions:ask_password:550
msgid "Pinentry error: ::1 error::"
Expand Down
2 changes: 1 addition & 1 deletion extras/translations/tomb.pot
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ msgid "Operation aborted."
msgstr ""

#: tomb:Safety functions:ask_password:536
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr ""

#: tomb:Safety functions:ask_password:550
Expand Down
2 changes: 1 addition & 1 deletion extras/translations/zh_Hans.po
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ msgid "Operation aborted."
msgstr ""

#: tomb:Safety functions:ask_password:536
msgid "Cannot find any pinentry-curses and no DISPLAY detected."
msgid "Cannot find any pinentry and no DISPLAY detected."
msgstr ""

#: tomb:Safety functions:ask_password:550
Expand Down
22 changes: 17 additions & 5 deletions tomb
Original file line number Diff line number Diff line change
Expand Up @@ -525,15 +525,22 @@ 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
}
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 ]] &&
_failure "Cannot find any pinentry-curses and no DISPLAY detected."
_failure "Cannot find any pinentry and no DISPLAY detected."

# parse the pinentry output
local pinentry_error
Expand Down Expand Up @@ -987,11 +994,16 @@ _list_optional_tools() {
_ensure_dependencies() {

# Check for required programs
for req in cryptsetup pinentry sudo gpg mkfs.ext4 e2fsck; do
for req in cryptsetup sudo gpg mkfs.ext4 e2fsck; do
command -v $req 1>/dev/null 2>/dev/null || {
_failure "Missing required dependency ::1 command::. Please install it." $req; }
done

# Check for pinentry or at least pinentry-tty (which has no alias)
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 5870619

Please sign in to comment.