3
# byobu-reconnect-sockets - source this file to re-establish
4
# GPG_AGENT_INFO and DBUS_SESSION_BUS_ADDRESS,
5
# useful when reconnecting to an existing
8
# Copyright (C) 2009 Canonical Ltd.
10
# Authors: Dustin Kirkland <kirkland@canonical.com>
12
# This program is free software: you can redistribute it and/or modify
13
# it under the terms of the GNU General Public License as published by
14
# the Free Software Foundation, version 3 of the License.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details.
21
# You should have received a copy of the GNU General Public License
22
# along with this program. If not, see <http://www.gnu.org/licenses/>.
25
if ! echo $- | grep -qs i; then
27
echo "ERROR: You must source this file, rather than execute it."
33
# Establish gpg-agent socket, helps when reconnecting to a detached session
34
for i in $(ls "$HOME/.gnupg/"gpg-agent-info-*); do
36
export GPG_AGENT_INFO && break
39
# Reconnect dbus, source the most recently touched session-bus
40
for i in $(ls -t "$HOME/.dbus/session-bus/" 2>/dev/null); do
41
. "$HOME/.dbus/session-bus/$i" || continue
42
export DBUS_SESSION_BUS_ADDRESS && break