[arch-commits] Commit in kde-agent/trunk (7 files)

Andrea Scarpino andrea at archlinux.org
Sat Jul 2 23:33:39 UTC 2011


    Date: Saturday, July 2, 2011 @ 19:33:38
  Author: andrea
Revision: 130171

upgpkg: kde-agent 20110602-1
Split the ssh agent and the gpg agent (thanks to Fedora guys for the latter), this support ssh/gpg agents already running before of the KDE session

Added:
  kde-agent/trunk/gpg-agent-shutdown.sh
  kde-agent/trunk/gpg-agent-startup.sh
  kde-agent/trunk/ssh-agent-shutdown.sh
  kde-agent/trunk/ssh-agent-startup.sh
Modified:
  kde-agent/trunk/PKGBUILD
Deleted:
  kde-agent/trunk/agent-shutdown.sh
  kde-agent/trunk/agent-startup.sh

-----------------------+
 PKGBUILD              |   29 ++++++++++++++++++-----------
 agent-shutdown.sh     |   13 -------------
 agent-startup.sh      |   19 -------------------
 gpg-agent-shutdown.sh |   14 ++++++++++++++
 gpg-agent-startup.sh  |   31 +++++++++++++++++++++++++++++++
 ssh-agent-shutdown.sh |    6 ++++++
 ssh-agent-startup.sh  |   11 +++++++++++
 7 files changed, 80 insertions(+), 43 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2011-07-02 23:02:08 UTC (rev 130170)
+++ PKGBUILD	2011-07-02 23:33:38 UTC (rev 130171)
@@ -1,20 +1,27 @@
 # $Id$
-# Maintainer: Tobias Powalowski <tpowa at archlinux.org>
+# Maintainer: Andrea Scarpino <andrea at archlinux.org>
+# Contributor: Tobias Powalowski <tpowa at archlinux.org>
 
 pkgname=kde-agent
-pkgver=20090801
-pkgrel=2
+pkgver=20110602
+pkgrel=1
 pkgdesc="Startup and shutdown scripts for gpg-agent and ssh-agent in KDE"
-arch=('i686' 'x86_64')
+arch=('any')
 url='http://www.kde.org'
 license=('GPL' 'LGPL' 'FDL')
 depends=('pinentry' 'openssh' 'qt')
-source=(agent-startup.sh 
-        agent-shutdown.sh)
+source=('gpg-agent-startup.sh' 'gpg-agent-shutdown.sh'
+        'ssh-agent-startup.sh' 'ssh-agent-shutdown.sh')
+md5sums=('1eb1408f2adec23b6747f8f194b6ee3d'
+         '6838aa08aaf27962e3f833d25daa086a'
+         '8b8c4f60aa66660670db20dd1beccf88'
+         'a5d2f2191f31c4f869c98067010395d4')
 
