blob: 356af6b521945a7d7cea8386cd58544fc44965e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/bin/bash
#----------------------------------------------------
# Author: Florian "Bluewind" Pritz <flo@xssn.at>
#
# Licensed under WTFPL v2
# (see COPYING for full license text)
#
#----------------------------------------------------
# make working with the agent easier and prevent
# starting multiple agents
#----------------------------------------------------
initgpg(){
[[ -z $XDG_CONFIG_HOME ]] && XDG_CONFIG_HOME="$HOME/.config"
[ -f "$XDG_CONFIG_HOME/disable-gpg-agent" ] && return 0
#if [[ ! -S "$HOME/.gnupg/S.gpg-agent.ssh" ]]; then
if ! pgrep -u ${SUDO_USER:-$USER} -x gpg-agent >/dev/null; then
#pkill gpg-agent
/usr/bin/gpg-agent --daemon --enable-ssh-support --use-standard-socket >/dev/null
fi
export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh
}
if [[ -n $DISPLAY ]]; then
initgpg
fi
|