From 4bed7050f1c3f3d9334f3c1524e2cbda80e4a184 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 7 Aug 2023 07:57:36 +0200 Subject: Some updates of pinentry-rofi-ABANDONED.sh --- pinentry-rofi-ABANDONED.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pinentry-rofi-ABANDONED.sh b/pinentry-rofi-ABANDONED.sh index 45e8d4e..0a1ce47 100755 --- a/pinentry-rofi-ABANDONED.sh +++ b/pinentry-rofi-ABANDONED.sh @@ -121,7 +121,7 @@ while : ; do assuan_send "OK" elif [[ "$line" =~ ^SETKEYINFO ]] ; then IFS=" " read -ra line_arr <<< "$line" - unset "line_arr[0]" + unset "line_arr[0]" && line_arr=("${line_arr[@]}") if [[ "${line_arr[0]}" =~ ^--clear ]] ; then keyinfo="" else @@ -141,7 +141,7 @@ while : ; do #SETDESC Please enter the passphrase for the ssh key%0A ke:yf:in:ge:rp:ri:nt # rofi << "-mesg" << $1.gsub("<", "<").gsub(/%([0-9A-Fa-f]{2})/) { $1.to_i(16).chr } IFS=" " read -ra line_arr <<< "$line" - unset "line_arr[0]" + unset "line_arr[0]" && line_arr=("${line_arr[@]}") win_mesg="${line_arr[*]}" assuan_send "OK" elif [[ "$line" =~ ^SETPROMPT ]] ; then @@ -151,22 +151,22 @@ while : ; do assuan_send "OK" elif [[ "$line" =~ ^GETPIN ]] ; then passw=None - sys_env="$(systemctl --user show-environment)" + sys_env="$(systemctl --user show-environment | tr -s " \t\n" " ")" IFS=" " read -ra sys_env_arr <<< "$sys_env" for env_line in "${sys_env_arr[@]}" ; do log_debug "env_line=${env_line}" # GPIN_VALID=re.compile(r) - if [[ "$env_line" =~ ^[A-Za-z_]+=\(.\+\)$ ]] ; then + if [[ "$env_line" =~ ^([A-Za-z][A-Za-z_]*)=(.+)$ ]] ; then log_debug "env_match=${BASH_REMATCH[*]}" export "${BASH_REMATCH[1]}=${BASH_REMATCH[2]}" fi done - - rofi_cmd+=" -p ${win_prompt}" - rofi_cmd+=" -title ${win_title}" + rofi_cmd+=" -p '${win_prompt}'" + rofi_cmd+=" -title '${win_title}'" if [[ -n "${win_mesg}" ]] ; then - rofi_cmd+=" -mesg ${win_mesg}" + rofi_cmd+=" -mesg '${win_mesg}'" fi + log_debug "${rofi_cmd}" passw="$(eval "${rofi_cmd}")" passw_err=$? if [[ ${passw_err} -ne 0 ]] ; then -- cgit