-build() {
-  install -D -m 755 $srcdir/agent-startup.sh $pkgdir/etc/kde/env/agent-startup.sh
-  install -D -m 755 $srcdir/agent-shutdown.sh $pkgdir/etc/kde/shutdown/agent-shutdown.sh
+package() {
+  cd "${srcdir}"
+  install -d "${pkgdir}"/etc/kde/env
+  install -D -m755 {gpg,ssh}-agent-startup.sh "${pkgdir}"/etc/kde/env/
+
+  install -d "${pkgdir}"/etc/kde/shutdown
+  install -D -m755 {gpg,ssh}-agent-shutdown.sh "${pkgdir}"/etc/kde/shutdown/
 }
-md5sums=('7daec96c125e1e238a35f31ea4a476f0'
-         '18e8d01124b19f7df2937c06e177bf7f')

Deleted: agent-shutdown.sh
===================================================================
--- agent-shutdown.sh	2011-07-02 23:02:08 UTC (rev 130170)
+++ agent-shutdown.sh	2011-07-02 23:33:38 UTC (rev 130171)
@@ -1,13 +0,0 @@
-#!/bin/sh
-#
-# This file is executed at kde shutdown.
-# Uncomment the following lines to kill the agents
-# that were started at session startup.
-
-if [ "${GPG_AGENT_INFO}" ]; then
-  kill $(echo ${GPG_AGENT_INFO} | cut -d':' -f 2) >/dev/null 2>&1
-fi
-#
-if [ "${SSH_AGENT_PID}" ]; then
-  ssh-agent -k
-fi

Deleted: agent-startup.sh
===================================================================
--- agent-startup.sh	2011-07-02 23:02:08 UTC (rev 130170)
+++ agent-startup.sh	2011-07-02 23:33:38 UTC (rev 130171)
@@ -1,19 +0,0 @@
-# Agents startup file
-#
-# This file is sourced at kde startup, so that
-# the environment variables set here are available
-# throughout the session.
-
-# Uncomment the following lines to start gpg-agent
-# and/or ssh-agent at kde startup.
-# If you do so, do not forget to uncomment the respective
-# lines in KDEDIR/shutdown/agent-shutdown.sh to
-# properly kill the agents when the session ends.
-
-if [ -x /usr/bin/gpg-agent ]; then
-  eval "$(/usr/bin/gpg-agent --daemon --pinentry-program /usr/bin/pinentry-qt4)"
-fi 
-#
-if [ -x /usr/bin/ssh-agent ]; then
-  eval "$(/usr/bin/ssh-agent -s)"
-fi

Added: gpg-agent-shutdown.sh
===================================================================
--- gpg-agent-shutdown.sh	                        (rev 0)
+++ gpg-agent-shutdown.sh	2011-07-02 23:33:38 UTC (rev 130171)
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+## The nice way
+if test -n "${GPG_AGENT_INFO}"; then
+  GPG_AGENT_PID=`echo ${GPG_AGENT_INFO} | cut -d: -f2` && kill ${GPG_AGENT_PID} ||:
+  unset GPG_AGENT_INFO
+fi
+
+## The not so nice way
+## NOTE: a root login will kill *all* users' gpg-agents
+#killall gpg-agent
+
+## clean/remove .gpg-agent-info
+rm -f $HOME/.gpg-agent-info


Property changes on: kde-agent/trunk/gpg-agent-shutdown.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: gpg-agent-startup.sh
===================================================================
--- gpg-agent-startup.sh	                        (rev 0)
+++ gpg-agent-startup.sh	2011-07-02 23:33:38 UTC (rev 130171)
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+GPG_AGENT=/usr/bin/gpg-agent
+## Run gpg-agent only if not already running, and available
+if [ -x "${GPG_AGENT}" ] ; then
+
+  # check validity of GPG_SOCKET (in case of session crash)
+  GPG_AGENT_INFO_FILE=${HOME}/.gpg-agent-info
+  if [ -f "${GPG_AGENT_INFO_FILE}" ]; then
+    GPG_AGENT_PID=`cat ${GPG_AGENT_INFO_FILE} | cut -f2 -d:`
+    GPG_PID_NAME=`ps -p ${GPG_AGENT_PID} -o comm=`
+    if [ ! "x${GPG_PID_NAME}" = "xgpg-agent" ]; then
+      rm -f "${GPG_AGENT_INFO_FILE}" 2>&1 >/dev/null
+    else
+       GPG_SOCKET=`cat "${GPG_AGENT_INFO_FILE}" | cut -f1 -d: | cut -f2 -d=`
+       if ! test -S "${GPG_SOCKET}" -a -O "${GPG_SOCKET}" ; then
+         rm -f "${GPG_AGENT_INFO_FILE}" 2>&1 >/dev/null
+       fi
+    fi
+    unset GPG_AGENT_PID GPG_SOCKET GPG_PID_NAME
+  fi
+
+  if [ -f "${GPG_AGENT_INFO_FILE}" ]; then
+    eval "$(cat \"${GPG_AGENT_INFO_FILE}\")"
+    eval "$(cut -d= -f 1 < \"${GPG_AGENT_INFO_FILE}\" | xargs echo export)"
+    export GPG_TTY=$(tty)
+  else
+    eval "$(${GPG_AGENT} -s --daemon --pinentry-program /usr/bin/pinentry-qt4 --write-env-file)"
+  fi
+
+fi


Property changes on: kde-agent/trunk/gpg-agent-startup.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: ssh-agent-shutdown.sh
===================================================================
--- ssh-agent-shutdown.sh	                        (rev 0)
+++ ssh-agent-shutdown.sh	2011-07-02 23:33:38 UTC (rev 130171)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if [ -n "${SSH_AGENT_PID}" ]; then
+  kill ${SSH_AGENT_PID}
+  unset SSH_AGENT_PID SSH_AUTH_SOCK
+fi


Property changes on: kde-agent/trunk/ssh-agent-shutdown.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: ssh-agent-startup.sh
===================================================================
--- ssh-agent-startup.sh	                        (rev 0)
+++ ssh-agent-startup.sh	2011-07-02 23:33:38 UTC (rev 130171)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+SSH_AGENT=/usr/bin/ssh-agent
+## Run ssh-agent only if not already running, and available
+if [ -x "${SSH_AGENT}" ] ; then
+
+  if [ -z "${SSH_AGENT_PID}" ]; then
+    eval "$(${SSH_AGENT} -s)"
+  fi
+
+fi


Property changes on: kde-agent/trunk/ssh-agent-startup.sh
___________________________________________________________________
Added: svn:executable
   + *




More information about the arch-commits mailing list