mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 22:34:23 -07:00
usr/bin/byobu-launcher: handle nasty recursion, if ssh'ing to localhost,
and byobu-launches-by-default, LP: #595137
This commit is contained in:
parent
c23ec6207e
commit
403bffe8a2
2 changed files with 25 additions and 2 deletions
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -1,6 +1,7 @@
|
||||||
byobu (2.80) unreleased; urgency=low
|
byobu (2.80) unreleased; urgency=low
|
||||||
|
|
||||||
* UNRELEASED
|
* usr/bin/byobu-launcher: handle nasty recursion, if ssh'ing to localhost,
|
||||||
|
and byobu-launches-by-default, LP: #595137
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 04 Jun 2010 16:05:03 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 04 Jun 2010 16:05:03 -0500
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,32 @@
|
||||||
|
|
||||||
if [ ! -r "$HOME/.byobu/disable-autolaunch" ]; then
|
if [ ! -r "$HOME/.byobu/disable-autolaunch" ]; then
|
||||||
if printf "$TERM" | grep -qs "screen"; then
|
if printf "$TERM" | grep -qs "screen"; then
|
||||||
|
# Handle nesting
|
||||||
printf "$(gettext 'Do you want to launch byobu in a nested session?') [y/N]: "
|
printf "$(gettext 'Do you want to launch byobu in a nested session?') [y/N]: "
|
||||||
answer=$(head -n1)
|
answer=$(head -n1)
|
||||||
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
|
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
|
||||||
exec /usr/bin/byobu "$@"
|
# Prevent nasty launch recursion, if ssh'ing to localhost
|
||||||
|
if [ -n "$SSH_CONNECTION" ]; then
|
||||||
|
# This is an SSH session
|
||||||
|
from=$(echo "$SSH_CONNECTION" | awk '{print $1}')
|
||||||
|
to=$(echo "$SSH_CONNECTION" | awk '{print $3}')
|
||||||
|
if [ "$from" = "$to" ]; then
|
||||||
|
# We have ssh'd from this machine, to this machine
|
||||||
|
if screen -ls | grep -qs '(Attached)$'; then
|
||||||
|
# And there is already an attached screen session
|
||||||
|
# Exit to prevent recursion
|
||||||
|
false
|
||||||
|
else
|
||||||
|
exec /usr/bin/byobu "$@"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exec /usr/bin/byobu "$@"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exec /usr/bin/byobu "$@"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
false
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
exec /usr/bin/byobu "$@"
|
exec /usr/bin/byobu "$@"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue