From bbe9a49ec3f6c709478b1f7873b567e3f36d84a1 Mon Sep 17 00:00:00 2001 From: Jaromil Date: Wed, 26 Nov 2014 17:44:23 +0100 Subject: [PATCH] Direct handling of pinentry execution We skip distro wrappers here since they interfere with stdin/out As usual: better to have less intermediaries. --- tomb | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 91 insertions(+), 12 deletions(-) diff --git a/tomb b/tomb index 76524e9..b235ff8 100755 --- a/tomb +++ b/tomb @@ -160,7 +160,14 @@ TRAPSTOP() { _endgame STOP } _cat() { local -a _arr; # read file using mapfile, newline fix - _arr=("${(f@)${mapfile[${1}]%$ā€™\nā€™}}"); print "$_arr" } + _arr=("${(f@)${mapfile[${1}]%$ā€™\nā€™}}"); print "$_arr" +} + +_is_found() { + # returns 0 if binary if found in path + [[ "$1" = "" ]] && return 1 + return command -v "$1" 1>/dev/null 2>/dev/null +} # Identify the running user # Set global variables _UID, _GID, _TTY, and _USER, either from the @@ -343,15 +350,17 @@ ask_password() { local gtkrc local theme - [[ "$DISPLAY" = "" ]] || { - theme=/share/themes/tomb/gtk-2.0-key/gtkrc - for i in /usr/local /usr; do - [[ -r $i/$theme ]] && { - gtkrc=$i/$theme - break } - done } + # Distributions have broken wrappers for pinentry: they do + # implement fallback, but they disrupt the output somehow. We are + # better off relying on less intermediaries, so we implement our + # own fallback mechanisms. Pinentry supported: curses, gtk-2, qt4 + # and x11. - output=`cat <