add support for pinentry-tty

fallback to pinentry-tty is supported, correct message working now
doesn't distinguishes between pinentry versions
This commit is contained in:
Jaromil 2024-05-13 00:48:07 +02:00
parent c72432d640
commit 7ebcfc767e
10 changed files with 33 additions and 21 deletions

View File

@ -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::"

View File

@ -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::"

View File

@ -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::"

View File

@ -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::"

View File

@ -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

View File

@ -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::"

View File

@ -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::"

View File

@ -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

View File

@ -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

22
tomb
View File

@ -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
@ -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