~ubuntu-branches/ubuntu/utopic/byobu/utopic

« back to all changes in this revision

Viewing changes to usr/bin/byobu-reconnect-sockets

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2010-01-11 22:54:36 UTC
  • mto: This revision was merged to the branch mainline in revision 49.
  • Revision ID: james.westby@ubuntu.com-20100111225436-csnrc41k0bewth1e
Tags: upstream-2.47
ImportĀ upstreamĀ versionĀ 2.47

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
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
 
6
#                              byobu session.
 
7
#
 
8
#    Copyright (C) 2009 Canonical Ltd.
 
9
#
 
10
#    Authors: Dustin Kirkland <kirkland@canonical.com>
 
11
#
 
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.
 
15
#
 
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.
 
20
#
 
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/>.
 
23
 
 
24
 
 
25
if ! echo $- | grep -qs i; then
 
26
        echo
 
27
        echo "ERROR: You must source this file, rather than execute it."
 
28
        echo "  . $0"
 
29
        echo
 
30
        #exit 1
 
31
fi
 
32
 
 
33
# Establish gpg-agent socket, helps when reconnecting to a detached session
 
34
for i in $(ls "$HOME/.gnupg/"gpg-agent-info-*); do
 
35
        . "$i" || continue
 
36
        export GPG_AGENT_INFO && break
 
37
done
 
38
 
 
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
 
43
done