mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-22 12:35:13 +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 password
|
||||||
local gtkrc
|
local gtkrc
|
||||||
local theme
|
local theme
|
||||||
|
local pass_asked
|
||||||
|
|
||||||
# Distributions have broken wrappers for pinentry: they do
|
# Distributions have broken wrappers for pinentry: they do
|
||||||
# implement fallback, but they disrupt the output somehow. We are
|
# 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"
|
_verbose "asking password with tty=$TTY lc-ctype=$LANG"
|
||||||
|
|
||||||
if [[ "$DISPLAY" = "" ]]; then
|
pass_asked=0
|
||||||
|
|
||||||
if _is_found "pinentry-curses"; then
|
if [[ "$WAYLAND_DISPLAY" ]]; then
|
||||||
_verbose "using pinentry-curses"
|
_verbose "wayland display detected"
|
||||||
output=$(pinentry_assuan_getpass | pinentry-curses)
|
_is_found "pinentry-gnome3" && {
|
||||||
else
|
_verbose "using pinentry-gnome3 on wayland"
|
||||||
_failure "Cannot find pinentry-curses and no DISPLAY detected."
|
output=$(pinentry_assuan_getpass | pinentry-gnome3)
|
||||||
|
pass_asked=1
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
|
if [[ "$DISPLAY" ]] && [[ "$pass_asked" == 0 ]]; then
|
||||||
else # a DISPLAY is found to be active
|
_verbose "X11 display detected"
|
||||||
|
|
||||||
# customized gtk2 dialog with a skull (if extras are installed)
|
|
||||||
if _is_found "pinentry-gtk-2"; then
|
if _is_found "pinentry-gtk-2"; then
|
||||||
_verbose "using pinentry-gtk2"
|
_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)
|
output=$(pinentry_assuan_getpass | pinentry-gtk-2)
|
||||||
[[ "$gtkrc" = "" ]] || export GTK2_RC_FILES="$gtkrc_old"
|
pass_asked=1
|
||||||
|
|
||||||
# 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
|
|
||||||
elif _is_found "pinentry-x11"; then
|
elif _is_found "pinentry-x11"; then
|
||||||
_verbose "using pinentry-x11"
|
_verbose "using pinentry-x11"
|
||||||
|
|
||||||
output=$(pinentry_assuan_getpass | pinentry-x11)
|
output=$(pinentry_assuan_getpass | pinentry-x11)
|
||||||
|
pass_asked=1
|
||||||
else
|
elif _is_found "pinentry-gnome3"; then
|
||||||
|
_verbose "using pinentry-gnome3 on X11"
|
||||||
if _is_found "pinentry-curses"; then
|
output=$(pinentry_assuan_getpass | pinentry-gnome3)
|
||||||
_verbose "using pinentry-curses"
|
pass_asked=1
|
||||||
|
elif _is_found "pinentry-qt5"; then
|
||||||
_verbose "Detected DISPLAY, but only pinentry-curses is found."
|
_verbose "using pinentry-qt5"
|
||||||
output=$(pinentry_assuan_getpass | pinentry-curses)
|
output=$(pinentry_assuan_getpass | pinentry-qt5)
|
||||||
else
|
pass_asked=1
|
||||||
_failure "Cannot find any pinentry: impossible to ask for password."
|
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
|
[[ "$pass_asked" == 0 ]] &&
|
||||||
|
_failure "Cannot find any pinentry-curses and no DISPLAY detected."
|
||||||
fi # end of DISPLAY block
|
|
||||||
|
|
||||||
# parse the pinentry output
|
# parse the pinentry output
|
||||||
local pinentry_error
|
local pinentry_error
|
||||||
|
Loading…
Reference in New Issue
Block a user