gpg-agent included
authorMart Lubbers <mart@martlubbers.net>
Thu, 8 May 2014 10:01:11 +0000 (12:01 +0200)
committerMart Lubbers <mart@martlubbers.net>
Thu, 8 May 2014 10:01:11 +0000 (12:01 +0200)
gpg-agent.conf [new file with mode: 0644]
gpg-agent.sh [new file with mode: 0644]
install

diff --git a/gpg-agent.conf b/gpg-agent.conf
new file mode 100644 (file)
index 0000000..20193f1
--- /dev/null
@@ -0,0 +1,2 @@
+pinentry-program /usr/bin/pinentry-curses
+default-cache-ttl 3600
diff --git a/gpg-agent.sh b/gpg-agent.sh
new file mode 100644 (file)
index 0000000..33c6451
--- /dev/null
@@ -0,0 +1,10 @@
+if [ $EUID -ne 0 ] ; then
+    envfile="$HOME/.gnupg/gpg-agent.env"
+    if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
+        eval "$(cat "$envfile")"
+    else
+        eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")"
+    fi
+    export GPG_AGENT_INFO  # the env file does not contain the export statement
+    export SSH_AUTH_SOCK   # enable gpg-agent for ssh
+fi
diff --git a/install b/install
index 2972749..e44388c 100755 (executable)
--- a/install
+++ b/install
@@ -5,8 +5,10 @@ cp -if `pwd`/.bashrc ~/.bashrc || true
 cp -if `pwd`/muttrc ~/.mutt/muttrc || true
 cp -if `pwd`/msmtp ~/.mutt/msmtp || true
 cp -if `pwd`/offlineimaprc ~/.mutt/offlineimaprc || true
+cp -if `pwd`/gpg-agent.conf ~/.gnupg/gpg-agent.conf || true
 sudo cp -if `pwd`/sudo/mpd.conf /etc/mpd.conf || true
 sudo cp -if `pwd`/sudo/settings.json /etc/transmission-daemon/settings.json || true
+sudo cp -if `pwd`/gpg-agent.sh /etc/profile.d/gpg-agent.sh || true
 
 if [ "$1" = "-x" ]
 then