From 57fc5139124fabd0b9697ed4ec974fd2bd82c6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Thu, 24 Mar 2022 14:55:37 +0100 Subject: [PATCH] enter pin only on commandline also on load --- bin/startagent | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/startagent b/bin/startagent index 207e272..84b4f6c 100755 --- a/bin/startagent +++ b/bin/startagent @@ -256,6 +256,12 @@ $(ssh-runinagent $agentfile ssh-add -l)" agent-load-identity-keys () { ENTRY + # If DISPLAY is set, ssh-add calls ssh-askpass, and if its in remote-terminal, it wont work + # So remember and unset DISPLAY, and set it at the end again, if it was set before + [ $DISPLAY ] && local DISPLAY_ORIG=$DISPLAY + [ $DISPLAY ] && logtrace "unset DISPLAY: $DISPLAY" + [ $DISPLAY ] && unset DISPLAY + local ssh_identity local agentfile local agentsocket @@ -361,6 +367,10 @@ agent-load-identity-keys () { logwarn "ssh-identity $ssh_identity is not configured. Please create $identitydir and add keys" fi fi + + [ $DISPLAY_ORIG ] && logtrace "reset DISPLAY=$DISPLAY_ORIG" + [ $DISPLAY_ORIG ] && export DISPLAY=$DISPLAY_ORIG + EXIT }