From 939cf96569e4de372005c3ccaecadb1a8c1533a8 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Mon, 29 Nov 2010 17:11:42 +0100 Subject: [PATCH] [mutt/gpg] mutt script check if gpg agent is launched before getting launch --- scripts/run_gpg.sh | 10 +++++++++- scripts/run_mutt.sh | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100755 scripts/run_mutt.sh diff --git a/scripts/run_gpg.sh b/scripts/run_gpg.sh index 05043a4..1671e29 100755 --- a/scripts/run_gpg.sh +++ b/scripts/run_gpg.sh @@ -1,3 +1,11 @@ #could be placed in .profile c.f man page gpg-agent --daemon --enable-ssh-support \ - --write-env-file "${HOME}/.gpg-agent-info" + --write-env-file "${HOME}/.gpg-agent-info" + +if [ -f "${HOME}/.gpg-agent-info" ]; then + . "${HOME}/.gpg-agent-info" + export GPG_AGENT_INFO + export SSH_AUTH_SOCK + export SSH_AGENT_PID +fi + diff --git a/scripts/run_mutt.sh b/scripts/run_mutt.sh new file mode 100755 index 0000000..e29cf3d --- /dev/null +++ b/scripts/run_mutt.sh @@ -0,0 +1,11 @@ +#!/bin/zsh + +is_running=`ps aux| grep gpg-agent| grep -v grep` + +if [ $is_running ] ; then + echo "gpg is running"; +else + env=`./run_gpg.sh` + source $env +fi +mutt