- gpg-agent-startup.sh: fix case where valid .gpg-agent-info exists

This commit is contained in:
Rex Dieter 2006-09-18 13:18:25 +00:00
parent c77cd588af
commit 1702b37274
2 changed files with 14 additions and 8 deletions

View File

@ -16,7 +16,7 @@
Summary: Utility for secure communication and data storage
Name: gnupg2
Version: 1.9.22
Release: 5%{?dist}
Release: 6%{?dist}
License: GPL
Group: Applications/System
@ -58,6 +58,8 @@ BuildRequires: docbook-utils
BuildRequires: pcsc-lite-libs
%endif
# sed/kill used in gpg-agent-(startup/shutdown).sh
Requires: fileutils util-linux
Requires: pinentry >= 0.7.1
%if "%{?_enable_gpg:1}" == "1"
@ -170,7 +172,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Mon Sep 18 2006 Rex Dieter <rexdieter[AT]users.sf.net> 1.9.22-5
* Mon Sep 18 2006 Rex Dieter <rexdieter[AT]users.sf.net> 1.9.22-7
- gpg-agent-startup.sh: fix case where valid .gpg-agent-info exists
* Mon Sep 18 2006 Rex Dieter <rexdieter[AT]users.sf.net> 1.9.22-6
- fix "syntax error in gpg-agent-startup.sh" (#206887)
* Thu Sep 07 2006 Rex Dieter <rexdieter[AT]users.sf.net> 1.9.22-3

View File

@ -5,15 +5,16 @@ GPG_AGENT=/usr/bin/gpg-agent
if [ -z "${GPG_AGENT_INFO}" -a -x "${GPG_AGENT}" ] ; then
# check validity of GPG_SOCKET (in case of session crash)
if [ -f ${HOME}/.gpg-agent-info ]; then
GPG_SOCKET=$(cat .gpg-agent-info |cut -f1 -d:)
if ! test -S "${GPG_SOCKET}" -o ! -O "${GPG_SOCKET}" ; then
rm -f ${HOME}/.gpg-agent-info 2>&1 >/dev/null
GPG_AGENT_INFO_FILE=${HOME}/.gpg-agent-info
if [ -f "${GPG_AGENT_INFO_FILE}" ]; then
GPG_SOCKET=$(cat "${GPG_AGENT_INFO_FILE}" | cut -f1 -d:)
if ! test -S "${GPG_SOCKET}" -a -O "${GPG_SOCKET}" ; then
rm -f "${GPG_AGENT_INFO_FILE}" 2>&1 >/dev/null
fi
fi
if [ -f ${HOME}/.gpg-agent-info ]; then
export GPG_AGENT_INFO=$(cat ${HOME}/.gpg-agent-info)
if [ -f "${GPG_AGENT_INFO_FILE}" ]; then
export GPG_AGENT_INFO=$(cat "${GPG_AGENT_INFO_FILE}")
export GPG_TTY=$(tty)
else
eval "$(${GPG_AGENT} -s --daemon ${GPG_OPTIONS})"