From: PHO Date: Thu, 11 Apr 2019 12:47:16 +0000 (+0900) Subject: Auto commit by The Sugar System. X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=a20932caf06c7aa54a1bbf9fec8d235b67ef9b82;p=sugar.git Auto commit by The Sugar System. --- diff --git a/dot-files/_zshrc b/dot-files/_zshrc index af7b351..acd4fb1 100644 --- a/dot-files/_zshrc +++ b/dot-files/_zshrc @@ -342,6 +342,27 @@ function osname () { esac } +function _start_gpg_agent () { + if ! which gpg-agent >&/dev/null; then + # gpg-agent is not present. + return + fi + + if gpg-connect-agent /bye >&/dev/null; then + # gpg-agent is already running. + if [[ -f "${HOME}/.gpg-agent-info" ]]; then + . "${HOME}/.gpg-agent-info" + export GPG_AGENT_INFO + fi + else + # gpg-agent is not running yet. + eval $(gpg-agent --daemon --write-env-file "${HOME}/.gpg-agent-info") + fi + + GPG_TTY=$(tty) + export GPG_TTY +} + if _we_are_in_gnu_screen; then # When we are in a GNU Screen session... @@ -364,3 +385,5 @@ fi if which ssh-agent-manager >/dev/null 2>&1; then eval `ssh-agent-manager -s` fi + +_start_gpg_agent