mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-22 04:25:12 +00:00
updated pinentry invokation to include wayland
also changes to priority order of invokation and some code cleanups and indentations. Invokation order is now: - WAYLAND? pinentry-gnome3 - X11? 1. pinentry-x11 (distro specific wrapper) 2. pinentry-gtk2 (legacy, removable) 3. pinentry-gnome3 4. pinentry-qt5 5. pinentry-qt4 - NO DISPLAY? pinentry-curses
This commit is contained in:
parent
763dbdb356
commit
bc94559ac4
87
tomb
87
tomb
@ -416,6 +416,7 @@ ask_password() {
|
||||
local password
|
||||
local gtkrc
|
||||
local theme
|
||||
local pass_asked
|
||||
|
||||
# Distributions have broken wrappers for pinentry: they do
|
||||
# implement fallback, but they disrupt the output somehow. We are
|
||||
@ -428,67 +429,51 @@ ask_password() {
|
||||
|
||||
_verbose "asking password with tty=$TTY lc-ctype=$LANG"
|
||||
|
||||
if [[ "$DISPLAY" = "" ]]; then
|
||||
pass_asked=0
|
||||
|
||||
if _is_found "pinentry-curses"; then
|
||||
_verbose "using pinentry-curses"
|
||||
output=$(pinentry_assuan_getpass | pinentry-curses)
|
||||
else
|
||||
_failure "Cannot find pinentry-curses and no DISPLAY detected."
|
||||
if [[ "$WAYLAND_DISPLAY" ]]; then
|
||||
_verbose "wayland display detected"
|
||||
_is_found "pinentry-gnome3" && {
|
||||
_verbose "using pinentry-gnome3 on wayland"
|
||||
output=$(pinentry_assuan_getpass | pinentry-gnome3)
|
||||
pass_asked=1
|
||||
}
|
||||
fi
|
||||
|
||||
else # a DISPLAY is found to be active
|
||||
|
||||
# customized gtk2 dialog with a skull (if extras are installed)
|
||||
if [[ "$DISPLAY" ]] && [[ "$pass_asked" == 0 ]]; then
|
||||
_verbose "X11 display detected"
|
||||
if _is_found "pinentry-gtk-2"; then
|
||||
_verbose "using pinentry-gtk2"
|
||||
|
||||
gtkrc=""
|
||||
theme=/share/themes/tomb/gtk-2.0-key/gtkrc
|
||||
for i in /usr/local /usr; do
|
||||
[[ -r $i/$theme ]] && {
|
||||
gtkrc="$i/$theme"
|
||||
break
|
||||
}
|
||||
done
|
||||
[[ "$gtkrc" = "" ]] || {
|
||||
gtkrc_old="$GTK2_RC_FILES"
|
||||
export GTK2_RC_FILES="$gtkrc"
|
||||
}
|
||||
output=$(pinentry_assuan_getpass | pinentry-gtk-2)
|
||||
[[ "$gtkrc" = "" ]] || export GTK2_RC_FILES="$gtkrc_old"
|
||||
|
||||
# TODO QT5 customization of dialog
|
||||
elif _is_found "pinentry-qt5"; then
|
||||
_verbose "using pinentry-qt5"
|
||||
|
||||
output=$(pinentry_assuan_getpass | pinentry-qt5)
|
||||
|
||||
# TODO QT4 customization of dialog
|
||||
elif _is_found "pinentry-qt4"; then
|
||||
_verbose "using pinentry-qt4"
|
||||
|
||||
output=$(pinentry_assuan_getpass | pinentry-qt4)
|
||||
# TODO X11 customization of dialog
|
||||
pass_asked=1
|
||||
elif _is_found "pinentry-x11"; then
|
||||
_verbose "using pinentry-x11"
|
||||
|
||||
output=$(pinentry_assuan_getpass | pinentry-x11)
|
||||
|
||||
else
|
||||
|
||||
if _is_found "pinentry-curses"; then
|
||||
_verbose "using pinentry-curses"
|
||||
|
||||
_verbose "Detected DISPLAY, but only pinentry-curses is found."
|
||||
output=$(pinentry_assuan_getpass | pinentry-curses)
|
||||
else
|
||||
_failure "Cannot find any pinentry: impossible to ask for password."
|
||||
pass_asked=1
|
||||
elif _is_found "pinentry-gnome3"; then
|
||||
_verbose "using pinentry-gnome3 on X11"
|
||||
output=$(pinentry_assuan_getpass | pinentry-gnome3)
|
||||
pass_asked=1
|
||||
elif _is_found "pinentry-qt5"; then
|
||||
_verbose "using pinentry-qt5"
|
||||
output=$(pinentry_assuan_getpass | pinentry-qt5)
|
||||
pass_asked=1
|
||||
elif _is_found "pinentry-qt4"; then
|
||||
_verbose "using pinentry-qt4"
|
||||
output=$(pinentry_assuan_getpass | pinentry-qt4)
|
||||
pass_asked=1
|
||||
fi
|
||||
fi
|
||||
if [[ "$pass_asked" == 0 ]]; then
|
||||
_verbose "no display detected"
|
||||
_is_found "pinentry-curses" && {
|
||||
_verbose "using pinentry-curses with no display"
|
||||
output=$(pinentry_assuan_getpassgetpasspass | pinentry-curses)
|
||||
pass_asked=1
|
||||
}
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
fi # end of DISPLAY block
|
||||
[[ "$pass_asked" == 0 ]] &&
|
||||
_failure "Cannot find any pinentry-curses and no DISPLAY detected."
|
||||
|
||||
# parse the pinentry output
|
||||
local pinentry_error
|
||||
|
Loading…
Reference in New Issue
Block a user