* usr/bin/byobu-reconnect-sockets:

- performance improvements, save a few forks
This commit is contained in:
Dustin Kirkland 2011-05-13 17:27:13 +02:00
commit bdf5b66cf1
2 changed files with 12 additions and 9 deletions

2
debian/changelog vendored
View file

@ -28,6 +28,8 @@ byobu (4.1) unreleased; urgency=low
[ Scott Moser ] [ Scott Moser ]
* usr/bin/byobu-status: * usr/bin/byobu-status:
- performance improvements, save a few forks - performance improvements, save a few forks
* usr/bin/byobu-reconnect-sockets:
- performance improvements, save a few forks
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 10 May 2011 23:34:58 +0200 -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 10 May 2011 23:34:58 +0200

View file

@ -23,6 +23,14 @@
PKG="byobu" PKG="byobu"
# newest(file,file,file..)
# return the newest file in the list
newest() {
local c="$1" i
for i in "$@"; do [ "$i" -nt "$c" ] && c="$i"; done
[ -e "$c" ] && _RET="$c"
}
case "$-" in case "$-" in
*i*) *i*)
# no-op # no-op
@ -38,15 +46,8 @@ case "$-" in
esac esac
# Establish gpg-agent socket, helps when reconnecting to a detached session # Establish gpg-agent socket, helps when reconnecting to a detached session
# Sorry, ls -t is needed here, to sort by time newest "$HOME/.gnupg/"gpg-agent-info-* && . "$_RET" && export GPG_AGENT_INFO
for i in $(ls -t "$HOME/.gnupg/"gpg-agent-info-* 2>/dev/null); do
. "$i" || continue
export GPG_AGENT_INFO && break
done
# Reconnect dbus, source the most recently touched session-bus # Reconnect dbus, source the most recently touched session-bus
# Sorry, ls -t is needed here, to sort by time # Sorry, ls -t is needed here, to sort by time
for i in $(ls -t "$HOME/.dbus/session-bus/" 2>/dev/null); do newest "$HOME/.dbus/session-bus/*" && . "$_RET" && export DBUS_SESSION_DBUS_ADDRESS
. "$HOME/.dbus/session-bus/$i" || continue
export DBUS_SESSION_BUS_ADDRESS && break
done