Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 58636 - patch startkde to use gpg-agent if available
Summary: patch startkde to use gpg-agent if available
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] KDE (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
: 58954 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-07-28 02:34 UTC by Jan Kohnert
Modified: 2005-01-04 20:48 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for startkde version 3.2.3 (startkde-3.2.3-gentoo.diff.patch,425 bytes, patch)
2004-07-28 02:44 UTC, Jan Kohnert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kohnert 2004-07-28 02:34:03 UTC
Just a thought:
Could we add the lines

if test -x /usr/bin/gpg-agent
  then eval "$(/usr/bin/gpg-agent --daemon)"
fi

to the gentoo section of startkde?
I'm using this for kmail and after an update of kde I need to redo this
setting. If we would add this everyone could use the agent, if it were
available.

Thanks, Jan

Reproducible: Always
Steps to Reproduce:
Comment 1 Jan Kohnert 2004-07-28 02:44:48 UTC
Created attachment 36310 [details, diff]
Patch for startkde version 3.2.3

This one fixes the problem in the described way. I did it for 3.2.3, but I
think, it works the same way for other versions.
Comment 2 Caleb Tennis (RETIRED) gentoo-dev 2004-07-28 07:00:14 UTC
i think this is a good idea, will try and get in soon (for 3.3)
Comment 3 Gregorio Guidi (RETIRED) gentoo-dev 2004-07-29 13:38:51 UTC
From startkde in 3.3:
	# Source scripts found in <localprefix>/env/*.sh and <prefixes>/env/*.sh
	# (where <localprefix> is $KDEHOME or ~/.kde, and <prefixes> is where KDE is installed)
	#
	# This is where you can define environment variables that will be available to
	# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
	# or eval `gpg-agent --daemon`.
	# Note: if you do that, you should also put "ssh-agent -k" as a shutdown script
	#
	# (see end of this file).
	# For anything else (that doesn't set env vars, or that needs a window manager),
	# better use the Autostart folder.

	exepath=`kde-config --path exe`

	for prefix in `echo "$exepath" | sed -e 's^/bin/^/env/^g;s^:^ ^g'`; do 
	  for file in "$prefix"*.sh; do
	    test -r "$file" && . "$file"
	  done
	done

so, all we need is to drop a 'agents.sh' file in /usr/kde/3.3/env/
that runs 'eval `gpg-agent --daemon`' if gpg-agent is present
Comment 4 Caleb Tennis (RETIRED) gentoo-dev 2004-08-02 10:01:03 UTC
*** Bug 58954 has been marked as a duplicate of this bug. ***
Comment 5 SpanKY gentoo-dev 2004-08-14 19:41:13 UTC
i say we mark this a dupe of Bug 26970

having gpg-agent start all the time for kde users seems the wrong thing to do ... if someone wants encryption agents running, they should do it themselves (or in this case, keychain will be able to do it)
Comment 6 Caleb Tennis (RETIRED) gentoo-dev 2004-08-16 05:47:45 UTC
Actually, we can close it as the latest kde packages (> 3.3.0rc1) install the proper scripts to do this, though the lines in the scripts are commented out meaning you have to hand edit them to turn it on.
Comment 7 Florian Ehrenthal 2004-10-31 13:17:50 UTC
let me add, that with a recent (~x86) version of gpg the scripts provided with kde-3.3.1 dont shutdown gpg-agent correctly!
Comment 8 Gregorio Guidi (RETIRED) gentoo-dev 2004-11-02 08:56:31 UTC
what version of gpg, and what's wrong exactly?
Comment 9 Jochen Trumpf 2005-01-04 20:48:37 UTC
The problem in comment #7 is caused by two things:
1.) a missing executable flag on the shutdown script. For some reason the test for startup scripts in startkde uses -r (readable file) and sources them while the test for shutdown scripts uses -x (executable file) and runs them. It's beyond me why this is so, but making the shutdown script(s) executable solves the (first part of the) problem. I have filed a separate bug report #76719 for this. 
2.) the shutdown script itself is wrong, gpg-agent doesn't know an option -k (at least not the one from gnupg-1.9.14). The following

if [ -x /usr/bin/gpg-agent ]; then
  kill $(echo ${GPG_AGENT_INFO} | cut -d':' -f 2) 2>&1 >/dev/null
fi

works for me (although checking for the presence of the gpg-agent executable is maybe not the optimal thing to do). Filed bug report #76720 for that.